在 CakePHP 项目中使用 Constant Contact PHP Wrapper 的正确方法是什么

发布于 2024-11-08 17:03:28 字数 4855 浏览 0 评论 0原文

我正在扩展现有的 CakePHP 项目以利用 Constant Contact API 和 php 包装器文件:ctctWrapper.php

我已经下载了 ctctWrapper 并将其放置在 app/vendors 文件夹中并将其另存为“ctctwrapper.php”,以便 Cake 能够通过以下实现自动查找该文件:

contacts_controller.php

<?php
App::import('Vendor', 'ctctwrapper');

class ContactsController extends AppController {


    var $name = 'Contacts';
    var $uses = array('Contact', 'Group', 'MarketingList');
    //Set pagination defaults
    var $paginate = array(
            'limit' => 25,
            'order' => array(
                    'Contact.lastname' => 'asc'
                )
            );
function send(){
  //do stuff here
}

}

?>

views/contacts/send.ctp

Create a new folder on Constant Contact:
<?php

echo $this->Form->create('Contact', array('action' => 'send'));
echo $this->Form->input('foldername');
echo $this->Form->end('Submit');

?>

当我访问 / 时, project/contacts/send,会发出以下警告,大概是因为这些数组索引未定义。我是否缺少某些东西才能使其正常工作? (注意:由于 Cake 的“文件夹”类存在问题,我还必须重命名 CC“文件夹”类)。

感谢您的关注!

错误:

Notice (8): Undefined index: status [CORE/vendors/ctctwrapper.php, line 1235]
Notice (8): Undefined index: link [CORE/vendors/ctctwrapper.php, line 1239]
Notice (8): Undefined index: email_address [CORE/vendors/ctctwrapper.php, line 1241]
Notice (8): Undefined index: first_name [CORE/vendors/ctctwrapper.php, line 1242]
Notice (8): Undefined index: middle_name [CORE/vendors/ctctwrapper.php, line 1243]
Notice (8): Undefined index: last_name [CORE/vendors/ctctwrapper.php, line 1244]
Notice (8): Undefined index: company_name [CORE/vendors/ctctwrapper.php, line 1245]
Notice (8): Undefined index: job_title [CORE/vendors/ctctwrapper.php, line 1246]
Notice (8): Undefined index: home_number [CORE/vendors/ctctwrapper.php, line 1247]
Notice (8): Undefined index: work_number [CORE/vendors/ctctwrapper.php, line 1248]
Notice (8): Undefined index: address_line_1 [CORE/vendors/ctctwrapper.php, line 1249]
Notice (8): Undefined index: address_line_2 [CORE/vendors/ctctwrapper.php, line 1250]
Notice (8): Undefined index: address_line_3 [CORE/vendors/ctctwrapper.php, line 1251]
Notice (8): Undefined index: city_name [CORE/vendors/ctctwrapper.php, line 1252]
Notice (8): Undefined index: state_code [CORE/vendors/ctctwrapper.php, line 1253]
Notice (8): Undefined index: state_name [CORE/vendors/ctctwrapper.php, line 1254]
Notice (8): Undefined index: country_code [CORE/vendors/ctctwrapper.php, line 1255]
Notice (8): Undefined index: zip_code [CORE/vendors/ctctwrapper.php, line 1256]
Notice (8): Undefined index: sub_zip_code [CORE/vendors/ctctwrapper.php, line 1257]
Notice (8): Undefined index: notes [CORE/vendors/ctctwrapper.php, line 1258]
Notice (8): Undefined index: custom_field_1 [CORE/vendors/ctctwrapper.php, line 1259]
Notice (8): Undefined index: custom_field_2 [CORE/vendors/ctctwrapper.php, line 1260]
Notice (8): Undefined index: custom_field_3 [CORE/vendors/ctctwrapper.php, line 1261]
Notice (8): Undefined index: custom_field_4 [CORE/vendors/ctctwrapper.php, line 1262]
Notice (8): Undefined index: custom_field_5 [CORE/vendors/ctctwrapper.php, line 1263]
Notice (8): Undefined index: custom_field_6 [CORE/vendors/ctctwrapper.php, line 1264]
Notice (8): Undefined index: custom_field_7 [CORE/vendors/ctctwrapper.php, line 1265]
Notice (8): Undefined index: custom_field_8 [CORE/vendors/ctctwrapper.php, line 1266]
Notice (8): Undefined index: custom_field_9 [CORE/vendors/ctctwrapper.php, line 1267]
Notice (8): Undefined index: custom_field_10 [CORE/vendors/ctctwrapper.php, line 1268]
Notice (8): Undefined index: custom_field_11 [CORE/vendors/ctctwrapper.php, line 1269]
Notice (8): Undefined index: custom_field_12 [CORE/vendors/ctctwrapper.php, line 1270]
Notice (8): Undefined index: custom_field_13 [CORE/vendors/ctctwrapper.php, line 1271]
Notice (8): Undefined index: custom_field_14 [CORE/vendors/ctctwrapper.php, line 1272]
Notice (8): Undefined index: custom_field_15 [CORE/vendors/ctctwrapper.php, line 1273]
Notice (8): Undefined index: mail_type [CORE/vendors/ctctwrapper.php, line 1274]
Notice (8): Undefined index: lists [CORE/vendors/ctctwrapper.php, line 1277]
Notice (8): Undefined index: id [CORE/vendors/ctctwrapper.php, line 1240]
Notice (8): Undefined property: Contact::$table [CORE/cake/libs/model/model.php, line 666]
Notice (8): Undefined property: Contact::$table [CORE/cake/libs/model/model.php, line 707]
Notice (8): Undefined property: Contact::$table [CORE/cake/libs/model/model.php, line 698]
Warning (2): Cannot modify header information - headers already sent by (output started at /opt/local/apache2/htdocs/outreach/cake/libs/debugger.php:673) [CORE/cake/libs/controller/controller.php, line 746]

