GetSimple Support Forum

Full Version: If template-name == 'xyz' echo ... possible? (conditional by template)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm hacking on my template and use includes (header, footer, etc.).
In the header or some includes I sometimes would like to include a conditional asking for the template used actually. For example to include additional js/css for a certain template in the file. This to avoid creating additional inc files that differ only in one line/part of the code.
In the Forum I found some about doing simliar conditionals with the page_slug (Noindex, nofollow for single page, Display components in specific page only), but not for specific template only.

Is it in some way possible to make a conditional by the used template without a plugin?
this was written for components, but will work the exact same way:
<?php if ($template_file == 'name-of-template.php') {

If used in a component, first do:
global $template_file;
@ccagle8: thank you for showing me the possibilities.

@Carlos: Perfect! That was right the code I was looking for. Works now in my template includes... ;-)