Thread tagged as: Question, Problem

Simple Question on identifying pages in a content template

How do I use conditionals in a content template if I want to show things on certain pages e.g.

if pagePath = 'index.php' do this?

I looked through the docs in Templates and Pages and couldn't see anything and the forum search didn't have anything under "pagePath" or "conditionals"

What I'm trying to do is only show some elements on specific pages.


Andrew Cetnarskyj

Andrew Cetnarskyj 0 points

  • 5 years ago


Hi, you may want to take a look at this page in the documentation:

If you set a variable on your page(s) using:

PerchSystem::set_var('myPage', 'home');

In your template, you can use conditionals to check for the value of your variable:

<perch:if id="myPage" match="eq" value="home">
        //Content of home page.
       //Some other content here.

Hopefully this helps!

I had saw that but I wondered if there were any global variables I could use without setting my own

Drew McLellan

Drew McLellan 2638 points
Perch Support

There's nothing global, so setting your own is the way to go.