I am extending an existing CakePHP project to utilize the Constant Contact API and php wrapper file: ctctWrapper.php.

I have downloaded ctctWrapper and placed it in the app/vendors folder and saved it as 'ctctwrapper.php' in order for Cake to automagically find the file with the following implementation:

contacts_controller.php

<?php
App::import('Vendor', 'ctctwrapper');

class ContactsController extends AppController {


    var $name = 'Contacts';
    var $uses = array('Contact', 'Group', 'MarketingList');
    //Set pagination defaults
    var $paginate = array(
            'limit' => 25,
            'order' => array(
                    'Contact.lastname' => 'asc'
                )
            );
function send(){
  //do stuff here
}

}

?>

views/contacts/send.ctp

Create a new folder on Constant Contact:
<?php

echo $this->Form->create('Contact', array('action' => 'send'));
echo $this->Form->input('foldername');
echo $this->Form->end('Submit');

?>

when i visit /project/contacts/send, the following warnings are issued, presumably because these array indicies are not defined. Is there something i'm missing to get this to work properly? (note: i also had to rename the CC 'Folder' class due to an issue with Cake's 'Folder' class).

Thanks for looking!

errors:

Notice (8): Undefined index: status [CORE/vendors/ctctwrapper.php, line 1235]
Notice (8): Undefined index: link [CORE/vendors/ctctwrapper.php, line 1239]
Notice (8): Undefined index: email_address [CORE/vendors/ctctwrapper.php, line 1241]
Notice (8): Undefined index: first_name [CORE/vendors/ctctwrapper.php, line 1242]
Notice (8): Undefined index: middle_name [CORE/vendors/ctctwrapper.php, line 1243]
Notice (8): Undefined index: last_name [CORE/vendors/ctctwrapper.php, line 1244]
Notice (8): Undefined index: company_name [CORE/vendors/ctctwrapper.php, line 1245]
Notice (8): Undefined index: job_title [CORE/vendors/ctctwrapper.php, line 1246]
Notice (8): Undefined index: home_number [CORE/vendors/ctctwrapper.php, line 1247]
Notice (8): Undefined index: work_number [CORE/vendors/ctctwrapper.php, line 1248]
Notice (8): Undefined index: address_line_1 [CORE/vendors/ctctwrapper.php, line 1249]
Notice (8): Undefined index: address_line_2 [CORE/vendors/ctctwrapper.php, line 1250]
Notice (8): Undefined index: address_line_3 [CORE/vendors/ctctwrapper.php, line 1251]
Notice (8): Undefined index: city_name [CORE/vendors/ctctwrapper.php, line 1252]
Notice (8): Undefined index: state_code [CORE/vendors/ctctwrapper.php, line 1253]
Notice (8): Undefined index: state_name [CORE/vendors/ctctwrapper.php, line 1254]
Notice (8): Undefined index: country_code [CORE/vendors/ctctwrapper.php, line 1255]
Notice (8): Undefined index: zip_code [CORE/vendors/ctctwrapper.php, line 1256]
Notice (8): Undefined index: sub_zip_code [CORE/vendors/ctctwrapper.php, line 1257]
Notice (8): Undefined index: notes [CORE/vendors/ctctwrapper.php, line 1258]
Notice (8): Undefined index: custom_field_1 [CORE/vendors/ctctwrapper.php, line 1259]
Notice (8): Undefined index: custom_field_2 [CORE/vendors/ctctwrapper.php, line 1260]
Notice (8): Undefined index: custom_field_3 [CORE/vendors/ctctwrapper.php, line 1261]
Notice (8): Undefined index: custom_field_4 [CORE/vendors/ctctwrapper.php, line 1262]
Notice (8): Undefined index: custom_field_5 [CORE/vendors/ctctwrapper.php, line 1263]
Notice (8): Undefined index: custom_field_6 [CORE/vendors/ctctwrapper.php, line 1264]
Notice (8): Undefined index: custom_field_7 [CORE/vendors/ctctwrapper.php, line 1265]
Notice (8): Undefined index: custom_field_8 [CORE/vendors/ctctwrapper.php, line 1266]
Notice (8): Undefined index: custom_field_9 [CORE/vendors/ctctwrapper.php, line 1267]
Notice (8): Undefined index: custom_field_10 [CORE/vendors/ctctwrapper.php, line 1268]
Notice (8): Undefined index: custom_field_11 [CORE/vendors/ctctwrapper.php, line 1269]
Notice (8): Undefined index: custom_field_12 [CORE/vendors/ctctwrapper.php, line 1270]
Notice (8): Undefined index: custom_field_13 [CORE/vendors/ctctwrapper.php, line 1271]
Notice (8): Undefined index: custom_field_14 [CORE/vendors/ctctwrapper.php, line 1272]
Notice (8): Undefined index: custom_field_15 [CORE/vendors/ctctwrapper.php, line 1273]
Notice (8): Undefined index: mail_type [CORE/vendors/ctctwrapper.php, line 1274]
Notice (8): Undefined index: lists [CORE/vendors/ctctwrapper.php, line 1277]
Notice (8): Undefined index: id [CORE/vendors/ctctwrapper.php, line 1240]
Notice (8): Undefined property: Contact::$table [CORE/cake/libs/model/model.php, line 666]
Notice (8): Undefined property: Contact::$table [CORE/cake/libs/model/model.php, line 707]
Notice (8): Undefined property: Contact::$table [CORE/cake/libs/model/model.php, line 698]
Warning (2): Cannot modify header information - headers already sent by (output started at /opt/local/apache2/htdocs/outreach/cake/libs/debugger.php:673) [CORE/cake/libs/controller/controller.php, line 746]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

