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...
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...
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...
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...
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...
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'
)
...
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'...
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'...
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
...
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[...
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 ...
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...
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...
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> ...
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...
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 ...
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...
Hi,
Is there scribd cakephp component for scribd API.
I appreciate any help.
Thanks.
...
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...
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){
...