cakephp

301 Redirects on old content with new cakephp site

I am updating an old asp site to cakephp - the old site has various listings on google based on the old "filename.asp" urls - I'd like to put Redirect 301s in the htaccess file to try and hang on to those search results (most of the pages have a complementing page on the new site), but something appears to be going wrong. htaccess as fol...

Cakephp: how to access to model "variables" (mapped from db) from the controller after a set?

Ok i have this controller: class ExampleController extends AppController { var $name = 'Example'; public function test_me () { $this->Example->Create(); $this->Example->set( 'variable_from_db_1' => 'random_value_1', 'variable_from_db_2' => 'random_value_2' ); //here, how can i...

CakePHP assocation question

I'm creating a small timesheet application. Timesheets have athletes, and each athlete has personal split times (like in running, or race car driving) An Athlete hasMany Run, a Run belongsTo Athlete, An Athlete hasAndBelongsToMany Timesheets (and vice versa). A Timesheet hasMany Run, and finally a Run belongsTo Timesheet. When I'm add...

Cakephp is not redirecting properly when pages are cached.

I am having some issues with a site that was working correctly until i implemented full page caching in CakePHP. I have followed the guidance in the Manual and have my $session->flash in a no-cache block as so: <cake:nocache> <? if($session->check('Message.flash')){ $session->flash(); } ?> </cake:nocache> However, whenever a ...

How to get weekdays in drop down in cakephp, with a default day selected?

Hi all, I want the weekdays to be displayed in a drop down in cakephp, with a default day selected. My code is as follows echo $form->input('Weekday', array('options' => array ('Monday','Tuesday','Wednesday','Thursday', 'Friday','Saturday', 'Sunday'))); When I do like this it stores 0 value in database instead of day name. Also I want ...

how to find out my current user id in other page controller after i login??

i am planing to set a permission on my event index page, which just allow certain user to view which had set when i add the event. After user click into my event, the event controller will 1st check the user id and check the event database which control the user can see which event in his calendar. The permission is added when user creat...

Assistance with CakePHP model relationships

How would I represent the following in a CakePHP model? Product ======= product_id .... Cart ==== cart_id .... Carts_Products ============== cart_id product_id quantity ...

Is it possible to store the fields of one Array as a new array?

Hi everyone, In my CakePHP app, I'm pulling in the results of a table called 'Timesheets'. This table has an athlete_id and a few split times for a race. I need to do some calculations on one athlete's times compared to another athlete (for instance, calculate the difference between the fastest finish time and slowest). I thought the ...

set a default saving data in a selection box in HABTM model

here is my problem which in my system. my system allow user to add event, which include date, time, places. In the other hand, user are allow to choose the "Event sharing to" some of other user. So i successful to created and share to other user, when the user login which are being choose to share with the event, he is able to view for ...

Cake PHP pagination problem

I have a controller and view. In the view it will displays all the records from the database. Also there is a search by form in the top of that view page. If we specify a search term and submit the form, the view will only displays the records resulting from that search. The results are paginated. But the problem is when I perform a...

how to set a selected value in $form->select function? need help

in my edit function, i need to reselect for the field again to save it. how can i added a 'selected'=>$addresscountry field in my $form->select function?? this is my code.. echo $country->select('Address.txtother_country','Please Choose Your Country' which $country is 1 of the helper that include by the page, let user to selec...

Action called from many other places, how to handle a "Back" button?

I have an action (view for example) in a controller that is called from multiple other actions in other controllers. How is the best way to create a "Back" button that will take me back to the page that got me here? I've used named parameters like "back_controller" and "back_action" and that works fairly well but they get awkward when ...

getting referer from auth in cakePHP

I have a link on the main page that is only accessible if they are logged in. However, if this link is clicked, I want to show a custom error message on the login page (a custom 'Message.auth'). i.e. I want (pseudo code) if (referer == '/users/reserve'){ Message.auth = 'Please log in to reserve tickets'; } else { Message.auth ...

Using DISTINCT in a CakePHP find function

Hello, I am writing a CakePHP 1.2 app. I have a list of people that I want the user to be able to filter on different fields. For each filterable field, I have a drop down list. Choose the filter combination, click filter, and the page shows only the records that match. In people_controller, I have this bit of code: $first_names = ...

cakephp routing without id?

Is there any way to route urls in cake without having the ID in the url? So instead of www.mydomain.com/id/article-name I just want www.mydomain.com/article-name I've been following this. http://book.cakephp.org/view/543/Passing-parameters-to-action ...

Why does my submit button not work in php?

I've created a php script which ends with <?php $form->end('Submit'); ?>. But why does the button submit can't function and can't be clicked? Someone can help me solve this problem? <div class="campaigns form"> <?php $form->create('Campaign'); ?> </fieldset> <?php echo $form->end('Submit'); ?> </div> ...

How can I auto renew data from MySQL without refresh?

I create dropdown fields to show the data from a MySQL database. Everytime when I key in new data, it must refresh to read the new data. I know Ajax can do it as well. But any other idea to solve this problem without refreshing to get the new data? Just when new data key in, it will auto renew without pressing F5 or refresh. This is my ...

CakePHP application on a hosted server?

How do I run cakePHP application on a hosted server? I have created my own application in CakePHP. It was running fine locally. But when I upload it to server, it's gives a 404 Not Found Error. Can anybody tell me how to upload CakePHP to the hosted server? ...

how can i get data from other browser without refreshing browser in cakephp??

i am new to cakephp, and also new to ajax. the function i trying to do is basically like this: i am in a add page, which let me select few customer on that page. but i wanted to set 1 more link for user, which let user click customer immediately on the add page, and the new data will show in my add page without refresh, so that the user...

CakePHP - why aren't errors being reported?

I've stopped receiving error messages in my CakePHP app. Normally error messages are suppressed if you have debug set to 0; if it is 1 or 2 then you get the error message, (plus stack trace, etc.) But I don't get anything if there is an error, regardless of my debug setting. So if I introduce an error (syntax, logic, whatever) all I get ...