Re: Dynamic menu content in layout

2014-03-06 Thread Art Sir
nice!! i was looking for this information as well.

On Wednesday, February 26, 2014 4:58:21 PM UTC-5, euromark wrote:
>
> Take a look at the ideas here:
> https://github.com/MenschDankeGmbH/cake-menu_builder
> Maybe that helps.
>
>
> Am Samstag, 22. Februar 2014 11:46:16 UTC+1 schrieb Sam Clauw:
>>
>> What I'm trying to do is to put two dynamic navigation menus in my 
>> CakePHP layout (default.ctp). The main menu should have multiple levels 
>> (with a dropdown functionality). The secondary menu is the one that shows 
>> the dropdown content of the main menu in a left sidebar.
>>
>> I've read the CakePHP documentation but I'm confused how to fit those 
>> menus in the layout. I know that you have 4 different parts in a view layer 
>> (as documented in http://book.cakephp.org/2.0/en/views.html):
>>
>>- views
>>- elements
>>- layouts
>>- helpers
>>
>> But with the knowledge I have right now, I think none of this parts can 
>> be used to fill my needs. A navigation menu is a part that you only load 
>> ONES in a layout, so it isn't an element or a helper. So what's the best 
>> practice...
>>
>>- ... where to create the menu tree?
>>- ... where / how to echo it in the layout file?
>>
>> Can anybody clearify my issue? Thanks in advance! ;)
>>
>

-- 
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/groups/opt_out.


Re: Dynamic menu content in layout

2014-02-28 Thread Dr. Tarique Sani
What you are really wanting is the ViewModel. CakePHP does not implement
that explicitly but you can get the same functionality by creating a helper
and accessing your model in the helper keeping the view clean.

HTH

Tarique



On Thu, Feb 27, 2014 at 1:09 AM, Sam Clauw  wrote:

> Okay, let's suppose I want to put my menu in an element called
> "top_menu.ctp". I want to get my data out of the database, so probably, I
> shouldn't connect with my
>




-- 
=
The Conference Schedule Creator : http://shdlr.com

PHP for E-Biz : http://sanisoft.com
=

-- 
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/groups/opt_out.


Re: Dynamic menu content in layout

2014-02-26 Thread euromark
Take a look at the ideas here:
https://github.com/MenschDankeGmbH/cake-menu_builder
Maybe that helps.


Am Samstag, 22. Februar 2014 11:46:16 UTC+1 schrieb Sam Clauw:
>
> What I'm trying to do is to put two dynamic navigation menus in my CakePHP 
> layout (default.ctp). The main menu should have multiple levels (with a 
> dropdown functionality). The secondary menu is the one that shows the 
> dropdown content of the main menu in a left sidebar.
>
> I've read the CakePHP documentation but I'm confused how to fit those 
> menus in the layout. I know that you have 4 different parts in a view layer 
> (as documented in http://book.cakephp.org/2.0/en/views.html):
>
>- views
>- elements
>- layouts
>- helpers
>
> But with the knowledge I have right now, I think none of this parts can be 
> used to fill my needs. A navigation menu is a part that you only load ONES 
> in a layout, so it isn't an element or a helper. So what's the best 
> practice...
>
>- ... where to create the menu tree?
>- ... where / how to echo it in the layout file?
>
> Can anybody clearify my issue? Thanks in advance! ;)
>

-- 
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/groups/opt_out.


Re: Dynamic menu content in layout

2014-02-26 Thread Thomas von Hassel
No, you don't want to anything in the view that involves querying the database. 
The controller action for that given page should know what menu to fetch from 
database and set that to the view.


/thomas


On 26 Feb 2014, at 20:39, Sam Clauw  wrote:

> Okay, let's suppose I want to put my menu in an element called 
> "top_menu.ctp". I want to get my data out of the database, so probably, I 
> shouldn't connect with my database in that .ctp file. I wonder if that's the 
> right way to do so? MVC normally split us the model logic and the view logic, 
> but now you'll all get it in one file? Or am I missing something? ;)

-- 
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/groups/opt_out.


Re: Dynamic menu content in layout

2014-02-26 Thread Sam Clauw
Okay, let's suppose I want to put my menu in an element called 
"top_menu.ctp". I want to get my data out of the database, so probably, I 
shouldn't connect with my database in that .ctp file. I wonder if that's 
the right way to do so? MVC normally split us the model logic and the view 
logic, but now you'll all get it in one file? Or am I missing something? ;)

-- 
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/groups/opt_out.


Re: Dynamic menu content in layout

2014-02-22 Thread Salines
hi, 
You can put the tree menu directly in the layout or in a separate menu 
elements and include them in a specific place on your layout. 

If you want to highlight active link in your menu, you can do the 
following: 

// menu

