Warning: Illegal string offset '_imagedir' in /home/cakephpf/public_html/lofiversion/index.php on line 545

Warning: Illegal string offset '_emodir' in /home/cakephpf/public_html/lofiversion/index.php on line 546
CakePHP UnOfficial Community Forum > Top menu display
Help - Search - Member List - Calendar
Full Version: Top menu display
CakePHP UnOfficial Community Forum > Layouts and Design

rahul_shah
Hi,

I am using cake_1.2.0.7692-rc3 for my application.

I want to display top menu links in all pages(.ctp).

Then, how can i do this.

Thanks.
hackerqt
you should creat a file 'default.ctp' in folder app/view/layout/
kruger
You can use element to include your menu into default.ctp layout

Create file for example: menu.ctp with your menu links and place it into views -> element folder

then write [PHP] echo $this->element('menu');[/PHP] in your default.ctp layout

You can even cache your element menu

Check this out:

http://book.cakephp.org/view/97/Elements

rahul_shah
Thanks for replying.

Ok.

I am created element menu.ctp.

At there Suppose i write code:

|<?php e($html->link('Administrators', '/Admins/index'));?>|
<?php e($html->link('Section Management', '/Sections/index'));?>|
<?php e($html->link('UserType Management', '/UserTypes/index'));?>|
<?php e($html->link('Domain Management', '/Domains/index'));?>|

But currently this is static.

But i want to fetch them from database.
So where i should write code for that.

For example: for add.ctp i write code in add action of related controller.
So i can set view for add.ctp.

But for menu.ctp (element) from where i can set that view.

And also tell me $content_for_layout comes from where?


Thanks For Replying.
Again wait 4 reply.
kruger
Just read cake book:
PassingVariables into an Element paragraph from:
http://book.cakephp.org/view/97/Elements
pcoulter54
thanks to all. i just follow the rules u all mentioned and solve my problems.
msnmnk
the simplest way to create and element at
QUOTE
app\views\elements

and called it
where you want to display on simple using

CODE
$this->renderElement('elementName');


you can call a dynamic menu like left menu in element and render it in all project.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.
Lo-Fi 1.1 iDS Beta, Originally written by Matt,
re-written by Shaun Harrison, Layer 04.com, for pre IPB2.0 versions.