Create another directory structure for our template
blocks/autonav/templates/tree
.Within that directory create
view.php
, but this time we'll use a different approach. We only want to change the class name to keep the functionality separated from otherautonav
blocks on the same page. We also don't want to copy the defaultautonav
block template to avoid redundant code. We're going to replace theul
class name on-the-fly:<?php $bvt = new BlockViewTemplate($b); $bvt->setBlockCustomTemplate(false); function nav_tree_callback($buffer) { return str_replace('<ul class="nav">','<ul class="nav-tree">',$buffer); } ob_start("nav_tree_callback"); include($bvt->getTemplate()); ob_end_flush(); ?>
In another file called
view.css
, you have to place some layout instructions for our tree. The script works without this, but the tree would look a bit misaligned:.nav-tree li { list-style-type: none; } .nav-tree { margin...
concrete5 Beginner's Guide
concrete5 Beginner's Guide
Overview of this book
Table of Contents (19 chapters)
concrete5
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
Installation
Working with concrete5
Permissions
Add-ons
Creating Your Own Theme
Customizing Block Layout
Advanced Navigation
Creating Your Own Add-on Block
Everything in a Package
Dashboard Extensions
Deployment and Configuration
Pop Quiz Answers
Index
Customer Reviews