GetSimple Support Forum

Full Version: page level as function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I need a PHP snippet to find the current menu level of a page?

- index
-- first level page
--- second level page

A function that returns 2 called in the second level page?

Thank you!
(2013-04-25, 18:10:58)netzfetz Wrote: [ -> ]I need a PHP snippet to find the current menu level of a page?

- index
-- first level page
--- second level page

A function that returns 2 called in the second level page?

If you use the I18N plugin for your navigation, you can use
Code:
<?php
  function getPageLevel() {
    $bc = return_i18n_breadcrumbs(return_page_slug());
    return count($bc)-1;
  }
?>
Ok, I understand -> count the number of breadcrumb items.
Thank you mvlcek!