Re: How can I build a navigation menu in cakephp?
On Fri, Sep 25, 2009 at 12:34 AM, Barney zhangping...@gmail.com wrote: thanks, what's caching result? can you give me more tips please The server stores a version of the result so that, on subsequent requests, it need not request the data from the DB, filter it, turn it into a view (the HTML). Although there are several different types of caching with Cake, including caching queries or caching the entire view. Also, there are different types caching engines one can use. The config is in app/config/core.php. The most basic is file, which stores the cache as files (big surprise). MemCache uses, as the name suggests, the server's memory. That's the one i prefer but it involves installation on the server. If you do not control your own server, this option is likely not available. But it couldn't hurt to ask you hosting company if it is. APC may also be available. Anyway, the basic idea would be to check the cache in your action and, if available, return that. Otherwise, do a find() as normal and write the result to the cache. http://book.cakephp.org/view/764/Cache http://teknoid.wordpress.com/2009/06/17/send-your-database-on-vacation-by-using-cakephp-memcached/ --~--~-~--~~~---~--~~ 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 can I build a navigation menu in cakephp?
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?
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 -~--~~~~--~~--~--~---