Forum

Thread tagged as: Question, Blog

perch_blog_categories(); not updating at runtime

Hi Guys,

I am trying to highlight the current page in the blog categories/archive section. I currently have this code in my page

        <?php
            PerchSystem::set_var('current_category', perch_get('cat'));
            perch_blog_categories(array(
                'template' => 'category_link.html',
            ));
        ?>

and this in my template;

<li <perch:if id="catSlug" match="eq" value="{current_category}">class="current"</perch:if>><a href="/news/category/<perch:category id="catSlug" />"><perch:category id="catTitle" /></a></li>

However, this is not updating on runtime/dynamically. It is only updating when I save a blog post and then keeps the category variable set when saved.

can't figure out what I have done wrong.

Any ideas?

Thanks, Terry

Terry Upton

Terry Upton 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

It's cached for performance. If you need it not cached, turn the caching off.

'cache' => false,