Created
June 8, 2011 05:06
-
-
Save nicksantamaria/1013816 to your computer and use it in GitHub Desktop.
Psuedo-code for getting the parent page's title when using urls as hierarchy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get the requested URL alias and explode into array | |
$q = trim($_SERVER['REQUEST_URI'], '/'); | |
$arg = explode('/', $q); | |
// Shorten the URL by 1 argument | |
$newArg = array_slice($arg, 0, (count($arg) - 1)); | |
// Get the menu item for the new URL | |
$item = menu_get_item(implode('/', $newArg)); | |
// Here is the title | |
$title = $item['title']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment