I am well aware of how to use the {if $cat eq "1"} do this {/if} from within a template -- if the template is in the body of the html.
I a STUMPED! however of how to use the {if $cat == "1"} to load a category specific style sheet or javascript.
FOR EXAMPLE:
in /skin1/customer/home.tpl
just before the </head>
I want to insert a stylesheet unique to category 19, and a link to a javascript file, only if a specific product or category is present.
I tried this:
Code:
{if $cat eq "19" }
<link rel="stylesheet" href="{$SkinDir}/directoryname/stylesheet19.css" />
{literal}<script language="JavaScript" src="{$SkinDir}/directoryname/category19js.js" type="text/javascript">
</script>{/literal}
{/if}
</head>
Hmm... didnt work.
I tried {if $cat == '19'} - and a bunch of variations.
IS THE PROBLEM that the <head> loads before the <body> and until the body loads, there is no way to trap for the category?
DO I HAVE TO load javascript and css links in the <head> - or can I put a css link in the body of a page? I have never done this...
Experts???
Thanks,
Jeremy
UPDATE:
It turns out the "category" I want to do this with is actually a sub-cat, if I use the if/else for the PARENT category,
it works, but if I use {if $cat eq "z"} [and z=the number of the subcategory] then it fails to work.
Hmm... I tried $subcat eq "z" -- no good. Any ideas how to do this with the subcat # ??? Thanks!