Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sidebar to show for sub pages for each page?
#6
@fairly_new,

Code:
function getSubMenu($page){
    $children=getChildren($page);
    $pagesSorted = subval_sort($children,'pubdate'); // select which field to sort on.
    foreach ($pagesSorted as $subpage){
        $title=returnPageField($subpage,'menu');
        $url=returnPageField($subpage,'slug');
        echo '<li><a href="index.php?id='.$url.'">'.$title.'</a></li>';
        // or use below if you have fancy urls on
         //echo '<li><a href="/'.$url.'">'.$title.'</a></li>';
    }    
}

This will sort the submenu on Published Date (or more corectly last edited date)

To get the field value of the current page use

Code:
//will echo the title of the current page
getPageField($id,'title');  

// returns the page title to the $page variable
$page = returnPageField($id , 'title' );

//return the parent of the current page
$parent = returnPageField($id, 'parent')


Hope this helps....
My Github Repos: Github
Website: DigiMute
Reply


Messages In This Thread
Sidebar to show for sub pages for each page? - by n00dles101 - 2012-06-25, 18:58:57



Users browsing this thread: 1 Guest(s)