Re: Dynamic Elements
You might want to think about 'baking' your element instead, if it doesn't change too regularly: http://wiki.cakephp.org/tutorials:dynamic-menu This ought to take the load off your db server. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Dynamic Elements
Hi All! Can anyone help me with following question? Let's (for example) I have blog application. And I have some posts categories. I'd like to have an element, that shows on every page my categories list. How can I do this? Elements don't have access to controllers. I don't want to include Categories model in every controller that I have in application. I want to do it from template... Is it possible? Best Regards --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Dynamic Elements
requestAction maybe? if i understand correctly, you would like to display you list of categories on every page yes? within your element you could call: $this-requestAction('categories/list'); There was some discussion a while back as to the overhead of too many of these calls. Was an interesting one, looked at using this method against including models in other controllers where necessary. both have uses. do a quick search on requestaction and there are some interesting posts. HTH mikee On 31/10/06, GL [EMAIL PROTECTED] wrote: Hi All! Can anyone help me with following question? Let's (for example) I have blog application. And I have some posts categories. I'd like to have an element, that shows on every page my categories list. How can I do this? Elements don't have access to controllers. I don't want to include Categories model in every controller that I have in application. I want to do it from template... Is it possible? Best Regards --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Dynamic Elements
As far as I understand I can't use requestAction inside element. I solved it by calling ?= $this-renderElement('catmenu', array('categories'=$this-requestAction('/categories/getlist'))); ? from my layout template. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---