Jump to content

How to get the current Theme Template ?


Go to solution Solved by Alexandru,

Recommended Posts

Posted

Hello,

I added a new theme template to store all my carousel information in it. ( Or any content in general )

Now I want this to show only in home page where it is the index for my forums.

What is the condition to put that checks which template is now showing ( view ).

 

 

my template is called:

{template="mainsitecarousel" app="core" group="_mycustomtheme" location="front"}

I want it to be visible when user is showing the "index" template from forums.

Now I could write the previous code in side it, but I want it to be in different place ( under header ).

My thinking is to add my code in the main globalTemplate with a condition to check if we are in index template or not.

So I need to know what is the expression for that.

 

My code then will be like this ...

{{if [expression]}}
    {template="mainsitecarousel" app="core" group="_mycustomtheme" location="front"}
{{endif}}

 

Also, is there a place where I can check for these kind of advanced coding in documentation ?

 

Thank you.

Posted (edited)

It’s not that easy to do what you want. I mean what do you mean by only showing on the homepage? What about the rest of your website?

Edited by drawncodes
  • Solution
Posted (edited)


Sorry. My bad didn’t really read it all.

try this 

{{if request.controller == index && request.module == forums}}} your code here {{else}} code2…{{endif}}

i don’t know if the controller or the module is correct. But press on inspect when you are on your front page, and on the body tag just look for page controller and pagemodule and replace them in the conditions above if not correct. So this code will only show that template on the homepage.

Edited by drawncodes
Posted

Thanks it worked.

 

Is there a place in documentation where I can learn more about these conditions that are related to the system ? I know how php works here but I don't know what to check when I need somthing, like user information variable or what other things available like this "request.controller".

Posted

I checked it before. It talks about syntax in general.

I need to know what is available for me to use like that request, or sometimes I see something like "settings.VALUE".

These are the main core things that will help modifying the template and give more control.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...