cakephp-1.2

a member function check() on a non-object

Hi all, I am using cakePHP 1.26. In a .ctp file, I have a few like of codes like this: $sess = $this->Session->check('user'); if($sess){ // do soemthing } else{ // do soemthing then } But I got this error then: Fatal error: Call to a member function check() on a non-object in /home/vol12/mysite.com/htdocs/app/views/layouts/te...

what is the variable that stores a message in a session in cakePHP?

Hi all, I am using cakePHP 1.26. I got this line of code in a Controller: $this->Session->setFlash('helloworld'); This line of code works perfectly, but I am not sure if there is a variable to store the message: "helloworld" in cakePHP. If yes, can I change the name of this variable? And how can I check out the variable which stored...

The save() method in cakePHP

Hi all, I am doing some self-learning about cakePHP 1.26. I got a table which has two fields {topic, username} I got a simple HMTL form like this: <input type=text name="data[testing][topic]" id="data[testing][topic]"/> The data from this input field was passed to the specific controller with this code: $who=$this->Session->read('u...

relative URLs in cakePHP

Hi all, I am using cakePHP 1.26 and TinyMCE v3.38. The .js file of the TinyMSC is stored under this directory: http://www.mysite/js/tiny_mce/tiny_mce.js In the page where the users can post new topic, the URL of this page is like this: http://www.mysite/user/newpost Now I need to add the javascript to this page, and I have tried these...

Fail to sort data in DESC data in FindAllBySomething

Hi all, I am using cakePHP 1.26. I am trying to sort the data by Date in DESC order but of no luck. $this->set('posts', $this->Post->findAllByZero('0', array('order'=>array('Post.createdate DESC')))); I can't figure out what's wrong in the code as shown above. Could you help me please? Edited reason: I have altered the code and it...

Need some help with my code

Hi all, I am using cakephp 1.26 and doing pagination. could you help me with the following code please? I can't figure out what's wrong in the code. $this->set('posts', $this->paginate = array('order'=>array('Post.created'=> 'DESC'), 'conditions'=>array('Post.zero'=>'0'), 'limit'='6' ) ...

what should be input into the brackets of $this->paginate()

Hi all, I am using cakephp 1.26. I am doing some self-learning about Pagination in CakePHP. I have tested the following code in my localhost, and it works fine. I have altered a little change to the second line of code, and found that nothing change to the result. 1st version: $this->paginate=array('conditions'=>array('Testing.zero'...

Pagination with hasmany association in CakePHP

Hi all, I am doing some self-learning about pagination in cakePHP 1.26. In the PostsController, I have this code: $this->set('views', $this->Testing->Reply->findAllBypost_id($id)); I am trying to alter the code for pagination purpose, and this is what I have tried out: $this->paginate=array('conditions'=>array('Reply.post_id'=>'0'...

Wrong URL resulted in pagination.

Hi all, I am using cakePHP 1.26. In the PostsController, I have this: $this->paginate=array('conditions'=>array('Reply.post_id'=>$id),'limit' => 1); $w = $this->paginate($this->Post->Reply); $this->set('views', $w); And in the view.ctp, I have this: <table><tr><td> <?php echo $paginator->numbers(); ?> <?php ...

How to use the cakePHP built-in FORM helper to generate Text and Hidden text boxes

Hi all, I am using cakePHP 1.26. I am sorry to ask this question, but I couldn't work out how to use the cakePHP built-in FORM helper to generate the code like these two: <input type="text" name="data[Test][quote]" id="data[Test][quote]" size="12" style="font-family:Arial" value="helloworld" readonly> <input type="hidden" name="data[...

Search receiver ID by the USER ID first and locate the data by the receiver ID

Hi all, I am using cakePHP 1.26. I got a simple Table with some data in my localhost Database: user_id | message | receiver_id ----------------------------- 1 | helloworld | 12 2 | hi there | 12 Let say the system now received the $userid from a user. The user only got the user ID. He wants to search all the message ...

Select Tag with a few options containing multiple values in cakePHP

Hi all, I am using cakePHP 1.26. I am designing a Select Tag with a few Options, and each of the options will contain multiple values. Yet, there is not only one way to do it: Method 1: <select name=""> <option value="[0,1,2,3]">Option one</option> </select> Method 2: <select name=""> <option va...

list the Data in sequential order according to the Date

hi all, I am learning cakePHP 1.26. I got some sample data in a Table Testing which consists of two fields: (there is not primary key in this sample Table) Data | Date Hello     |  2010-07-1 15:11:11 World   | 2010-07-1 11:01:01 Hi there  | 2010-07-02 11:36:11 I need to find out their position number according to the Date when they w...

Retrieve some Array data from a Submit form in cakePHP

Hi all, I am learning cakePHP 1.26. I got a HTML Select tag with some options like this: <form method="post" action="/testing"> <table border="1"> <tr> <td> <select name="data[Test][number]"> <option name="editquote" value="[29,1]">One</option> <option name="editquote" value="[24,2]">Two</option> </select> </td> ...

What is the best way to decalre a global variable in cakePHP

Hi all, I am learning cakePHP 1.26. I got a Controller which got two functions. I was thinking to make $myVariable a global variable so that both functions in the controllers can share it, but I am not sure if this is the best way to declare a global variable in cakePHP: class TestingController extends AppController { var $myVar...

Can not insert data by the function saveAll with many model

Hi All, I have a problem related to the function "SaveAll" in cakephp 1.2+ as the following: I have 3 models: A, B, C that the relation is: A belongTo B B hasOne A B belongTo C C hasOne B Above it means A,B,C all relation is 1-1 I have a form that includes all field of A,B,C to create new A,B,C. When saving, I can't create new ...

Containable behavior does not return from depth 3 - CakePHP

Hi, I use CakePHP 1.2.6 and have the following relations: Showcase HABTM User belongsTo Galleryitem hasOne Image I try to get all the data related to a Showcase, and therefor also all its users with their Galleryitem -> Image. I use the following query: $showcase = $this->Showcase->find('first', array('conditions'=>array('Showcase...

Is there Scribd Api component available for Cakephp 1.2.

Hi, Is there scribd cakephp component for scribd API. I appreciate any help. Thanks. ...

how do you maximize the usability of a self-defined function in CakePHP

Hi all, I am learning cakePHP 1.26. A question came across my mind when I was creating a function in a Controller. How do I maximize the usability of a self-defined function in CakePHP. Here is my sample code: function hello($id=null){ $IfLoggedIn=$this->Session->check('user'); if($IfLoggedIn){ //search the dat...

Use of requestAction in the ctp file and it turned out a blank page instead.

Hi all, I am using cakePHP 1.26. The web page turned out blank when I tried to use requestAction to access a function in a COntroller from a .ctp. Here is the code: <?php class TestingController extends AppController { function hello($id=null){ $IfLoggedIn=$this->Session->check('user'); if($IfLoggedIn){ ...