This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

thomas15915526
thomas15915526

I have 2 pages index.htm and links.htm and a partial sidebar.htm.

I'm trying to get my sidebar to display different content based on which page is active.

sidebar.htm

description = "sidebar"
url = "/sidebar/:{% this.page.url %}"
==
{% if this.param.tab == 'links' %}
Display this if page = links
{% elseif this.param.tab == 'index' %}
Display this is page = index
{% endif %}

In blade I used - @elseif(isset($guidesslugs) && $guidesslugs->guidesslug == 'area-guide') but I'm not sure how to accomplish the samething using twig or whether it's possible to used the param.tab on a partial?

Last updated

Eoler
Eoler

Partials don't have properties (only ViewBag), you need to pass variables from page directly to them:

{% partial "sidebar" activetab=this.param.tab %}

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.