you can define a protected variable $showMenu = true in AppController, and for those controllers who don't need menu, set this vairable to false
and in beforeRender method check this variable to output or not. On Mon, Dec 12, 2011 at 7:08 PM, MetZ <[email protected]> wrote: > ;) > > That was what I thought about helpers yes.. > > Helper => will be used to generate the menu > > You would suggest to pull the menu + links fra database in > app_controller beforerender, might work fine not using component for > this. > > As I do not need to get the menues on every page, how would you > suggest to only use the menu database retrival when needed? > > using if this params controller= controller ? or something like that? > or do you know of a better way ? > > Thanks for all help and suggestions this far! > > -Tom > > > On 12 Des, 07:17, Perry <[email protected]> wrote: > > helpers should not get data directly, and I remember cakephp doesn't > > suggest get data in components neither( i cant' find the refer), why not > > get menu data in AppController's beforeRender method? > > > > > > > > > > > > > > > > > > > > On Sun, Dec 11, 2011 at 8:16 PM, MetZ <[email protected]> wrote: > > > > > Hi. > > > > > I am storing my menues and links(tree behavior) in database. I am > > > using several themes for the system, and hardcoding menues manuallly > > > foreach theme is not an option. > > > > > I have no problem outputting the menues and links with a component and > > > helper in my themes, but i am simply wodering about the best practice > > > to do this? > > > > > Example, get menues and links from db in component, generate menu > > > output with helper. > > > > > Or should i do all this in the helper? > > > > > Thanks! > > > > > tom > > > > > On Dec 8, 11:42 pm, Perry <[email protected]> wrote: > > > > why consider components and helpers? > > > > > > do you store your menu structures in database? why not just treat it > as a > > > > data and output it directly in layout? > > > > > > On Fri, Dec 9, 2011 at 9:31 AM, MetZ <[email protected]> wrote: > > > > > Hi all! > > > > > > > I am looking for a couple of suggestions. > > > > > > > I am currently working on a tree menu part of my app, where > > > > > administrators can create menues, add links to the menues and move > the > > > > > links up and down in the tree. > > > > > > > Now, I am looking how to output this menu with links on the > frontend. > > > > > > > Any suggestions on how I should proceed in this? > > > > > > > Currently, I am getting my menues and links in a component, I am > > > > > initializing the "getmenues" function in component from > > > > > app_controller.php. > > > > > > > And in my views, I call a helper to build the menu ul li li /ul > > > > > > > Do I need to use a component for this task? Or can I just include > > > > > everything in the helper? the database calls I mean? > > > > > > > I have noe experience with helpers and components from before, so > > > > > please be gentle with me ;) > > > > > > > Thanks for any and all help on this issue!! > > > > > > > BTW: Cake 1.3.13 > > > > > > > -Tom > > > > > > > -- > > > > > Our newest site for the community: CakePHP Video Tutorials > > > > >http://tv.cakephp.org > > > > > Check out the new CakePHP Questions > sitehttp://ask.cakephp.organdhelp > > > > > others with their CakePHP related questions. > > > > > > > To unsubscribe from this group, send email to > > > > > [email protected] For more options, visit this > > > group > > > > > athttp://groups.google.com/group/cake-php > > > > > > -- > > > > Perry | 彭琪http://pengqi.me > > > > > -- > > > Our newest site for the community: CakePHP Video Tutorials > > >http://tv.cakephp.org > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > > others with their CakePHP related questions. > > > > > To unsubscribe from this group, send email to > > > [email protected] For more options, visit this > group > > > athttp://groups.google.com/group/cake-php > > > > -- > > Perry | 彭琪http://pengqi.me > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > [email protected] For more options, visit this group > at http://groups.google.com/group/cake-php > -- Perry | 彭琪 http://pengqi.me -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