今天小雨转甜 2024-11-15 17:03:28

看起来大多数错误只是参数不存在的低级警告。这些都是相对无害的。例外情况是靠近末尾的以下几行。

Notice (8): Undefined property: Contact::$table [CORE/cake/libs/model/model.php, line 666]
Notice (8): Undefined property: Contact::$table [CORE/cake/libs/model/model.php, line 707]
Notice (8): Undefined property: Contact::$table [CORE/cake/libs/model/model.php, line 698]

我敢打赌,这些错误是您实际问题发生的地方,与 Constant Contact API 类没有太大关系。

由于我们看不到 send() 函数中发生了什么,因此几乎不可能进一步调试它。

It looks like most of the errors are just low-level warnings that params don't exist. These are relatively harmless. The exceptions are the following lines near the end.

Notice (8): Undefined property: Contact::$table [CORE/cake/libs/model/model.php, line 666]
Notice (8): Undefined property: Contact::$table [CORE/cake/libs/model/model.php, line 707]
Notice (8): Undefined property: Contact::$table [CORE/cake/libs/model/model.php, line 698]

I'd wager a guess that those errors are where your actual problem is taking place and doesn't have much to do with the Constant Contact API class.

Since we can't see what's going on in your send() function, it's next to impossible to debug it any further.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文