saseow
Posts: 744
|
Posted: 06/30/2011, 11:08 AM |
|
I have an HTML block:
<style>
body {
background: #FFFFFF;
}
</style>
Is it possible to only run this if a parameter is true? e.g.
if (CCGetParam("ViewMode") == "Print")
":then run this block"
Can be done or not?
|
|
|
datadoit
|
Posted: 06/30/2011, 11:14 AM |
|
I would dynamically modify the style of the element based on the condition.
HTML:
<div class="{MyStyle}">
PHP:
global $Tpl;
if (this) {
$Tpl->SetVar("MyStyle", "ThisClass");
}
else {
$Tpl->SetVar("MyStyle", "ThatClass");
}
Keep your styles in a stylesheet. CodeCharge pukes hard when attempting
to put a <style> block in the <head> section.
|
|
|
saseow
Posts: 744
|
Posted: 06/30/2011, 11:19 AM |
|
Very interesting datadoit. Thank you.
I will give this a try. Will have to find the style sheet first as this is my maiden voyage into Artisteer. Working very well so far!
I will post result here.
Thanks again.
|
|
|
saseow
Posts: 744
|
Posted: 06/30/2011, 11:35 AM |
|
datadoit....Brilliant!
The solution:
HTML:
{tcr_bg}
PHP:
global $Tpl;
if (CCGetParam("ViewMode") == "Print") {
$Tpl->SetVar("tcr_bg", "<style><!--body {background: #FFFFFF;}</style>");
}
Works like a dream. Thank you!
|
|
|