Topic: If template-name == 'xyz' echo ... possible? (conditional by template)

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 header.inc 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?

Advanced HTML5 & CSS3 coder. Simple JS & PHP hacker (not enough for plugin coding). New to GS (Feb. 2012). Focusing on Theme customizing/Template files. Experience with WP.

Re: If template-name == 'xyz' echo ... possible? (conditional by template)

this was written for components, but will work the exact same way:

http://get-simple.info/wiki/components- … n-the_page

- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!

Re: If template-name == 'xyz' echo ... possible? (conditional by template)

@ChriS

<?php if ($template_file == 'name-of-template.php') {
...

If used in a component, first do:

global $template_file;

Re: If template-name == 'xyz' echo ... possible? (conditional by template)

@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... ;-)

Advanced HTML5 & CSS3 coder. Simple JS & PHP hacker (not enough for plugin coding). New to GS (Feb. 2012). Focusing on Theme customizing/Template files. Experience with WP.