Get Page Title Only

edited June 2011 in Share
Hi -- I'm totally new

I have menu working
I have breadcrumbs working
I have submenu working
I want a page title -- one that does not look like breadcrumbs -- just the label for the ultimate menu item. Where I want it makes it logical to have in the layout header and accessed via the menu helper. Is there a way?

Comments

  • edited 3:48AM
    By default, the page title is set using the fuel_nav function in the fuel/application/views/_variables/global.php (more on that file here):
    http://www.getfuelcms.com/user_guide/general/opt-in-controllers

    If a page created in the admin has a variable of $page_title, then it will overwrite that default value with whatever was filled out in the admin.

    If you just want it to be the label of the menu item, you could use the URI string of the page you are on using the FUEL function uri_path(). Then, if the navigation is controlled by the admin, you could use that value to either query the database using the fuel navigation_model like so:
    $nav_item = fuel_model('navigation_model', array('find' => 'one', 'where' => 'location="'.uri_path().'"', 'module' => FUEL_FOLDER)); $page_title = $nav_item->title;
    Or if you are using the static fuel/application/views/_variables/nav.php file to control the navigation and the keys to the navigation items are the URI paths, you could try something like this:
    include(APPPATH.'views/_variables/nav.php'); $nav_item = $nav[uri_path()]; $page_title = $nav_item['title'];

    Here is a little more information on fuel_nav() and navigation structures
    http://www.getfuelcms.com/user_guide/helpers/fuel_helper
    http://www.getfuelcms.com/blog/id/4

    Hope that helps!
  • edited 3:48AM
    Thank you .. That helps!
Sign In or Register to comment.