..link to 
contacts views
..link to 
contacts views
...

// in Posts/index.ctp
// in Posts/view.ctp
..
$this->set('active','posts');

If you want to dynamically add or modify the sidebar, use and expand the 
view blocks
http://book.cakephp.org/2.0/en/views.html#extending-views

-- 
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/groups/opt_out.


Dynamic menu content in layout

2014-02-22 Thread Sam Clauw


What I'm trying to do is to put two dynamic navigation menus in my CakePHP 
layout (default.ctp). The main menu should have multiple levels (with a 
dropdown functionality). The secondary menu is the one that shows the 
dropdown content of the main menu in a left sidebar.

I've read the CakePHP documentation but I'm confused how to fit those menus 
in the layout. I know that you have 4 different parts in a view layer (as 
documented in http://book.cakephp.org/2.0/en/views.html):

   - views
   - elements
   - layouts
   - helpers

But with the knowledge I have right now, I think none of this parts can be 
used to fill my needs. A navigation menu is a part that you only load ONES 
in a layout, so it isn't an element or a helper. So what's the best 
practice...

   - ... where to create the menu tree?
   - ... where / how to echo it in the layout file?

Can anybody clearify my issue? Thanks in advance! ;)

-- 
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/groups/opt_out.


Re: Best practice output a Dynamic menu

2011-12-12 Thread Perry
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  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  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  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  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  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
> > > > > cake-php+unsubscr...@googlegroups.com 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
> > > cake-php+unsubscr...@googlegroups.com 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
> cake-php+unsubscr...@googlegroups.com 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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice output a Dynamic menu

2011-12-12 Thread euromark
such components may get their data automatically
that's what some are for, after all :)

even a helper may use data passed down form the controller/component
automatically.
at least in 2.0 - with $_View being officially available now.



On 12 Dez., 12:08, MetZ  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  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  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  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  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
> > > > > cake-php+unsubscr...@googlegroups.com 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.organdhelp
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com 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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice output a Dynamic menu

2011-12-12 Thread MetZ
;)

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  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  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  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  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
> > > > cake-php+unsubscr...@googlegroups.com 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
> > cake-php+unsubscr...@googlegroups.com 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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice output a Dynamic menu

2011-12-11 Thread Perry
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  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  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  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.organd help
> > > others with their CakePHP related questions.
> >
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com 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
> cake-php+unsubscr...@googlegroups.com 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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice output a Dynamic menu

2011-12-11 Thread MetZ

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  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  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.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com 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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best practice output a Dynamic menu

2011-12-08 Thread Perry
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  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 site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>



-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Best practice output a Dynamic menu

2011-12-08 Thread MetZ
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 site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Dynamic menu based on deep relationships

2010-09-18 Thread meekamoo
Ah thanks for your help, I managed to sort it out.

Got it working quite nicely with ajax menu on the sidenav.

/countries/view/204 is the main screen showing the provinces for the
country (only one country now, so countries arent really used)
/provinces/view/xxx views the regions belonging to the province

the ajax menu calls /(currentaction)/ajaxmenu/(currentvalue) so even
if a user goes directly to a region/suburb etc then the ajax menu will
start where it should.

Thanks for your help though, managed to get it sorted after a stroke
of genius!

On Aug 30, 6:53 am, Sam  wrote:
> I think I know what you want but I'm not sure... let me know if I'm
> close.
>
> I'd do it one of two ways
>
> 1) User selects a province, page refreshes and now there are two
> dropdown boxes, first one has province selected, in the second user
> chooses region(and so forth)
> 2) User selects a province, select box appears with regions in that
> province(and so on and so forth)
>
> For method 1 I'd have the javascript submit the page each time a
> dropdown is changed- then the controller can figure out which menu
> items to load for the next select box. If several select boxes have
> been chosen, such as province, region and suburb, and province is
> changed, then the form would basically reset to only show the province
> and region select boxes.
>
> For method 2 I'd either use ajax to query the database based on the
> change in any of the select boxes, and reload the values in the select
> boxes. When the last select is chosen it loads the proper view.
>
> As for the menu knowing where the user is, simply set the relevant
> fields(province_id, region_id, suburb_id and establishment_id) based
> on the data that is loaded... if you load a suburb it should be
> relatively easy to get the region_id and province_id for that suburb.
>
> On Aug 29, 10:59 am, Bryan Paddock  wrote:
>
>
>
> > Hey all,
>
> > I've looked through pretty much every menu tutorial out there for cakephp
> > and have sat for ages to try and think up how I can achieve this but to no
> > avail.
>
> > I have a semi-complex database structure of establishments (restaurants,
> > hotels etc).
>
> > Province -> Region -> Suburb -> Establishment
>
> > as well as
>
> > Category -> Subcategory -> Establishment
>
> > Now the user needs to be able to select the province from the list, have it
> > show the regions under that province, then the suburbs, then a list of
> > subcategories under that province that contain establishments. I can handle
> > the fetching the data (eg how to pull out the list using containable etc)
> > but it's the starting foundation I'm having problems figuring out. IT will
> > be done in ajax but the actual ajax part I could probably do myself.
>
> > I would like to have the menu also build itself from the page that the user
> > is on (eg the user can browse around the menu in itself but if he also goes
> > to the a related page (eg suburbs/view/cape-town) then the menu should know
> > where the user is)
>
> > I honestly can't think of even where I should start here. Building a menu is
> > simple in plain php with simple relationships but it's getting pretty tricky
> > with all the extra levels.
>
> > Does anyone have any advice on a starting point which I could work with...
> > I'm trying to make it extendable in the sense that I don't want to hard code
> > anything.
>
> > I'm starting to think it may be better off to handle the menu separately in
> > a menu model and update the menu on each of the related models afterSave(),
> > etc callback but that seems a bit unnecessary as it would just be duplicated
> > data.
>
> > Thanks in advance!
>
> > Bryan

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: Dynamic menu based on deep relationships

2010-08-29 Thread Sam
I think I know what you want but I'm not sure... let me know if I'm
close.

I'd do it one of two ways

1) User selects a province, page refreshes and now there are two
dropdown boxes, first one has province selected, in the second user
chooses region(and so forth)
2) User selects a province, select box appears with regions in that
province(and so on and so forth)

For method 1 I'd have the javascript submit the page each time a
dropdown is changed- then the controller can figure out which menu
items to load for the next select box. If several select boxes have
been chosen, such as province, region and suburb, and province is
changed, then the form would basically reset to only show the province
and region select boxes.

For method 2 I'd either use ajax to query the database based on the
change in any of the select boxes, and reload the values in the select
boxes. When the last select is chosen it loads the proper view.

As for the menu knowing where the user is, simply set the relevant
fields(province_id, region_id, suburb_id and establishment_id) based
on the data that is loaded... if you load a suburb it should be
relatively easy to get the region_id and province_id for that suburb.

On Aug 29, 10:59 am, Bryan Paddock  wrote:
> Hey all,
>
> I've looked through pretty much every menu tutorial out there for cakephp
> and have sat for ages to try and think up how I can achieve this but to no
> avail.
>
> I have a semi-complex database structure of establishments (restaurants,
> hotels etc).
>
> Province -> Region -> Suburb -> Establishment
>
> as well as
>
> Category -> Subcategory -> Establishment
>
> Now the user needs to be able to select the province from the list, have it
> show the regions under that province, then the suburbs, then a list of
> subcategories under that province that contain establishments. I can handle
> the fetching the data (eg how to pull out the list using containable etc)
> but it's the starting foundation I'm having problems figuring out. IT will
> be done in ajax but the actual ajax part I could probably do myself.
>
> I would like to have the menu also build itself from the page that the user
> is on (eg the user can browse around the menu in itself but if he also goes
> to the a related page (eg suburbs/view/cape-town) then the menu should know
> where the user is)
>
> I honestly can't think of even where I should start here. Building a menu is
> simple in plain php with simple relationships but it's getting pretty tricky
> with all the extra levels.
>
> Does anyone have any advice on a starting point which I could work with...
> I'm trying to make it extendable in the sense that I don't want to hard code
> anything.
>
> I'm starting to think it may be better off to handle the menu separately in
> a menu model and update the menu on each of the related models afterSave(),
> etc callback but that seems a bit unnecessary as it would just be duplicated
> data.
>
> Thanks in advance!
>
> Bryan

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


Dynamic menu based on deep relationships

2010-08-29 Thread Bryan Paddock
Hey all,

I've looked through pretty much every menu tutorial out there for cakephp
and have sat for ages to try and think up how I can achieve this but to no
avail.

I have a semi-complex database structure of establishments (restaurants,
hotels etc).

Province -> Region -> Suburb -> Establishment

as well as

Category -> Subcategory -> Establishment

Now the user needs to be able to select the province from the list, have it
show the regions under that province, then the suburbs, then a list of
subcategories under that province that contain establishments. I can handle
the fetching the data (eg how to pull out the list using containable etc)
but it's the starting foundation I'm having problems figuring out. IT will
be done in ajax but the actual ajax part I could probably do myself.

I would like to have the menu also build itself from the page that the user
is on (eg the user can browse around the menu in itself but if he also goes
to the a related page (eg suburbs/view/cape-town) then the menu should know
where the user is)

I honestly can't think of even where I should start here. Building a menu is
simple in plain php with simple relationships but it's getting pretty tricky
with all the extra levels.

Does anyone have any advice on a starting point which I could work with...
I'm trying to make it extendable in the sense that I don't want to hard code
anything.

I'm starting to think it may be better off to handle the menu separately in
a menu model and update the menu on each of the related models afterSave(),
etc callback but that seems a bit unnecessary as it would just be duplicated
data.

Thanks in advance!

Bryan

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: Dynamic Menu

2010-08-24 Thread _k10_
Not sure if this answers your query but have a look @
http://book.cakephp.org/view/1023/find-threaded


On Aug 23, 10:29 pm, nightshadex101  wrote:
> Hi All,
>
> I'm trying to build a menu system.
> I've already created a table in the database, a model (with tree
> behavior), and a controller.
>
> The idea is that the menu has 2 levels (it will probably get 3 levels
> later), and the following is showed:
>
> -All parent of 1st level pages (controllers)
> If I'm on a parent page (ie: a controller)
>     -All my children/2nd level pages (funcions in that controller)
> If I'm on a 2nd level page
>     -All the other children of my parent (all the other functions in
> that controller)
>
> What I'm not getting is how to call this function from an element (to
> later insert in the layout) so that I can pass the current page to the
> controller function.
>
> This is the db table:
>
> CREATE TABLE IF NOT EXISTS `menus` (
>   `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
>   `parent_id` int(10) DEFAULT NULL,
>   `lft` int(11) DEFAULT NULL,
>   `rght` int(11) DEFAULT NULL,
>   `name` varchar(255) COLLATE latin1_general_cs DEFAULT '',
>   `location` varchar(255) COLLATE latin1_general_cs DEFAULT '',
>   `status` tinyint(1) NOT NULL,
>   `created` datetime DEFAULT NULL,
>   `modified` datetime DEFAULT NULL,
>   PRIMARY KEY (`id`)
>
> Model:
>
>  class Menu extends AppModel {
>         var $name = 'Menu';
>         var $actsAs = array('Tree');}
>
> ?>
>
> Controller:
>
>  class MenusController extends AppController {
>
>         var $name = 'Menus';
>
>         function getMenu($location = null) {
>                 if(substr($location,-1,1) == '/')
>                         $location = substr($location,0,strlen($location)-1);
>                 $locationId = $this->Menu->field('id', array('location' =>
> $location));
>                 $allParents = $this->Menu->find('all', array(
>                         'fields'         => array('Menu.id', 'Menu.name', 
> 'Menu.location'),
>                         'conditions' => array('Menu.parent_id' => null, 
> 'Menu.status'      =>
> 1)
>                 ));
>                 $myParent = $this->Menu->getparentnode($locationId);
>
>                 if ($myParent) {
>                         $secondLevel = 
> $this->Menu->children($myParent['Menu']['id'],
> true);
>                 } else {
>                         $secondLevel = $this->Menu->children($locationId, 
> true);
>                 }
>
>                 $secondLevelFiltered = array();
>                 $i = 0;
>                 foreach ($secondLevel as $children) {
>                         if ($children['Menu']['status'] == 1) {
>                                 $secondLevelFiltered[$i]['id'] = 
> $children['Menu']['id'];
>                                 $secondLevelFiltered[$i]['name'] = 
> $children['Menu']['name'];
>                                 $secondLevelFiltered[$i]['location'] = 
> $children['Menu']
> ['location'];
>                                 $i++;
>                         }
>                 }
>
>                 $menuTree = array();
>                 $i = 0;
>                 foreach ($allParents as $parent) {
>                         $menuTree[$i] = $parent['Menu'];
>                         if ($myParent) {
>                                 if ($myParent['Menu']['id'] == 
> $parent['Menu']['id']) {
>                                         $menuTree[$i]['children'] = 
> $secondLevelFiltered;
>                                 }
>                         } else {
>                                 if($locationId == $parent['Menu']['id']) {
>                                         $menuTree[$i]['children'] = 
> $secondLevelFiltered;
>                                 }
>                         }
>                         $i++;
>                 }
>                 return($menuTree);
>         }}
>
> ?>
>
> Could someone give me some orientation on how to procede from here?

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


Dynamic Menu

2010-08-23 Thread nightshadex101
Hi All,

I'm trying to build a menu system.
I've already created a table in the database, a model (with tree
behavior), and a controller.

The idea is that the menu has 2 levels (it will probably get 3 levels
later), and the following is showed:

-All parent of 1st level pages (controllers)
If I'm on a parent page (ie: a controller)
-All my children/2nd level pages (funcions in that controller)
If I'm on a 2nd level page
-All the other children of my parent (all the other functions in
that controller)

What I'm not getting is how to call this function from an element (to
later insert in the layout) so that I can pass the current page to the
controller function.

This is the db table:

CREATE TABLE IF NOT EXISTS `menus` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `parent_id` int(10) DEFAULT NULL,
  `lft` int(11) DEFAULT NULL,
  `rght` int(11) DEFAULT NULL,
  `name` varchar(255) COLLATE latin1_general_cs DEFAULT '',
  `location` varchar(255) COLLATE latin1_general_cs DEFAULT '',
  `status` tinyint(1) NOT NULL,
  `created` datetime DEFAULT NULL,
  `modified` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)

Model:




Controller:

Menu->field('id', array('location' =>
$location));
$allParents = $this->Menu->find('all', array(
'fields' => array('Menu.id', 'Menu.name', 
'Menu.location'),
'conditions' => array('Menu.parent_id' => null, 
'Menu.status'=>
1)
));
$myParent = $this->Menu->getparentnode($locationId);

if ($myParent) {
$secondLevel = 
$this->Menu->children($myParent['Menu']['id'],
true);
} else {
$secondLevel = $this->Menu->children($locationId, true);
}

$secondLevelFiltered = array();
$i = 0;
foreach ($secondLevel as $children) {
if ($children['Menu']['status'] == 1) {
$secondLevelFiltered[$i]['id'] = 
$children['Menu']['id'];
$secondLevelFiltered[$i]['name'] = 
$children['Menu']['name'];
$secondLevelFiltered[$i]['location'] = 
$children['Menu']
['location'];
$i++;
}
}

$menuTree = array();
$i = 0;
foreach ($allParents as $parent) {
$menuTree[$i] = $parent['Menu'];
if ($myParent) {
if ($myParent['Menu']['id'] == 
$parent['Menu']['id']) {
$menuTree[$i]['children'] = 
$secondLevelFiltered;
}
} else {
if($locationId == $parent['Menu']['id']) {
$menuTree[$i]['children'] = 
$secondLevelFiltered;
}
}
$i++;
}
return($menuTree);
}
}
?>

Could someone give me some orientation on how to procede from here?

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


Dynamic menu with AJAX (CakePHP 1.2)

2010-03-06 Thread Arndtinho
Hello,

I created an dynamic drop down menu with prototype and scriptaculous.
It's working fine but there is a little problem. If an topcategory
doesn't have an subcategory (subcategories) the topcategory-link has
to link to an /controller/action and I don't need an -Element.

Topcategory with subcategories:

Topitem

Subitem 1 (-> link to /controller/action/subitem1_id)
Subitem 2 (-> link to /controller/action/subitem2_id)
Subitem 3 (-> link to /controller/action/subitem3_id)



Topcategory with subcategories:

Topitem (-> link to /controller/action/topitem1_id)


I hope it's a little bit understandable and here is the code:


requestAction('/categories/
getTopCategories'); ?>





 array(
'controller' => 'categories',
'action' => 
'getSubCategoriesById',
$category['Category']['id']
),
'update'   => 'submenu_' . 
$category['Category']['id'],
'complete' => 'showSubMenu(' . 
$category['Category']['id'] . ')'
);

echo $ajax->link($category['Category']['name'],
 
'/categories/getSubCategoriesById/' . $category['Category']
['id'],
 $options);


echo $ajax->div('submenu_' . $category['Category']['id'],
array('style' => 'display:none', 'class' => 'submenu'));

if ($subcategories) {
foreach($subcategories as $subcategory) {
echo $subcategory['Category']['name'] . '';
}
}
echo $ajax->divEnd('submenu_' . $category['Category']['id']);

?>




How can I solve the problem?

Cheers
Sven

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


Polivoda Dynamic Menu and other menu htmlentities issues

2009-12-02 Thread babilasaronni.it
Thanks a loot for this kind of menu.

http://www.palivoda.eu/2008/04/dynamic-menu-in-cakephp

and for the service, it helped me to improve my software solution
based on cake.

In order to validate (w3c) my pages I have encountered a small problem
with ampersant (&) and in particoular the code in the case ‘current’
doesn’t escape, so in my page source I had ‘&’ instead of ‘&escaped’,
in ‘no current’ case the escape was right, so I wasn’t able to have a
unique validated result.

I resolved this problem adding htmlentities PHP function in this way:

$out[$caption] = $this->Html->div(’current’, htmlentities($caption));

instead of the original:

$out[$caption] = $this->Html->div(’current’, $caption);

Infact funtion 'link' escapes character automatically, 'div' probably
no!!

Thank again Polivoda you are great.

But I think that this kind of problem could exists in other menu
components (or in some other components at all)

Babila Saronni

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: Dynamic Menu

2009-09-17 Thread iFeghali

Yes, I did in cake.

I am no expert, so be aware that my solution can have some flaws.

so in app_controller.php :

Auth->user()) {
$controllerList = Configure::listObjects('controller');
$permittedControllers = array();

foreach ($controllerList as $controllerItem) {
if (($controllerItem != 'App')
&& ($this->__permitted($controllerItem, 'index'))
) {
$permittedControllers[] = $controllerItem;
}
}

/**
 * build menu based on user's permissions
 */
$this->nav = array_intersect($this->nav,
$permittedControllers);

/**
 * build sub menu based on user's permission
 */
foreach ($this->subnav as $k => $s) {
if (is_array($s)) {
if (empty($s)) {
unset($this->subnav[$k]);
continue;
}
$s = (string)array_shift($s);
}

if (!$this->__permitted($this->name, $s)) {
unset($this->subnav[$k]);
}
}
}

$this->set('nav', $this->nav);
$this->set('subnav', $this->subnav);
}
?>

"nav" holds an array of "menu items". In my case all items are
controller names, because i build my menu based on them. then I have a
"subnav" that holds the controllers actions so I show only the action
that the user has access to. so in the layout (or view) I loop into
the vars "nav" and "subnav" building the menu.

of course you can hack it to have a different approach.

Best,
~IF.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Dynamic Menu

2009-09-16 Thread Charles

I was wondering does anyone has created a Dynamic Menu based on User
Authentication/Authorization (Role/Permission)? I have a project that
I am going to be working on, I am thinking to use CakePHP or MODx CMS
systems. Any suggestion? 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 
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 dynamic menu ?

2008-04-07 Thread silkcom

The easiest way I've found, if it's totally global is:

in the app_controller, in before_filter do a $this->set('categories',
$this->Categories->find("all")); (make sure that you have a $uses =
'Category' (i believe that's the right syntax, and I also think there
is a better way to do this, I just don't remember it).

Then in the layout, use $categories however you want too.

You could also then pull the menu off into an element if you desire.

If you only want it to be on one controller, put the line in the
before filter of just that controller.

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



Dynamic Menu With ACL.

2008-03-28 Thread LepinskiWA

(If you reading this and thinking. OMG! He doesn't speak english...
Yes, you are right. Sorry about bad english)

I'm trying to make a dynamic admin menu like Worpress menu. If a User
don't have access to an specific section, the link to this section
doesn't *NOT* have to be showed.

Figuring out this, i'm thinking to make a table (sections) and verify
the permissions on the controller but in this case, user have
permission on other controller, not sections. Anyone have any ideias
to do that? The table sections is necessary? If a make a menu
hardcoded in the controller how to verify the permission without using
the sections table?

again, sorry about the english.
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: cacheing a dynamic menu

2007-07-18 Thread Geoff Ford
Caching in general will only work with DEBUG set to 0.



On 7/19/07, Ski <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
>   Sorry, I lied about element caching - the number of queries went
> down, but it was not because of the element cache - this is 1.2 I
> guess...
>
>   Still looking if anyone else knows..
>
>   Glen
>
> On Jul 18, 3:18 pm, Ski <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> >   I am using Cake 1.1 at the moment, thanks Pablo.
> >
> >   Geoff, the element caching works wonderfully thanks.
> >
> >   Cheers.
> >
> >   Glen
>
>
> >
>


-- 
http://lemoncake.wordpress.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
-~--~~~~--~~--~--~---



Re: cacheing a dynamic menu

2007-07-18 Thread Ski

Hi,

  Sorry, I lied about element caching - the number of queries went
down, but it was not because of the element cache - this is 1.2 I
guess...

  Still looking if anyone else knows..

  Glen

On Jul 18, 3:18 pm, Ski <[EMAIL PROTECTED]> wrote:
> Hi,
>
>   I am using Cake 1.1 at the moment, thanks Pablo.
>
>   Geoff, the element caching works wonderfully thanks.
>
>   Cheers.
>
>   Glen


--~--~-~--~~~---~--~~
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: cacheing a dynamic menu

2007-07-18 Thread Ski

Hi,

  I am using Cake 1.1 at the moment, thanks Pablo.

  Geoff, the element caching works wonderfully thanks.

  Cheers.

  Glen


--~--~-~--~~~---~--~~
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: cacheing a dynamic menu

2007-07-17 Thread Geoff Ford

http://bakery.cakephp.org/articles/view/optimizing-your-cakephp-elements-and-views-with-caching

element('getevents', array('cache'=>'1 day'));?>

Also mentions how to flush the cache when you update the menu.

Geoff
--
http://lemoncake.wordpress.com


On Jul 18, 4:42 am, "Pablo Viojo" <[EMAIL PROTECTED]> wrote:
> Cake 1.1, or 1.2?
>
> On 7/17/07, Ski <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Hi,
>
> >   Can anyone shed some light on this?
>
> >   I have searched the web and there is supposed to be a tutorial in
> > the Wiki about creating a cached version of a dynamic menu manually
> > when the admin tool updates certain things.
>
> >   Where would I get the wiki tutorial please?
>
> >   Glen
>
> --
> Pablo Viojo
> [EMAIL PROTECTED]://pviojo.net


--~--~-~--~~~---~--~~
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: cacheing a dynamic menu

2007-07-17 Thread Pablo Viojo
Cake 1.1, or 1.2?

On 7/17/07, Ski <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
>   Can anyone shed some light on this?
>
>   I have searched the web and there is supposed to be a tutorial in
> the Wiki about creating a cached version of a dynamic menu manually
> when the admin tool updates certain things.
>
>   Where would I get the wiki tutorial please?
>
>   Glen
>
>
> >
>


-- 
Pablo Viojo
[EMAIL PROTECTED]
http://pviojo.net

--~--~-~--~~~---~--~~
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: cacheing a dynamic menu

2007-07-17 Thread Ski

Hi,

  Can anyone shed some light on this?

  I have searched the web and there is supposed to be a tutorial in
the Wiki about creating a cached version of a dynamic menu manually
when the admin tool updates certain things.

  Where would I get the wiki tutorial please?

  Glen


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



cacheing a dynamic menu

2007-07-13 Thread Ski

Hi,

  I am trying to implement caching for my site and one of the major
places needing this is the dynamic menu.

  Because this appears on every page, the model data for the menu is
fetched in the AppController and used in an element included by the
default layout.

  How would I go about ensuring that this is cached?

  Thanks

  Glen


--~--~-~--~~~---~--~~
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: Setting dynamic menu + submenu

2007-02-17 Thread the_woodsman

Maybe I just don't fully understand your requirements,but... why can't
you have a menu that can map any menu item to any controller/action -
i.e. menu item 1 would link to pages/somepage, item 2 to
dynamic_content_controller/draw_graph, etc etc... It's a benefit of
Cake that URLs are so flexible, why tie yourself down like this?


> Of course it would be much nicer if the path would be /menuItem/view/
> subMenuItem but as the menu is dynamic this isn't possible (no
> controller with that name).

I'm sure you could achieve this by modifying your app's routes.php
file.


Woody


--~--~-~--~~~---~--~~
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: Setting dynamic menu + submenu

2007-02-17 Thread junal

i dont know why you are thinking that way. you got ELEMENT to place
your menus. and to make your menus dynamic why dont you use CSS. thank
you.

On Feb 17, 2:56 am, "cakerdude" <[EMAIL PROTECTED]> wrote:
> Hi there. I'm quite new at cake but definitely jumping in to it.
> I have a question though. What would be the best way to set up a cake
> site with a dynamic menu + submenu. The way i see it i have to send
> two values to the controller so that the path would look like /
> controller/view/menuItem/subMenuItem.
> However isn't this against the whole idea of cake(stepping away from
> the whole model/controller/action/ concept)?
> Of course it would be much nicer if the path would be /menuItem/view/
> subMenuItem but as the menu is dynamic this isn't possible (no
> controller with that name).
>
> I hope i make any sense.
>
> Can anyone tell me where i'm thinking wrong because i'm positive this
> IS possible withing cake.


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



Setting dynamic menu + submenu

2007-02-16 Thread cakerdude

Hi there. I'm quite new at cake but definitely jumping in to it.
I have a question though. What would be the best way to set up a cake
site with a dynamic menu + submenu. The way i see it i have to send
two values to the controller so that the path would look like /
controller/view/menuItem/subMenuItem.
However isn't this against the whole idea of cake(stepping away from
the whole model/controller/action/ concept)?
Of course it would be much nicer if the path would be /menuItem/view/
subMenuItem but as the menu is dynamic this isn't possible (no
controller with that name).

I hope i make any sense.

Can anyone tell me where i'm thinking wrong because i'm positive this
IS possible withing cake.


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



Dynamic Menu

2006-12-02 Thread GAP

Greetings!

I'm Gerald Anthony Piangco, you can call me GAP to make it short and
easy to remember. I am currently learning cakePHP. My first time to use
a MVC framework, though I do have an idea what and how MVC works.

I'm a little stumbled the reason why I post a topic on this group to
get enlightened about cakePHP more. I was hoping if someone here could
make a practical tutorial on how to implement a Dynamic Menu in cakePHP
just like how they did the Blog Tutorial on the cakePHP manual. I've
seen recent post by "Steniskis" and the paste bin by "AD7six" but still
don't quite understand it. I feel like it would be better if someone
could make a step-by-step tutorial noting the directory where to put
specific files and put more information for doing such.

I'm really excited on finishing my website using cakePHP, hope you
guys/gals here could help me. Thanks in advance!


.GAP


--~--~-~--~~~---~--~~
 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: Dynamic Menu

2006-10-23 Thread Sonic Baker
Hi Sten,Thank you for your reply and code samples. I'm sure this will be a great help. I'll let once I get a change to try and implement the menu's.Cheers,Sonic

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

2006-10-23 Thread Steniskis

Hello
I have created a component with my menus
I began with the menu tutorial in the wiki
http://wiki.cakephp.org/tutorials:building_a_cakephp_site_part_-_1

I call the menu from my controller
lass RapportsController extends AppController {

var $name = "Rapports";
var $layout = "page";
var $helpers= array('html', 'javascript', 'ajax', 'time', 'page',
'thickbox', 'awbarplot');
var $components = array('Menu');
var $beforeFilter = array('init');
function init() {
// Create menu component
$this->Menu->controller = &$this;
$this->Menu->init($this->name);
}
...
?>

then I have the menuComponent where I build an array. The variable
$_SERVER['REQUEST_URI']; is used to know which on which page we are.
 'accueil/',
"Collecte" => array(
1 => "Collecte",
"Tournées" => "tournees/",
"Equipes" => "equipes/",
"Personnels" => "personnels/",
"Secteurs" => "secteurs/"
),

"Rapports" =>  "rapports/",

"Admin" => array(
1 => "Admin",
"Droits Accès" => "acces/",
"Usagers et groupes" => "usagers/",
"Importations" => "importations/"
),
"Réclamations"  => "reclamations/",
"Déchetteries"  => "dechetteries/"
);

function startup(&$controller) {
$this->controller =& $controller;
}


 function init () {
$this->controller->set('les_menus',$this->les_menus);
$this->controller->set('active',$this->activer($this->les_menus));
$this->controller->set('active',$this->active);
}

  function activer ($les_menus) {
  $uri=$_SERVER['REQUEST_URI'];
  $i=0;

foreach ($les_menus as $valeur){


 if (!is_array($valeur)) {
 $i++;
 if (eregi($valeur,$uri)){

 $this->active=$i;
}
} else {

 foreach($valeur as $svaleur) {
$i++;

 if (eregi($svaleur,$uri)){
 $this->active = $i;
}
}//foreach
}//else

}//foreach
} //méthode

}
?>
then in your view you include your element
renderElement('nav',$les_menus); ?>

then here is your element




 $valeur): ?>

';
}
 elseif ($i==1){
 echo '';
}
 elseif ($i==$taille_1){
 echo '';
}
 else {
 echo ''."\n";
}

 if ($k==$active){
 echo $html->link("$libelle",'#');
}
 else {

  echo $html->link($libelle,FULL_BASE_URL . 
$this->webroot .
$valeur);
}
 echo ''."\n";
} else {
 $taille_2=count($valeur);
 foreach($valeur as $slibelle => $svaleur) {
 $k++;
 $j++;
 if ($k==$active){

 echo '';
echo $html->link($slibelle,$_SERVER['REQUEST_URI']);
echo "\n";
 if ($j==1){
echo '';
}
else {
echo '';
}
}
   elseif ($j==$taille_2){
  echo  '';
echo $html->link($slibelle,FULL_BASE_URL . $this->webroot .$svaleur);
echo ''."\n";
}
elseif ($j==1){
if (($active<($k+$taille_2)) && 
($active>$k)){

   echo '';
if 
(is_numeric($slibelle)){

echo $html->link($svaleur,'#');

}
else {
echo $html->link($slibelle,FULL_BASE_URL . $this->webroot .$svaleur);
}
echo "\n";
}
else {

echo '';
if (is_numeric($slibelle)){
echo $html->link($svaleur,'#');
}
else {
echo $html->link($slibelle,FULL_BASE_URL . $this->webroot .$svaleur);
}
echo "\n";
}
echo  '';

}
elseif ($j==2){
 

Re: Dynamic Menu

2006-10-22 Thread Sonic Baker
Hi there,I'm also looking for a solution to this problem but haven't gotten round to it yet. I was searching cakeforge for one but there doesn't seem to be one.I was thinking of something like a series of nested 'tab menus' which look something like the tab menus on the cake API.
Once a tab is active it stays highlighted as that active menu even when navigating through sub menus.There is a tutorial on the wiki about caching dynamic menus but that only sorts out the optimisation part of things.
I'd appreciate it if you could let me know if you find something.Cheers,Sonic

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

2006-10-20 Thread jogo

Hi all!

I'm thinking about to create a dynamic menu (user based). The menu has
its elements stored in a DB. Each user has his own menu elements. This
is my idea:

Using XML. User logged in -> call DB and retrieve his own menu elements
-> write XML file -> apply XLST to show the menu

I don't know if is there any other options but doing SELECTs each time
menu is showed. I think XML way is fine because could be used also as a
webservice

What do you guys think?

greetings!


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