TheAccountant Posted July 17, 2023 Posted July 17, 2023 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.
Alexandru Posted July 18, 2023 Posted July 18, 2023 (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 July 18, 2023 by drawncodes
Solution Alexandru Posted July 18, 2023 Solution Posted July 18, 2023 (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 July 18, 2023 by drawncodes TheAccountant and SeNioR- 1 1
TheAccountant Posted July 18, 2023 Author Posted July 18, 2023 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".
teraßyte Posted July 18, 2023 Posted July 18, 2023 Check everything in the guides under the Themes and Customizations > Template syntax group: https://invisioncommunity.com/4guides/ This is a link to the guide specific to "request" and other similar shortcuts:
TheAccountant Posted July 18, 2023 Author Posted July 18, 2023 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.
Recommended Posts