Re: display data 3 tables

2014-06-05 Thread ajt


There just is no user being displayed with the below, there is with Teacher in 
the find if I add it but every field is undefined in the view. 

  $this-Tutorsession-recursive = 2;

$contain = array('Teacher' = array('User'));
$this-set('tutor', $this-Tutorsession-find('first',array(
'conditions' = array('Teacher.user_id' = $id),
'contain' = $contain
)));





array(
'Tutorsession' = array(
'id' = '1',
'teacher_id' = '1',
'student_id' = '1',
'subject' = 'maths',
'sessiondate' = '2014-05-06',
'sessiontime' = '2014-05-29 00:27:00',
'available' = '1'
),
'Teacher' = array(
'id' = '1',
'user_id' = '3',
'firstname' = 'fred',
'surname' = 'smith3',
'address' = '1 hard str',
'suburb' = 'chelsea2',
'phone' = '0',
'fullname' = 'fred smith3',
'User' = array(
'password' = '*',
'id' = '3',
'username' = 'teach',
'role' = 'teacher',
'created' = '2014-05-31 11:08:39',
'modified' = '2014-05-31 11:08:39'
),
'Tutorsession' = array(
(int) 0 = array(
'id' = '1',
'teacher_id' = '1',
'student_id' = '1',
'subject' = 'maths',
'sessiondate' = '2014-05-06',
'sessiontime' = '2014-05-29 00:27:00',
'available' = '1'
)
)
),
'Student' = array(
'id' = '1',
'user_id' = '1',
'firstname' = 'tom',
'surname' = 'blog',
'address' = '3 glen str ',
'suburb' = 'chelsea',
'phone' = '044',
'fullname' = 'tom blog',
'User' = array(
'password' = '*',
'id' = '1',
'username' = 'admin',
'role' = 'admin',
'created' = '2014-05-30 03:19:36',
'modified' = '2014-05-30 03:19:36'
),
'Tutorsession' = array(
(int) 0 = array(
'id' = '1',
'teacher_id' = '1',
'student_id' = '1',
'subject' = 'maths',
'sessiondate' = '2014-05-06',
'sessiontime' = '2014-05-29 00:27:00',
'available' = '1'
)
)
)
)

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: display data 3 tables

2014-06-05 Thread Jeremy Burns : Class Outfit
Isn't $tutor['Teacher']['User']['username'] what you're looking for?


On 5 Jun 2014, at 14:18, ajt jagguy...@gmail.com wrote:

 There just is no user being displayed with the below, there is with Teacher 
 in the find if I add it but every field is undefined in the view. 
 
   $this-Tutorsession-recursive = 2;
 
 $contain = array('Teacher' = array('User'));
 $this-set('tutor', $this-Tutorsession-find('first',array(
 'conditions' = array('Teacher.user_id' = $id),
 'contain' = $contain
 )));
 
 
 
 
 
 array(
   'Tutorsession' = array(
   'id' = '1',
   'teacher_id' = '1',
   'student_id' = '1',
   'subject' = 'maths',
   'sessiondate' = '2014-05-06',
   'sessiontime' = '2014-05-29 00:27:00',
   'available' = '1'
   ),
   'Teacher' = array(
   'id' = '1',
   'user_id' = '3',
   'firstname' = 'fred',
   'surname' = 'smith3',
   'address' = '1 hard str',
   'suburb' = 'chelsea2',
   'phone' = '0',
   'fullname' = 'fred smith3',
   'User' = array(
   'password' = '*',
   'id' = '3',
   'username' = 'teach',
   'role' = 'teacher',
   'created' = '2014-05-31 11:08:39',
   'modified' = '2014-05-31 11:08:39'
   ),
   'Tutorsession' = array(
   (int) 0 = array(
   'id' = '1',
   'teacher_id' = '1',
   'student_id' = '1',
   'subject' = 'maths',
   'sessiondate' = '2014-05-06',
   'sessiontime' = '2014-05-29 00:27:00',
   'available' = '1'
   )
   )
   ),
   'Student' = array(
   'id' = '1',
   'user_id' = '1',
   'firstname' = 'tom',
   'surname' = 'blog',
   'address' = '3 glen str ',
   'suburb' = 'chelsea',
   'phone' = '044',
   'fullname' = 'tom blog',
   'User' = array(
   'password' = '*',
   'id' = '1',
   'username' = 'admin',
   'role' = 'admin',
   'created' = '2014-05-30 03:19:36',
   'modified' = '2014-05-30 03:19:36'
   ),
   'Tutorsession' = array(
   (int) 0 = array(
   'id' = '1',
   'teacher_id' = '1',
   'student_id' = '1',
   'subject' = 'maths',
   'sessiondate' = '2014-05-06',
   'sessiontime' = '2014-05-29 00:27:00',
   'available' = '1'
   )
   )
   )
 )
 
 -- 
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP
 
 --- 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to cake-php+unsubscr...@googlegroups.com.
 To post to this group, send email to cake-php@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: display data 3 tables

2014-06-05 Thread ajt
yes thats it, I just didnt know how I referenced it and with this code.
This took hours to solve so well done

  $this-Tutorsession-recursive = 2;  
   $this-Tutorsession-Teacher-contain('User');
  $this-set('tutor',   $this-Tutorsession-find('first',
  array(
 'conditions' = array('Teacher.user_id' = $id)) ) );

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: display data 3 tables

2014-06-05 Thread Jeremy Burns : Class Outfit
With the Containable behaviour you should set recursive to -1. Recursion makes 
the model automatically attache related models n deep (where n is your 
recursion level) so can give unexpected (or at least uncontrolled) results. 
When it is -1 it only returns the model associations you specify. The 
Containable behaviour may well override that, but it's better to be safe than 
sorry.

On 5 Jun 2014, at 14:42, ajt jagguy...@gmail.com wrote:

 yes thats it, I just didnt know how I referenced it and with this code.
 This took hours to solve so well done
 
   $this-Tutorsession-recursive = 2;  
$this-Tutorsession-Teacher-contain('User');
   $this-set('tutor',   $this-Tutorsession-find('first',
   array(
  'conditions' = array('Teacher.user_id' = $id)) ) );
 
 -- 
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP
 
 --- 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to cake-php+unsubscr...@googlegroups.com.
 To post to this group, send email to cake-php@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: display data 3 tables

2014-06-05 Thread ajt
I set recursive to -1 and it doesnt work as I get user error again.
Recursive set to 2 is what works

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: display data 3 tables

2014-06-05 Thread ajt
Yes this works without recursive

 $contain = array('Teacher' = array('User'),'Student' = array('User'));
$this-set('tutor', $this-Tutorsession-find('first',array(
'conditions' = array('Teacher.user_id' = $id),
'contain' = $contain
)));

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: display data 3 tables

2014-06-05 Thread Jeremy Burns : Class Outfit
You are not doing something right. Can you show more code with the debugged 
output please? Cracking this and understanding what is happening will help you 
enormously with developing Cake apps from here.


On 5 Jun 2014, at 15:18, ajt jagguy...@gmail.com wrote:

 I set recursive to -1 and it doesnt work as I get user error again.
 Recursive set to 2 is what works
 
 -- 
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP
 
 --- 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to cake-php+unsubscr...@googlegroups.com.
 To post to this group, send email to cake-php@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


display data 3 tables

2014-06-04 Thread ajt
Hi,

I just want to display fields from 3 tables which I have checked on how to 
do this and I am not clear on this. Examples I have found concentrate on 2 
fields or keyed in conditions on multiple tables.
I have models all related in some way.
I want the username from a tutorsession table and the middle table is the 
teacher table.

Tutorsession - related to teacher
Teacher -related to tutorsession and teacher
User= related to teacher

The tutorsession automatically gets rows from teacher table but not user 
table. I have checked the docs below and I am not sure what to use here as 
the below doesnt work but I dont get errors.

  $this-set( 'tutor',$this-Tutorsession-find('all',array('conditions' = 
   array('Teacher.user_id' = $id,'Teacher.user_id' = 
'User.id';
   

  
  $this-set( 
'tutor',$this-Tutorsession-find('all',array('conditions' = 
array('Teacher.user_id' = $id;
   

http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html
http://book.cakephp.org/2.0/en/models/retrieving-your-data.html

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: display data 3 tables

2014-06-04 Thread Jeremy Burns : Class Outfit
Look at the Containable behaviour: 
http://book.cakephp.org/2.0/en/core-libraries/behaviors/containable.html

On 4 Jun 2014, at 14:47, ajt jagguy...@gmail.com wrote:

 Hi,
 
 I just want to display fields from 3 tables which I have checked on how to do 
 this and I am not clear on this. Examples I have found concentrate on 2 
 fields or keyed in conditions on multiple tables.
 I have models all related in some way.
 I want the username from a tutorsession table and the middle table is the 
 teacher table.
 
 Tutorsession - related to teacher
 Teacher -related to tutorsession and teacher
 User= related to teacher
 
 The tutorsession automatically gets rows from teacher table but not user 
 table. I have checked the docs below and I am not sure what to use here as 
 the below doesnt work but I dont get errors.
 
   $this-set( 'tutor',$this-Tutorsession-find('all',array('conditions' = 
array('Teacher.user_id' = $id,'Teacher.user_id' = 
 'User.id';

 
   
   $this-set( 'tutor',$this-Tutorsession-find('all',array('conditions' 
 = array('Teacher.user_id' = $id;

 
 http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html
 http://book.cakephp.org/2.0/en/models/retrieving-your-data.html
 
 -- 
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP
 
 --- 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to cake-php+unsubscr...@googlegroups.com.
 To post to this group, send email to cake-php@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: display data 3 tables

2014-06-04 Thread ajt
This doesnt work as I get an error when displaying the username from the 
associated table.
I guess i am doing something wrong still.

 $this-set('tutor',  $this-Tutorsession-find('all',
  array('conditions' = array('Teacher.user_id' = $id)
  ,array('contain' = 'User.username')
  )));

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: display data 3 tables

2014-06-04 Thread Jeremy Burns : Class Outfit
A couple of things...

Why find all when presumably there is only one expected teacher? The contain 
statement doesn't go inside an array:

$this-set(
'tutor',
$this-Tutorsession-find(
'first',
array(
'conditions' = array('Teacher.user_id' = $id),
'contain' = 'User.username'
)
)
);

On 4 Jun 2014, at 15:20, ajt jagguy...@gmail.com wrote:

 This doesnt work as I get an error when displaying the username from the 
 associated table.
 I guess i am doing something wrong still.
 
  $this-set('tutor',  $this-Tutorsession-find('all',
   array('conditions' = array('Teacher.user_id' = $id)
   ,array('contain' = 'User.username')
   )));
 
 -- 
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP
 
 --- 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to cake-php+unsubscr...@googlegroups.com.
 To post to this group, send email to cake-php@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: display data 3 tables

2014-06-04 Thread ajt
This still doesnt work as I get an error when I reference the user table 
which should be linked unless I need to do this another way?

view
 echo 'td'. $item['User']['username'].'/td'; ///error user undefined


$this-set(
'tutor',
$this-Tutorsession-find(
'first',
array(
'conditions' = array('Teacher.user_id' = $id),
'contain' = 'User.username'
)
)
);

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: display data 3 tables

2014-06-04 Thread Jeremy Burns : Class Outfit
You are referencing the $user variable when you have set a $tutor variable. Add 
this to your view so you can inspect the shape of the $tutor variable and work 
out how to access the key you are looking for:

die(debug($tutor));

It'll probably look something like this:

array(
'Tutorsession' = array(
'id' = 1,
'user_id' = 123,
'other_fields' = 'other_values',
'User' = array(
'id' = 123,
'username' = 'the_user_name'
)
)
)

If it does, you access the username with:

$tutor['Tutorsession']['User']['username']


On 4 Jun 2014, at 23:45, ajt jagguy...@gmail.com wrote:

 This still doesnt work as I get an error when I reference the user table 
 which should be linked unless I need to do this another way?
 
 view
  echo 'td'. $item['User']['username'].'/td'; ///error user undefined
 
 
 $this-set(
   'tutor',
   $this-Tutorsession-find(
   'first',
   array(
   'conditions' = array('Teacher.user_id' = $id),
   'contain' = 'User.username'
   )
   )
 );
 
 -- 
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP
 
 --- 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to cake-php+unsubscr...@googlegroups.com.
 To post to this group, send email to cake-php@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Best Practice to display data in layout or view

2012-08-11 Thread sanjeev
Hello,

What is the best practice to display data e.g. list of products, events, 
news in layout?

1. Element - which requires to call requestAction() and also calls 
beforeFilter from AppController each time
2. Helper - need to use Model class in helper

Regards,

-- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Best Practice to display data in layout or view

2012-08-11 Thread Tilen Majerle
i'm using second option. Model can be created with
ClassRegistry::init('ModelName'); to get model instance :)
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/8/11 sanjeev sanjeevdive...@gmail.com

 Hello,

 What is the best practice to display data e.g. list of products, events,
 news in layout?

 1. Element - which requires to call requestAction() and also calls
 beforeFilter from AppController each time
 2. Helper - need to use Model class in helper

 Regards,

 --
 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com.
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




-- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Best Practice to display data in layout or view

2012-08-11 Thread Mark Wratten
Option 2. is fine for simple stuff, i.e. grab a bunch of data from the 
database and render it, but if there is any complexity to the logic, then 
you end up loading your helpers with application logic, which in a pure MVC 
world belongs in a controller or component. So in that case, requestAction 
would be the purest approach but suffers the overhead of re-initializing 
the environment each time. Ideally, there would be some middle ground 
approach, which currently you have to roll yourself, by instantiating a new 
controller and calling the appropriate method yourself.

Mark

On Saturday, August 11, 2012 2:33:33 AM UTC-4, Sanjeev Divekar wrote:

 Hello,

 What is the best practice to display data e.g. list of products, events, 
 news in layout?

 1. Element - which requires to call requestAction() and also calls 
 beforeFilter from AppController each time
 2. Helper - need to use Model class in helper

 Regards,


-- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Display data from specific data in the Home Page

2010-12-26 Thread Ahmed - CakePHP

Hello Everybody,

As you know, I am a beginner in CakePHP.
I trying to do a blog, simple blog, just as a training in how to build
a websites using CakePHP.

I created few Controllers, such as (users, posts, comments and
categories).
Also I designed the Home Page, which is empty now.

I want to know:
How can I display data from the Tables in the database in the Home
Page.

For example:
- I want to display the latest posts.
also, may be, the latest registered users
or whatever


Can you please tell me how CakePHP deals with this.



Thank you in Advance,
Ahmed

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Display data from specific data in the Home Page

2010-12-26 Thread Amit Badkas
Hi,

Please follow http://book.cakephp.org/view/1528/Blog to build a basic blog
application in CakePHP so that you will get familiar with CakePHP working.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Sun, Dec 26, 2010 at 7:38 PM, Ahmed - CakePHP ahmed.amo...@gmail.comwrote:


 Hello Everybody,

 As you know, I am a beginner in CakePHP.
 I trying to do a blog, simple blog, just as a training in how to build
 a websites using CakePHP.

 I created few Controllers, such as (users, posts, comments and
 categories).
 Also I designed the Home Page, which is empty now.

 I want to know:
 How can I display data from the Tables in the database in the Home
 Page.

 For example:
 - I want to display the latest posts.
 also, may be, the latest registered users
 or whatever


 Can you please tell me how CakePHP deals with this.



 Thank you in Advance,
 Ahmed

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Display data from specific data in the Home Page

2010-12-26 Thread Stefano Salvatori
Hi

In one controller add some like that

$uses = array('Post','User');

function myfunction() {

$this-set('users',$this-User-find('all'));
$this-set('users',$this-Post-find('all'));
}

then in router.php

Router::connect('/', array('controller' = 'yourcontroller', 'action'
= 'myfunction'));



On Mon, Dec 27, 2010 at 12:52 AM, Amit Badkas amit.sanis...@gmail.com wrote:
 Hi,
 Please follow http://book.cakephp.org/view/1528/Blog to build a basic blog
 application in CakePHP so that you will get familiar with CakePHP working.
 Amit Badkas
 PHP Applications for E-Biz: http://www.sanisoft.com


 On Sun, Dec 26, 2010 at 7:38 PM, Ahmed - CakePHP ahmed.amo...@gmail.com
 wrote:

 Hello Everybody,

 As you know, I am a beginner in CakePHP.
 I trying to do a blog, simple blog, just as a training in how to build
 a websites using CakePHP.

 I created few Controllers, such as (users, posts, comments and
 categories).
 Also I designed the Home Page, which is empty now.

 I want to know:
 How can I display data from the Tables in the database in the Home
 Page.

 For example:
 - I want to display the latest posts.
 also, may be, the latest registered users
 or whatever


 Can you please tell me how CakePHP deals with this.



 Thank you in Advance,
 Ahmed

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en




-- 
Stefano Salvatori M.
http://stefano.salvatori.cl/

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Ways to display data from another controller without resorting to requestAction?

2008-11-18 Thread David C. Zentgraf

http://book.cakephp.org/view/63/Introduction

On 18 Nov 2008, at 16:55, Pizgin wrote:


 David tell me please more detail. Thanks.

 On 18 нояб, 10:31, David C. Zentgraf [EMAIL PROTECTED] wrote:
 How about making a reusable component?

 On 18 Nov 2008, at 16:22, Pizgin wrote:





 Hi! What else there are ways to display data from another controller
 instead of using requestAction? Thanks.
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



AW: Ways to display data from another controller without resorting to requestAction?

2008-11-18 Thread Liebermann, Anja Carolin

This is very useful:
http://mark-story.com/posts/view/reducing-requestaction-use-in-your-cakephp-sites-with-fat-models?utm_source=rss

Anja

-Ursprüngliche Nachricht-
Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von David 
C. Zentgraf
Gesendet: Dienstag, 18. November 2008 09:18
An: cake-php@googlegroups.com
Betreff: Re: Ways to display data from another controller without resorting to 
requestAction?


http://book.cakephp.org/view/63/Introduction

On 18 Nov 2008, at 16:55, Pizgin wrote:


 David tell me please more detail. Thanks.

 On 18 нояб, 10:31, David C. Zentgraf [EMAIL PROTECTED] wrote:
 How about making a reusable component?

 On 18 Nov 2008, at 16:22, Pizgin wrote:





 Hi! What else there are ways to display data from another controller 
 instead of using requestAction? Thanks.
 




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Ways to display data from another controller without resorting to requestAction?

2008-11-17 Thread Pizgin

Hi! What else there are ways to display data from another controller
instead of using requestAction? Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Ways to display data from another controller without resorting to requestAction?

2008-11-17 Thread David C. Zentgraf

How about making a reusable component?

On 18 Nov 2008, at 16:22, Pizgin wrote:


 Hi! What else there are ways to display data from another controller
 instead of using requestAction? Thanks.
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Ways to display data from another controller without resorting to requestAction?

2008-11-17 Thread Pizgin

David tell me please more detail. Thanks.

On 18 нояб, 10:31, David C. Zentgraf [EMAIL PROTECTED] wrote:
 How about making a reusable component?

 On 18 Nov 2008, at 16:22, Pizgin wrote:





  Hi! What else there are ways to display data from another controller
  instead of using requestAction? Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Display data from two related tables on one page

2007-09-18 Thread fr3nch13

http://manual.cakephp.org


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Display data from two related tables on one page

2007-09-18 Thread Indian Baker

Hi,
This may be a very simple one, but I'm stumped.
What I need to do is Say I have the same blog example.. what I want is

when I'm viewing a user's page like   localhost/blog/users/view/3/
I see the user details, like name, username password etc etc.
What I want is below that I should also get to see a list of all his
postings

How do I get around doing that or is there a tutorial which I can
refer.

Any code snippets or pointers would be greatly appreciated
Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Display data from two related tables on one page

2007-09-18 Thread Dr. Tarique Sani

On 9/18/07, Indian Baker [EMAIL PROTECTED] wrote:
 when I'm viewing a user's page like   localhost/blog/users/view/3/
 I see the user details, like name, username password etc etc.
 What I want is below that I should also get to see a list of all his
 postings

You need to set up an association User hasMany Post

Beyond that you need to read the manual :)

HTH and cheers

T

-- 
=
Cheesecake-Photoblog: http://cheesecake-photoblog.org
PHP for E-Biz: http://sanisoft.com
=

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



display data

2007-08-14 Thread Wimg

i have problem with display data, for example , i have a database like
this

a  b  c
1  2  3
1  3  4

i wanna display result of select a, c where b = 2  in a table.
how would my controller and view looks like ?

i am a new at cakephp
thx a lot!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: display data

2007-08-14 Thread starkey

I suggest you follow the excellent Blog tutorial in the manual.  It
will help you out a lot (it did for me!).

Shawn

On Aug 14, 5:40 am, Wimg [EMAIL PROTECTED] wrote:
 i have problem with display data, for example , i have a database like
 this

 a  b  c
 1  2  3
 1  3  4

 i wanna display result of select a, c where b = 2  in a table.
 how would my controller and view looks like ?

 i am a new at cakephp
 thx a lot!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: display data

2007-08-14 Thread Wimg

thx man,,

On Aug 14, 9:37 pm, starkey [EMAIL PROTECTED] wrote:
 I suggest you follow the excellent Blog tutorial in the manual.  It
 will help you out a lot (it did for me!).

 Shawn

 On Aug 14, 5:40 am, Wimg [EMAIL PROTECTED] wrote:



  i have problem with display data, for example , i have a database like
  this

  a  b  c
  1  2  3
  1  3  4

  i wanna display result of select a, c where b = 2  in a table.
  how would my controller and view looks like ?

  i am a new at cakephp
  thx a lot!- Hide quoted text -

 - Show quoted text -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---