WebsiteBaker Support (2.8.x) > Templates, Menus & Design
'Overdrive' template from combosa.com - anyone using it?
seanie_morris:
Slider Question
I have another question on the Overdrive template.
The following code activates the slider in the infobox place holder, but just on the page entitled "Home":
--- Code: ---<?php
$sitename = PAGE_TITLE;
if ($sitename == "Home") {
echo '<div id="infobox">
<div class="relative container">
<div id="slides">
<img src="../overdrive/slider/1.png" alt=""/>
<img src="../overdrive/slider/2.png" alt=""/>
<img src="../overdrive/slider/3.png" alt=""/>
<img src="../overdrive/slider/4.png" alt=""/>
</div>
</div>
</div>';
}
else {
echo '<div id="content_2">';
echo page_content(2);
echo '</div>';
};
?>
--- End code ---
How do I add additional pages to be included? I tried if ($sitename == "Home","Contact") and other variations, but I can't crack it. Repeating the whole code segment, changing "Home" to the other page(s) name(s), and removing the else argument works, but it also adds a couple rows of a white space between header and slider holder.
Would it also make sense to use page ID (PAGE_ID ??) instead? Just to be neater, instead of long threads of page names (some of which are 2 and 3 words long, based on the website's menu).
Seanie.
jacobi22:
Use this
--- Code: ---if (($sitename == "Home") || ($sitename == "Contact")){
--- End code ---
--- Quote ---Would it also make sense to use page ID (PAGE_ID ??) instead? Just to be neater, instead of long threads of page names (some of which are 2 and 3 words long, based on the website's menu).
--- End quote ---
a Page_ID is a Page_ID, its shorter and unique. the code in the top is a solution for 1-3 pages. if you use another variant of this code, its work for all pages, but not on home or contact
--- Code: ---if (($sitename != "Home") || ($sitename != "Contact")){
--- End code ---
if you need more pages, its better to use a shorter select, maybe with in_array like
--- Code: ---<?php // for colored code only
$sMySliderID = array(1,2,4,7,9); // all needed PAGE_ID for the slider
if (in_array(PAGE_ID, $sMySliderID)) {
?>
--- End code ---
seanie_morris:
Spot on Jacobi, that worked a treat (the first option), thanks!
Seanie.
seanie_morris:
I have another idea about using the slider...
Is it possible to create different sliders according to desired pages? At the moment, the code shown relates to just a single slider with the same images appearing on the desired pages. I know that I could in theory just duplicate the template (overdriveA, overdriveB, and so on) and apply the template to the page in question, but there are the obvious drawbacks, such as when I need to edit the template, I need to edit all the copies of it.
Seanie.
Navigation
[0] Message Index
[*] Previous page
Go to full version