cakephp-2.3

Creating Pagination With CakePHP For Custom Template Links

人盡茶涼 提交于 2019-12-06 11:46:50
I've following custom template for pagination links <li class="prev"><a href="#">prev</a></li> <li><a href="#" class="active">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> <li><a href="#">6</a></li> <li><a href="#">7</a></li> <li><a href="#">8</a></li> <li>...</li> <li><a href="#">30</a></li> <li class="next"><a href="#">next</a></li> I've tried it by using following code( cakephp 2.3 version ) but not getting the result as required. <?php echo $this->Paginator->prev('<', array( 'class' => '', 'tag' => 'li' ), null, array

Strict (2048): Declaration of CsvImportBehavior::setup() should be compatible with ModelBehavior

大憨熊 提交于 2019-12-06 05:22:45
I am getting the following error: Strict (2048): Declaration of CsvImportBehavior::setup() should be compatible with ModelBehavior::setup(Model $model, $config = Array) [APP\Plugin\Utils\Model\Behavior\CsvImportBehavior.php, line 20] I followed the tutorial on this site: http://www.pronique.com/blog/enable-csv-import-all-controllers-models-cakephp-2 When I import my CSV file, it gives the following flash message: Successfully imported 0 records from Book1.csv I don't understand why its not importing, does it have something to do with the error/warning its giving? I looked inside the behaviour

cakephp paginator helper shows error when delete the last record from the last page

那年仲夏 提交于 2019-12-06 02:51:28
问题 I just want to redirect that to the last index if the last record is deleted from the last page. please help me to do this. <?php echo $this->Paginator->prev ($this->Html->image('prev.png'), array('escape' => false), array(), null, array('class' => 'prev')); echo $this->Paginator->counter ('Page {:page} of {:pages}, Total Records {:count}'); echo $this->Paginator->next($this->Html->image ('next.png'), array('escape' => false), array(), null, array('class' => 'next')); ?> 回答1: As of CakePHP 2

User sessions and two CakePHP applications running in the same machine

跟風遠走 提交于 2019-12-05 20:29:33
I have 2 CakePHP applications running on the same machine. Both of them need a previous registration to have access to them and the first thing users see is the login form. I have realized that when I do login in one of them, then, I can access to the other web application without being asked for my credentials to login. (which is not correct) In my Controllers of both applications I have this to deny access without a previous login. public function beforeFilter(){ parent::beforeFilter(); $this->Auth->deny(); } But this seems not to work properly when I use the same browser and I do login in

Cakephp image -Can not determine the mimetype

社会主义新天地 提交于 2019-12-05 10:25:47
cakephp 2.3 I'm uploading an image and I have an error saying that: Can not determine the mimetype. Error: An Internal Error Has Occurred. On my Model this is a part of my $validation 'file_name' => array( 'uploadError' => array( 'rule' =>'uploadError', 'message' => 'Your image upload failed', 'allowEmpty' => FALSE, //'required' => false, //'last' => false, // Stop validation after this rule //'on' => 'create', // Limit validation to 'create' or 'update' operations ), 'mimeType' => array( 'rule' => array('mimeType', array('image/gif', 'image/png', 'image/jpg', 'image/jpeg')), 'message' =>

Saving spatial data in CakePHP

时间秒杀一切 提交于 2019-12-05 09:54:57
I have a problem saving spatial data in CakePHP with saveAll(). I really dont want to write the query manually ( Handling spatial data in CakePHP ) because there are number of models being saved. Also I read this CakePHP and MySQL Spatial Extension but when I try to do the same, $db->expression() returns an stdClass. This is the returned object printed out: stdClass Object ( [type] => expression [value] => GeomFromText('POINT(48.18879 18.527579999999944)') ) If I use this object the way it is used in CakePHP and MySQL Spatial Extension and try to save it with saveAll() I get this error: Error

cakephp paginator helper shows error when delete the last record from the last page

旧时模样 提交于 2019-12-04 07:12:21
I just want to redirect that to the last index if the last record is deleted from the last page. please help me to do this. <?php echo $this->Paginator->prev ($this->Html->image('prev.png'), array('escape' => false), array(), null, array('class' => 'prev')); echo $this->Paginator->counter ('Page {:page} of {:pages}, Total Records {:count}'); echo $this->Paginator->next($this->Html->image ('next.png'), array('escape' => false), array(), null, array('class' => 'next')); ?> As of CakePHP 2.3 - Out of Range page requests will throw an exception. However the documentation is not correct in saying

PHPStorm autocomplete for CakePHP custom helpers in view files

余生长醉 提交于 2019-12-04 04:58:23
I use PhpStorm 6.0.2 and CakePHP 2.3. In my controller file I define this and get autocomplete for my custom components: /** * @property MysuperComponent $Mysuper */ Regarding to this , in my view files I define this to reach Cake's core helpers and this works: /** * @var $this View */ I need autocomplete for custom helpers inside my views. I tried this but didn't work: /** * @property Myelegant $MyelegantHelper */ When I do this, this works partially: /** * @var $Myelegant MyelegantHelper */ I get this $Myelegant-> autocomplete. But it isn't adequate. I need autocomplete like this: $this-

CakePHP re-populate list box

江枫思渺然 提交于 2019-12-02 13:33:06
I have a question about cakePHP. I create two drop down lists in my view. When the user changes the value in one list, I want the second to change. Currently, I have this working like this: An on click event fires when the user selects from list box one. This fires a jQuery ajax function that calls a function from my controller. This is all working fine, but how do I re-render my control, asynchronously (or, view)? I i know I could just serialize the array to json and then recreate the control in javascript, but there seems like there should be a more "CakePHP" way. Isn't that what render is

Making jquery ajax call from view to controller in cakephp 2.x

…衆ロ難τιáo~ 提交于 2019-12-02 06:42:51
I Am trying to make an ajax request from the view to controller, ajax requst is working fine, but from controller nothing is returned back to the view. i don't know where is the problem.. what i am trying is in my view side i am displaying some data from the controller and there is one select box. whe i select a city from the select box, it calls the ajax request and should show the result from that particular city in the view.ctp. $('#cityid').change(function() { $city_id= $('#cityid :selected').val(); alert($city_id); $.ajax({ url : "<?php echo Router::url(array('controller' => 'deals',