joejac
Posts: 242
|
| Posted: 01/26/2008, 5:07 AM |
|
Hello,
1.- In a CCS3 html template "content.html" (CCS3 php+ templates) I have this:
.......
<div id="container">
Content ......
</div>
.......
And in a style sheet I have the style like this:
div#container{width:990px; height:540px; background-image: url(images/background.jpg); margin:0 auto;}
2.- A gallery.php page calls a content.php page as this:
content.php?category_no=18
Category is one menu item.
3.- Can I always send a fixed parameter and the same background value from the gallery.php page like this:
content.php?category_no=18&background=background_1.jpg
3.1 to read this parameter in the content.php page and rewrite <div id="container"> as this with an in line style for its content.html template like this:
<div style="width:990px; height:540px; background-image: url(images/background_1.jpg); margin:0 auto;">
3.2 also, there are other pages than gallery.php that calls content.php, so IF there is not background parameter on the URL do not change anything, leave the division as it is originally:
<div id="container"> .....</div>
4.- It would be very helpful for me if you can provide with detailed instructions and the code in the appropriated event :)
5.- Is there any other better and easy way to do this, can you please provide detailed instructions with code?
I hope I was able to explain myself.
Best regards
joejac
|
 |
 |
datadoit
|
| Posted: 01/26/2008, 5:48 AM |
|
In short, look at how to work with the $Tpl variable.
In your HTML, do something like:
<div id="{container}">
Content ......
</div>
In your Page BeforeShow event code, do something like:
global $Tpl;
if (CCGetParam("background","") == "background_1.jpg") {
$Tpl->SetVar("container", "container_1");
}
else {
$Tpl->SetVar("container", "container");
}
I would simply add another line to your stylesheet for "container_1".
Do you see what's happening? We're programmatically changing the HTML.
|
|
|
 |
joejac
Posts: 242
|
| Posted: 02/06/2008, 1:57 PM |
|
Thank you very much datadoit, it worked perfect!
Best regards
joejac
|
 |
 |
|