GetSimple Support Forum
page level as function - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: page level as function (/showthread.php?tid=4679)



page level as function - netzfetz - 2013-04-25

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!


RE: page level as function - mvlcek - 2013-04-25

(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;
  }
?>



RE: page level as function - netzfetz - 2013-04-26

Ok, I understand -> count the number of breadcrumb items.
Thank you mvlcek!