cakephp

Cakephp redirect after session expires

Hello, I'm using CakePHP in one website and I was wondering how can I automagically redirect when the session has expired? ...

How to convert difference between dates into years using php.

Hi, I have dates in the format Start and end dates in the format(mm/yyyy). I want to display the difference of the dates in years, months. example: start date 09/2008 end date 07/2010 display should read 1 Year, 10 months. I appreciate any help. Thanks. ...

calling remote pages causing problem ?

Hi I Am getting this error while loading remote file in my page using ajax . Missing Controller Error: CbcController could not be found. Error: Create the class CbcController below in file: app/controllers/cbc_controller.php <?php class CbcController extends AppController { var $name = 'Cbc'; } ?> Notice: If you want to custo...

In cakephp,layout calling two times when i use AJAX

Please see below code snippt: <?php //Sets the update and indicator elements by DOM ID $paginator->options(array('update' => 'content','indicator' => 'spinner','url' =>$this->passedArgs)); echo $paginator->prev('<< Previous', null, null, array('class' => 'disabled')); echo $paginator->next('Next >>', null, null, array('class' =...

best practice to use action url while calling ajax in cakePHP

hello friends, I am using ajax with jQuery in my cakePHP application. and my javascript function is placed inside a javascript file. now in my local system the files are kept in "/sample" directory so the the path while i call the function will be in ajax.js $.post({url : "/sample/controller/action"}) but after hosting it the u...

cakephp routing problem (or maybe just confusion)

Hi, I've just started learning cakephp and have gotten the Blog example working except for the routing, I'm still not quite sure how it works after reading many, many documents on routing (including the ones in the official cookbook). My problem is with the '/' root routing, I want it to go to the index() function of the PostsControlle...

What are the defaults(homepage,controller,etc..) for cakePhp?

Hi, I understood (more or less) the separation between the MVC parts in cakePhp, however i cannot understand what are the defaults. meaning: What should i edit in order to change the root-entry-point of my site(the known "index.html" or "index.php" file, that shouldn't be changed in cake)? What controller? What model? What view? What ...

Multiple Controllers from a single view

Hello everyone, I recently started with CakePHP and so far I'm loving it, specially the scafolding and bake. I'm building a webapp that will manage applications to companies. (i.e., where have I applied to, with whom have I spoke, the status of the application(s), how long ago has it been since I did sent/recieved a communication rega...

How to create custom routes for certain actions in a CakePHP controller?

Coming from Django, I'm used to be able to organize my URL routings any way I see fit. For example, user registration would exist under the /users/ url. /users/ /users/registration/ /users/registration/optin/ /users/registration/thankyou/ However, I'm creating a user registration system in CakePHP and the default convention behaviour...

How to remove unwanted characters.

Hi, I am using cakephp 1.2. I am using httpsocket get method. It works well. But the content is enclosed by quotes.. string(123) "..this is where the content is". I think it is telling the type of response and the number of characters of the output. I have my application in production setup. How can i remove it. I appreciate any h...

how would you return two groups of Array data to be accessed by JQuery AJAX?

Hi all, I am learning cakePHP 1.26. and JQuery In a Controller, I got two an action with these lines of codes : function testing(){ $a = $this->User->findallByuser_id(1); $b = $this->User->Post->findallByuser_id(1); return a+b; // I was trying to return Array data $a and $b } how would you return two groups of Array data ($a and $b)...

removing double URL ?

at the end u will see double URL coming at the bottom .How we can remove that. ...

how to concatinate condition array in cakephp

to get the DB result in basis of condition if($keyword!='') build condition; /* array('conditions' => array("AND" => array ("esl.esl_artistname LIKE"=>"%".$artistname."%", "esl.esl_songname LIKE"=>"%".$songname."%")), 'limit' => $arrFind['limit'], 'page'=>$arrFind['page'])); */ if(!name!='') /* array('cond...

multiple prefix routing in cakePHP

Hello friendz, I have a new project with 4 users and some tasks which is only allowed to certain users. Since the users and tasks are fixed i thought no need of using ACL. is my decision is correct?? Then can i have multiple prefix for each users if yes how can i achive it?? I need to restrict the task of user A from user B how ...

Auth Component redirects automatically in cakePHP

Hello folks, After adding Auth component while accessing the home page it redirects to login page ie., let www.domain.com is my url. After adding the auth component when i try to access www.domain.com it redirects to www.domain.com/logins/login. how can i avoid this initial redirection?? i already given a route as below Router::co...

Smarty check if undefined

i am getting errors if smarty variable is undefined. Here is the code: < input type="text" value="{$data.allKeywords} id='keyId' /> I am getting the error: Undefined index: allKeywords. I know the variable - $data.allKeywords is undefined but should it not ignore it if a variable is undefined? Is there a way to check if it is unde...

How expensive is find('count') in CakePHP?

I have a CakePHP application where I am trying to get a count of how many of each type of post a user has. I am also using the paginate helper to display all the user's posts on their profile. I could: 1) Make a find('all', $conditions) request for all the user's posts then parse that for the counts I need (by going post by post and chec...

Solving Dual URL Problem..?

I am using cakephp I have 2 links: <a href="#" tabindex="1" onclick="base_load_demo1('http://www.boxyourtvtrial.com/widget/beer/main/');" >beer</a> <a href="#" tabindex="2" onclick="base_load_demo('http://www.boxyourtvtrial.com/widget/cocktail/main/');"&gt;cocktail&lt;/a&gt; With the following JavaScript: var Url1 = "http://www.boxyo...

[CakePHP] Timezone and more problems with Cakephp 1.3 and PHP 5.3.2

hi all, on server i have php 5.3.2, and cakephp 1.3. when i run cakephp application, it gives me following errors: Warning (2): strtotime() [http://php.net/function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In c...

CakePHP Routes with forward slash in argument

hi, I have started using cakePHP and have a little problem using routes. I'm trying to make some kind of catalog for products (e-shop without shopping :)) and like to have urls like "http://site.net/main_category/subcategory/subsubcategory-c154.htm" where -c means category and 154 is an Id of specified category. I like to pass this type...