I need help to make an included template to appear only on two pages and not on other pages of a photo album. Can someone help me out on how to use the "elseif" statement to accomplish this?
Right now template file appears on every page, which is not what I want. This is what I've got so far:

<?php
//Display slide
include('myfirst.tpl');
?>

A hint of what I want to achieve is below:

<php
if "list-album"
include('myfirst.tpl')
elseif "list-image"
include('myfirst.tpl')
elseif "list-image"
do nothing
?>

The script uses $_GET method. The pages are "list-album", "list-image" and "image-detail". I want the template to be show on "list-album" and "list-image", but not on "image-detail". Any help will be appreciated.

Recommended Answers

All 2 Replies

Something like this?:

$page = "mypage"; // You enter the page here
if ($page == "list-album") {
include('myfirst.tpl');
} 
elseif ($page == "list-image") 
{
include('myfirst.tpl');
} 
else 
{
include("somethingelse.html.inc");
}

Thanks Graphix,

I have managed to fix it, but will keep your code in case of next time.

Something like this?:

$page = "mypage"; // You enter the page here
if ($page == "list-album") {
include('myfirst.tpl');
} 
elseif ($page == "list-image") 
{
include('myfirst.tpl');
} 
else 
{
include("somethingelse.html.inc");
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.