| | |
How can I code an included template to appear only on two pages?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
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:
A hint of what I want to achieve is below:
The script uses $_GET['page'] 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.
Right now template file appears on every page, which is not what I want. This is what I've got so far:
PHP Syntax (Toggle Plain Text)
<?php //Display slide include('myfirst.tpl'); ?>
PHP Syntax (Toggle Plain Text)
<php if "list-album" include('myfirst.tpl') elseif "list-image" include('myfirst.tpl') elseif "list-image" do nothing ?>
0
#2 Oct 16th, 2009
Something like this?:
PHP Syntax (Toggle Plain Text)
$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"); }
0
#3 Oct 16th, 2009
Thanks Graphix,
I have managed to fix it, but will keep your code in case of next time.
I have managed to fix it, but will keep your code in case of next time.
•
•
•
•
Something like this?:
PHP Syntax (Toggle Plain Text)
$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"); }
![]() |
Similar Threads
- Can I use a template html page within another html page (Site Layout and Usability)
- PHP Navigation help please (PHP)
- CSS Template Edit Problem (HTML and CSS)
- Upadating ASP site designing. (ASP)
- Design template related problem (ASP.NET)
- urgent: session timeout occurs unexpectedly(given both web.config & global.asax code) (ASP.NET)
- How to code a friend template function? (C++)
Other Threads in the PHP Forum
- Previous Thread: going mad now mysql db password change fails
- Next Thread: PHP Form without Java
| Thread Tools | Search this Thread |
.htaccess alerts apache api archive array autocomplete beginner binary broken cakephp checkbox class cms code convert cron curl database dataentry date display duplicates dynamic echo email emptydisplayvalue error errors execute explodefunction file files firstoptioninphpdroplist folder form forms function functions google hack href htaccess html htmlspecialchars image include insert ip javascript joomla keywords limit link login loop mail menu methods mlm multiple mysql network object oop paypal pdf php problem query radio random recursion recursive redirect remote script search securephp server sessions shot sms source space sql subscription syntax system table tutorial tutorials update upload url validator variable video web youtube





