cakephp-1.3

How can I set the title_for_layout in the default PagesController?

て烟熏妆下的殇ゞ 提交于 2019-12-04 07:44:32
I cannot set title_for_layout in the PagesController that comes by default with CakePHP 1.3. I am using the following code in the display function: $this->set('title_for_layout','some title'); What am I doing wrong? In your controller, the corresponding value is $this->pageTitle . UPDATE Oops, as noted in the comments, this is the 1.2 solution. 1.3 possibilities (after doing some research) include: Ensuring that $title_for_layout is being echoed in the layout Placing the $this->set() code in the view rather than in the controller If you'd like to mimic the behavior of cake 1.2, you can do the

Find Condition by And doen't work + cakephp

情到浓时终转凉″ 提交于 2019-12-04 06:51:02
问题 This function is working on OR condition. I need this to work with AND condition. Any help: $ands = array(); foreach ($array_training_id as $id) { $ands[] = array('TrainingsUser.training_id' => $id); } $conditions = array('AND' => $ands); $users = $this->TrainingsUser->find('all', array('conditions' => $conditions)); I'd like to write a query AND condition like this: SELECT user_id FROM trainings_users WHERE training_id = 172 AND training_id = 174 This query is working when is getting the

Cakephp 2.1 naming convensions issue in version change

我的梦境 提交于 2019-12-04 05:48:15
问题 I have just installed CakePHP 2.1. And just see that the naming convention of its is just change lot from the older version which making me crazy. Like it was app/controllers while now it is app/Controller same way app/models - app/Model app/views - app/View I know there must be some advantage on doing this. But my problem is when I use the cake bake it is creating directory in the same old fashion i.e. controllers/models/views . Which is no more accessible from the URL & obviously will throw

cakephp inside a subdirectory

主宰稳场 提交于 2019-12-04 05:45:09
问题 I have a problem with cakephp, I can't find a way to get cakephp working in a subdirectory. I have a webpage that resides at www.example.com and I want to have cakephp application on www.example.com/cake . www.example.com is a virtual host and cake is it's subdirectory where all of the cake files and directories are stored. The problem is that when I go to www.example.com/cake it requests a CakeController and has no stylesheets loaded. When I go to www.example.com/cake/users/register (=

CakePHP : Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 52 bytes)

故事扮演 提交于 2019-12-04 00:18:39
问题 Hi i have a apps running on CakePHP v 1.3 . I've updated my wamp server to v2.4 .After updating i got this error message.I did these changes into my php.ini settings. memory_limit = 128M file_uploads = ON upload_max_filesize = 128M max_input_time max_execution_time = 300 post_max_size = 128M realpath_cache_size = 16k realpath_cache_ttl = 120 But i'm still getting these Error message : CakePHP : Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 52 bytes) in C:

use cakephp component inside a model

99封情书 提交于 2019-12-03 23:31:16
How do I use a component that I created in cakePHP inside one of my model classes? Is this possible? If so, please let me know how I can do so It is possible but pretty bad practice in a MVC framework. You should re-think and re-organize your code if you think you need to use the component in a model because something is cleary wrong then. A component is thought to share code between controllers, only between controllers. Components in CakePHP 1.3 Components in CakePHP 2.x Components in CakePHP 3.x To share re-usable code between models it would be a behavior. For a view it would be a helper.

File Upload validation only on record create, not edit

懵懂的女人 提交于 2019-12-03 23:16:00
I've got a form that allows a file upload and I'm using data validation to check what type of file it is and that's all good. What I want to do is then allow them to edit that same record but a file upload at that time is not needed. My validation rule is as follows: 'header_pic' => array( 'extension' => array( 'rule' => array('extension', array('jpeg', 'jpg', 'gif', 'png')), 'message' => 'You must supply a GIF, PNG, or JPG file.', ) ) But this rule requires a file. I found the 'on' parameter and I could add it to this rule but it would then only check files on creation. Not on editing. I

CakePHP Pagination count not matching query?

两盒软妹~` 提交于 2019-12-03 16:27:33
I've got a fairly modified pagination query using a number of Joins etc - but for some reason the paginator->counter() never matches the results from the count query. You can see it in action at http://dev.qreer.com/ - by choosing various options on the LHS navigation, the query output is below and the paginator count appears to be pretty random. Any idea where I can start looking to debug this? In the Jobs Controller: $this->paginate = $this->Job->paginateParams($data); $jobs = $this->paginate('Job'); $this->set(compact('jobs')); In the Model: function paginateParams($data = null){ //lots of

Javascript-CSS Show and Hide form elements

江枫思渺然 提交于 2019-12-03 14:09:26
By using Javascript how to show and hide some parts of the table(Eg: TR or TD). This should work depending on the data fetched from the Database I am using CakePHP framework for my Application and using a single view file for Add and Edit. In Edit mode - Depending on the data fetched, I need to show and hide some parts of the form elements. Scenario There are five questions A,B,C,D nad E B is dependent on A, C is dependent on B, D is dependent on C and E is dependent on D So while adding I have hidden B,C,D and E on selecting of the respective questions the other questions will be displayed. A

FULL TEXT SEARCH in cakephp ? any example

烂漫一生 提交于 2019-12-03 13:24:28
I am using ordinary search functionality in my business controller . but now need to implement FULL TEXT SEARCH with paginate can any one give idea or sample ? I am using MySQL with MyISAM tabes and this my table structure, fields marked bold are need to use in search CREATE TABLE IF NOT EXISTS businesses ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, created date NOT NULL, modified datetime NOT NULL, user_id bigint(20) NOT NULL, slug varchar(255) NOT NULL, **`name` varchar(255) NOT NULL,** **street_name varchar(255) DEFAULT NULL,** **shopping_center varchar(255) DEFAULT NULL,** state_id