Forum
Passing variable into Perch Blog template
Hi,
I'm trying to pass a variable into a blog template but can't seem to get it working.
I am using the following in my blog/index.php file
<?php
PerchSystem::set_var('sectionSlug', 'en');
perch_blog_categories(array(
'template' => 'category_link.html',
));
?>
and then I have the following in my category_link.html template
<perch:before>
<h4>Categories</h4>
<ul class="blog-nav">
</perch:before>
<li><a href="/<perch:blog id="sectionSlug" />/blog/archive/category/<perch:category id="catSlug" />"><perch:category id="catTitle" /> (<perch:category id="count.blog.post" when-empty="0" />)</a></li>
<perch:after></ul></perch:after>
The output from the template doesn't show anything where I'm expecting the sectionSlug to display.
Am I doing something wrong or missing something at all?
Thanks in advance for any help.
Try
perch:category
instead ofperch:blog
for your tag.That's perfect! Thanks for your help, Drew.