How can I code an included template to appear only on two pages?

Thread Solved

Join Date: Mar 2008
Posts: 142
Reputation: mexabet is an unknown quantity at this point 
Solved Threads: 9
mexabet's Avatar
mexabet mexabet is offline Offline
Junior Poster

How can I code an included template to appear only on two pages?

 
0
  #1
Oct 16th, 2009
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:
  1. <?php
  2. //Display slide
  3. include('myfirst.tpl');
  4. ?>
A hint of what I want to achieve is below:
  1. <php
  2. if "list-album"
  3. include('myfirst.tpl')
  4. elseif "list-image"
  5. include('myfirst.tpl')
  6. elseif "list-image"
  7. do nothing
  8. ?>
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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 85
Reputation: Graphix is an unknown quantity at this point 
Solved Threads: 20
Graphix's Avatar
Graphix Graphix is offline Offline
Junior Poster in Training
 
0
  #2
Oct 16th, 2009
Something like this?:

  1. $page = "mypage"; // You enter the page here
  2. if ($page == "list-album") {
  3. include('myfirst.tpl');
  4. }
  5. elseif ($page == "list-image")
  6. {
  7. include('myfirst.tpl');
  8. }
  9. else
  10. {
  11. include("somethingelse.html.inc");
  12. }
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 142
Reputation: mexabet is an unknown quantity at this point 
Solved Threads: 9
mexabet's Avatar
mexabet mexabet is offline Offline
Junior Poster
 
0
  #3
Oct 16th, 2009
Thanks Graphix,

I have managed to fix it, but will keep your code in case of next time.
Originally Posted by Graphix View Post
Something like this?:

  1. $page = "mypage"; // You enter the page here
  2. if ($page == "list-album") {
  3. include('myfirst.tpl');
  4. }
  5. elseif ($page == "list-image")
  6. {
  7. include('myfirst.tpl');
  8. }
  9. else
  10. {
  11. include("somethingelse.html.inc");
  12. }
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC