How can I build a navigation menu in cakephp?

2009-09-24 Thread Barney

first, I am very new to cakephp.

I have 2 tables categories and products

I want to make a menu like category-product tree

in the view,  i use those code to display the categories:

ul
?php foreach($categories as $category): ?
li
?php echo $category['Category']['name']; ?
/li

?php endforeach; ?
/ul

But if I want to add links to these categories

how can I use $html-link to achieve it?


$html-link('$category['Category']['name']',array
('controller'='Products','action'='view', $category['Products']
['id']));


but this line code goes error,

I know $html-link first parameter should be a string value, how can I
assign a variable ?


please help,thank you
--~--~-~--~~~---~--~~
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: How can I build a navigation menu in cakephp?

2009-09-24 Thread Barney

thanks, what's caching result? can you give me more tips please



On Sep 24, 8:33 pm, brian bally.z...@gmail.com wrote:
 Remove the single quotes. $category['Category']['name'] is already a
 string so you don't need them. What you'd done is passed the literal
 string, '$category['Category']['name']'.

 As for creating a menu, once you have something working, you might
 want to look at caching the result so you're not hitting the database
 on every page view.



 On Thu, Sep 24, 2009 at 10:20 PM, Barney zhangping...@gmail.com wrote:

  first, I am very new to cakephp.

  I have 2 tables categories and products

  I want to make a menu like category-product tree

  in the view,  i use those code to display the categories:

  ul
  ?php foreach($categories as $category): ?
  li
  ?php echo $category['Category']['name']; ?
  /li

  ?php endforeach; ?
  /ul

  But if I want to add links to these categories

  how can I use $html-link to achieve it?

  $html-link('$category['Category']['name']',array
  ('controller'='Products','action'='view', $category['Products']
  ['id']));

  but this line code goes error,

  I know $html-link first parameter should be a string value, how can I
  assign a variable ?

  please help,thank you
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



how to create a simple website with cakephp?

2009-09-17 Thread Barney

All I know , cakephp can make a blog or forum very quick, but how can
we create a simple website

with navigation menu, just like we did with regular html with
css,please

give some tutorial or ariticles,thanks you
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



how to bake the cake in windows ?

2009-09-16 Thread Barney

all I found is under command line,how to bake the views in windows?

I googled, it said you can install cygwin or minwin,

but i don't know how to use it.


I am running xampp localhost server on windows,

please help,thanks  a lot

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---