| | |
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 |
Tag cloud for PHP
.htaccess access ajax apache api array autocomplete beginner binary broken cakephp checkbox class cms code cron curl database dataentry date directory display download dynamic echo email emptydisplayvalue error errors explodefunction file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla keywords limit link login loop mail menu mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion recursive regex remote script search server sessions shot sms soap source space sql structure subscription syntax system table tutorial tutorials update upload url validation validator variable video web xml youtube





