Re: Advice on menu setup

2015-10-20 Thread heavyKevy
Is the menu supposed to be displayed on every page?

I gather that the menu is dynamically driven by data in the Db...
That tells me that you should have a model for it.
If it is to be included on every page, then I would load the menu model in 
the App Controller, probably in the beforeRender() method.
$this->loadModel('Menu');
Don't forget to include it at the top with a use statement.

Then you can set whatever variables you need to pass to your view.
In that your specifications are vague, I can't tell you exactly what to 
pass along...

Then with the view vars set using the set(), you can use them in the layout 
or in an element depending on your needs.


On Monday, October 19, 2015 at 2:41:44 PM UTC+7, Simon Bradley wrote:
>
> Hi
>
> I'm new to cakephp
>
> I'm using version 3
>
> I've been working through an existing site i have built and trying to 
> replicate it with cakephp
>
> I did a lot very quickly which is great but the menu is tricky
>
> Since this is a navigation bar at the top of every page i thought i might 
> use an element
>
> The problem there seems to be getting the data into it from the database
>
> I've read the manual quite a bit and based on that i thought maybe 
> creating a model and controller for the menu would be the best way to go
>
> Then i could call the menu controller from the article controller and get 
> the menu data that way
>
> It looks like i can pass the data into the menu element from there?
>
> But then where do i put the code that actually takes the data and 
> generates the menu?
>
> I've looked at various tutorials but it's not made things clearer
>
> I'd really appreciate some advice here folks.
>
> Cheers.
>
>
>
>
>

-- 
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/d/optout.


Re: Advice on menu setup

2015-10-19 Thread Rob Maurer
Your existing menu likely is a series of  elements each containing  
(link) elements, yes? Simply replace the ... with Html->link(...) ?>. A good place to do this is 
app/View/Layouts/default.ctp.

-- 
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/d/optout.


Re: Advice on menu setup

2015-10-19 Thread Rob Maurer
Your existing menu is likely a series of  elements with  in 
them, yes? Replace the  elements with Html->link() ?> calls. 
A good place to set this up is in app/View/Layouts/default.ctp.
-Rob 

On Monday, October 19, 2015 at 3:41:44 AM UTC-4, Simon Bradley wrote:
>
> Hi
>
> I'm new to cakephp
>
> I'm using version 3
>
> I've been working through an existing site i have built and trying to 
> replicate it with cakephp
>
> I did a lot very quickly which is great but the menu is tricky
>
> Since this is a navigation bar at the top of every page i thought i might 
> use an element
>
> The problem there seems to be getting the data into it from the database
>
> I've read the manual quite a bit and based on that i thought maybe 
> creating a model and controller for the menu would be the best way to go
>
> Then i could call the menu controller from the article controller and get 
> the menu data that way
>
> It looks like i can pass the data into the menu element from there?
>
> But then where do i put the code that actually takes the data and 
> generates the menu?
>
> I've looked at various tutorials but it's not made things clearer
>
> I'd really appreciate some advice here folks.
>
> Cheers.
>
>
>
>
>

-- 
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/d/optout.


Advice on menu setup

2015-10-19 Thread Simon Bradley
Hi

I'm new to cakephp

I'm using version 3

I've been working through an existing site i have built and trying to 
replicate it with cakephp

I did a lot very quickly which is great but the menu is tricky

Since this is a navigation bar at the top of every page i thought i might 
use an element

The problem there seems to be getting the data into it from the database

I've read the manual quite a bit and based on that i thought maybe creating 
a model and controller for the menu would be the best way to go

Then i could call the menu controller from the article controller and get 
the menu data that way

It looks like i can pass the data into the menu element from there?

But then where do i put the code that actually takes the data and generates 
the menu?

I've looked at various tutorials but it's not made things clearer

I'd really appreciate some advice here folks.

Cheers.




-- 
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/d/optout.