Re: Do you hardcode your menu links?

2007-12-05 Thread powtac

Thanx a lot!

This is how I used it successfully with cakePHP 1.2:

1. Downloaded http://cakeforge.org/snippet/download.php?type=snippet&id=361
into /app/views/helpers/menu.php
2. Added
var $helpers = array('Menu');
to class AppController
in /app/app_controller.php
3. Added
 '/home', 'User' => '/users', 'Profiles' =>
'/profiles');
echo $menu->menu($navi, 'li', 'current');
?>
in the file /app/views/layouts/default.ctp
where I want the navigation to show up.

This will produce a navigation/menu which shows up on every(!) page.
--~--~-~--~~~---~--~~
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: Do you hardcode your menu links?

2007-12-05 Thread Adam Royle

@Arne

Try and it and test the speed. I ended up caching my rendered menu in
an element based on the page.

@powetac

I do intend to release my helper, except the code that selects the
current page is not 100% accurate (and is a bit slow, because it
analyses route data as well). But I can still send to you if you like.

Cheers,
Adam

On Dec 6, 7:38 am, "Jon Bennett" <[EMAIL PROTECTED]> wrote:
> > Could anybody publish his menuHelper? It would be very fine for
> > beginners (like me).
>
> I have published one previously to cakeforge. I've just updated it to
> handle 2 tier structures:
>
> http://cakeforge.org/snippet/download.php?type=snippet&id=361
>
> hth
>
> jon
>
> --
>
> jon bennett
> w:http://www.jben.net/
> iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
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: Do you hardcode your menu links?

2007-12-05 Thread Jon Bennett

> Could anybody publish his menuHelper? It would be very fine for
> beginners (like me).

I have published one previously to cakeforge. I've just updated it to
handle 2 tier structures:

http://cakeforge.org/snippet/download.php?type=snippet&id=361

hth

jon

-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
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: Do you hardcode your menu links?

2007-12-05 Thread powtac

Could anybody publish his menuHelper? It would be very fine for
beginners (like me).
--~--~-~--~~~---~--~~
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: Do you hardcode your menu links?

2007-12-05 Thread Arne-Kolja Bachstein

Hi,

many thanks for your answers so far. I think I'll implement a mix of
elements and a generic model for this, to configure the links from
within the backend. I think that's a nicer way than putting it into a
config file or something.

I had this in mind earlier, but have been in doubt if it would cause
too much overhead as of the needed database queries. But in the end
I'm thinking that my app doesn't do that much queries at all, having
several CMS' in mind that are querying about 10+ tables just for
browsing their portal page. What do you think? Is it worth the
overhead? Shouldn't be that much of a problem, eh?

Greets,

Arne
--~--~-~--~~~---~--~~
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: Do you hardcode your menu links?

2007-12-04 Thread Adam Royle

Similar to Dragonl, I store my menu links in an array (almost exactly
the same structure incidentally) and have developed a helper to write
out css menus, which also highlights the current page.

At the moment I've kept the array hardcoded in my element because it
doesn't change often, but it could easily be generated from a
controller dynamically.

Cheers,
Adam

On Dec 5, 9:09 am, DragonI <[EMAIL PROTECTED]> wrote:
> I store menu and submenu links in a config file as an array which is
> loaded and cached in beforeRender in app_controller. I have my own
> menu helper which displays the menu in an element
>
> $config['mainMenu'] = array(
> 1 => array(
> 'title' => 'Home',
> 'url' => '/',
> 'desc' => 'Home',
> ),
> 2 => array(
> 'title' => 'Search',
> 'url' => '/search/',
> 'desc' => 'Search',
> ), etc
>
> On Dec 4, 4:52 pm, kristofer <[EMAIL PROTECTED]> wrote:
>
> > I usually pull in an element to handle dynamic navigation.
>
> > On Dec 4, 4:46 pm, Arne-Kolja Bachstein <[EMAIL PROTECTED]> wrote:
>
> > > Hi there,
>
> > > I've got a quite generic question... do you usually hardcode your menu
> > > links [in your views] when developing something with cake, or do you
> > > implement something like link management models or something? What's
> > > the usual way here in your opinion?
>
> > > Greetings
>
> > > Arne
--~--~-~--~~~---~--~~
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: Do you hardcode your menu links?

2007-12-04 Thread DragonI

I store menu and submenu links in a config file as an array which is
loaded and cached in beforeRender in app_controller. I have my own
menu helper which displays the menu in an element

$config['mainMenu'] = array(
1 => array(
'title' => 'Home',
'url' => '/',
'desc' => 'Home',
),
2 => array(
'title' => 'Search',
'url' => '/search/',
'desc' => 'Search',
), etc


On Dec 4, 4:52 pm, kristofer <[EMAIL PROTECTED]> wrote:
> I usually pull in an element to handle dynamic navigation.
>
> On Dec 4, 4:46 pm, Arne-Kolja Bachstein <[EMAIL PROTECTED]> wrote:
>
> > Hi there,
>
> > I've got a quite generic question... do you usually hardcode your menu
> > links [in your views] when developing something with cake, or do you
> > implement something like link management models or something? What's
> > the usual way here in your opinion?
>
> > Greetings
>
> > Arne
--~--~-~--~~~---~--~~
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: Do you hardcode your menu links?

2007-12-04 Thread kristofer

I usually pull in an element to handle dynamic navigation.

On Dec 4, 4:46 pm, Arne-Kolja Bachstein <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I've got a quite generic question... do you usually hardcode your menu
> links [in your views] when developing something with cake, or do you
> implement something like link management models or something? What's
> the usual way here in your opinion?
>
> Greetings
>
> Arne

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



Do you hardcode your menu links?

2007-12-04 Thread Arne-Kolja Bachstein

Hi there,

I've got a quite generic question... do you usually hardcode your menu
links [in your views] when developing something with cake, or do you
implement something like link management models or something? What's
the usual way here in your opinion?

Greetings

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