Created
March 29, 2013 19:04
-
-
Save chrisjdavis/5272879 to your computer and use it in GitHub Desktop.
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
public function theme_route_display_docpage($theme) { | |
$theme->document = Document::get( array('slug' => $theme->matched_rule->named_arg_values['slug']) ); | |
$theme->page = Page::get( array('document_id' => $theme->document->id, 'name' => $theme->matched_rule->named_arg_values['page']) ); | |
$theme->pages = Pages::get( array('document_id' => $theme->document->id, 'orderby' => 'id ASC') ); | |
$theme->title = $theme->document->title . ' » ' . $theme->page->title; | |
$theme->post_id = $theme->page->id; | |
$i = 0; | |
$str = ''; | |
$dom = new HTMLDoc( $theme->page->content ); | |
foreach( $dom->find('h4') as $hs ) { | |
$slug = Utils::slugify( $hs->node->nodeValue ); | |
$heading->id = $slug; | |
$str .= '<li><a href="' . URL::get('display_docpage', array('slug' => $theme->document->slug, 'page' => $theme->page->name)) . '#' . $slug . '">' . $hs->node->nodeValue . '</a></li>'; | |
$i++; | |
} | |
var_dump( $dom->get() ); | |
if( $i >= 2 ) { | |
$theme->menu = $str; | |
} else { | |
$theme->menu = null; | |
} | |
$theme->display( 'docpage.single' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment