Image in Auto-nav template
Permalink
I am new to concrete5 and also not well versed with php, I have read tutorials on how to create a template for auto-nav blocks.
I wanted to achieve an auto-nav output like this
<ul>
<li>
<span><img src=""/></span>
<a></a>
</li>
</ul>
So I created an image attribute and then with the help of some great C5 community members learnt how to output the image, however the image does not output within the <span></span> tag, the image shows up between the <ul><li></li><img src=""/><li></li>
Here's the code to the template
I hope to learn where I am going wrong.
Thank you
I wanted to achieve an auto-nav output like this
<ul>
<li>
<span><img src=""/></span>
<a></a>
</li>
</ul>
So I created an image attribute and then with the help of some great C5 community members learnt how to output the image, however the image does not output within the <span></span> tag, the image shows up between the <ul><li></li><img src=""/><li></li>
Here's the code to the template
<?php defined('C5_EXECUTE') or die("Access Denied."); $aBlocks = $controller->generateNav(); $c = Page::getCurrentPage(); $containsPages = false; $nh = Loader::helper('navigation'); $ih = Loader::helper('image'); //this will create an array of parent cIDs $inspectC=$c; $selectedPathCIDs=array( $inspectC->getCollectionID() ); $parentCIDnotZero=true; while($parentCIDnotZero){ $cParentID=$inspectC->cParentID; if(!intval($cParentID)){ $parentCIDnotZero=false;
Viewing 15 lines of 72 lines. View entire code block.
I hope to learn where I am going wrong.
Thank you
https://github.com/jordanlev/c5_clean_block_templates...
His autonav work was merged into the core and should be included in an upcoming release; the closest you can get for existing installations is to grab his work from github. I'm fairly certain he discusses placing an image within the template comments.