cakephp-2.0

Share controllers, models and views in multisite CakePHP 2.3 installation

不羁的心 提交于 2019-12-12 01:34:19
问题 I'm creating a CakePHP 2.3 advanced installation (several apps -websites- that share one same lib folder where all of cake's core files are located). This works without any problems, I just edit the core.php file in the Config folder for each app so it knows where to find cake's files. The file system looks something like: [root] [cake-core-files] [websites] [website-1] [app] [plugins] [vendors] [website-2] ... [website-N] These different apps are in fact different in some things (they are

php code to upload multiple images cakephp

為{幸葍}努か 提交于 2019-12-12 00:42:34
问题 i am new in cakephp and try to learn. my table structure is table name - drivers fields - id,name, table - drivers_uploads fields - id,driver_id,documentname,documentpath i try to upload multiple files in my table. My code is working well in folder it uploads multiple images but in table i want to insert all rows i want to insert multiple file for same id and the id goes in drivers tables and the remaining files insert multiple rows for same id in drivers_upload table. thanks in advance. for

CakePHP Logging to Live DB During Unit Testing

◇◆丶佛笑我妖孽 提交于 2019-12-12 00:37:26
问题 I'm using DB logging in Cake 2.1, which works great. The problem I'm having is when running Unit Tests, all logs are still getting sent to the live db rather than the test database. All other db interactions go to test, except logging. I do have a log fixture created and imported into the test case. Here's my Database logger (/Lib/Log/Engine/DatabaseLogger.php) App::uses('CakeLogInterface', 'Log'); class DatabaseLogger implements CakeLogInterface { public function __construct($options = array

CakePHP Elements not updating table

旧城冷巷雨未停 提交于 2019-12-12 00:10:53
问题 Hi Im trying to make a posts sections for a university project on video streaming website. I have a posts controller and model. I thought that I would create an element for the posts input box so that I could echo this out in the localhost/evolvids/uploads/watch/ section, however when I submit a post I get thrown a MISSING CONTROLLER error. This is my code for the Posts Element <div class="postsform"> <table> <tr> <td> <?php echo $this->Form->create('Posts', array('action'=>'add')); echo

CakeMail doesn't recognize to and viewvars functions

∥☆過路亽.° 提交于 2019-12-11 23:59:27
问题 In my user controller I added: App::uses('CakeEmail', 'Network/Email'); class UsersController extends AppController { function sign_up() { $this->autoRender = false; $email = new CakeEmail('default'); $email->template('sign_up'); $email->emailFormat('html'); $email->subject('Addience.com Sign Up'); $email->to($this->request->query['email']); $email->viewVars(array('password' => $this->Password->generatePassword(), 'email' => $this->request->query['email'], 'key' => $this->Password-

links not pointing to the right place

我的梦境 提交于 2019-12-11 23:35:45
问题 So im trying to build a link using cakephp, here is the code im using: echo $this->Html->link('FAQs',array('controller' => 'faqs','action' => 'index','full_base' => false)); and the link path im getting back is: http://mysite.co.uk/websites/123reg/LinuxPackage25/ho/me/tr/mysite.co.uk/public_html/faqs Im using a linux based hosting. Has anyone experienced this before? or is able to offer some help. thanks 回答1: First of all the problem isn't related to your use of full_base as it defaults to

CakePHP - Controller or No Controller?

牧云@^-^@ 提交于 2019-12-11 23:34:52
问题 I am currently building a web app which has two models, Donor and Donation Models respectively. It has multiple user roles. When the staff user first registers a donor, I want him to be redirected to another form which allows him to fill in the Donation details(the donor is registered once the first donation is successful). Firs of all, should I create a donation controller, from which I would redirect the user using: return $this->redirect(array('controller'=>'donations','action'=>'add'));

Cakephp Fatal error: Call to a member function format() on a non-object

橙三吉。 提交于 2019-12-11 22:57:41
问题 i am working on a Cakephp 2.3 .. here is my code class MessagesController extends AppController{ public $helpers = array('Time'); public function messages(){ $datetime= $this->Message->getDatetime($userid); //$datetime = 2013-06-14 10:28:00 $time = $this->Userinfo->getTimeZone($userid); //$time = 5.00 $finaltime = $this->Time->format('Y-m-d H:i:s', $dateTime, NULL, $time); exit(); } it is giving me Fatal error: Call to a member function format() on a non-object anybody know what i am doing

How do I restrict query results based on sub-results in CakePHP?

ε祈祈猫儿з 提交于 2019-12-11 20:18:50
问题 In CakePHP if I run the following find command $this->Instructor->find('all'); the following is returned: Array ( [0] => Array ( [Instructor] => Array ( [id] => 1 [user_id] => 3 [bio] => A billionaire playboy, industrialist and ingenious engineer, Tony Stark suffers a severe chest injury during a kidnapping in which his captors attempt to force him to build a weapon of mass destruction. He instead creates a powered suit of armor to save his life and escape captivity. He later uses the suit to

In CakePHP, how do I call an AppController method from a helper?

爱⌒轻易说出口 提交于 2019-12-11 19:56:08
问题 Follow up question to: In CakePHP, where would I put a method that performs a check on the Session User? Background: In my previous question, I was informed that the correct place to place a method such as levelCheck() which performs a semi-complicated evaluation of a user's level, and is needed in practically all my controllers, is the AppController . Now, this method is also incredibly useful for the way I design menu layouts and other view devices. For that reason, I would like to create a