943,940 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 516
  • PHP RSS
Oct 16th, 2009
0

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

Expand Post »
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 Syntax (Toggle Plain Text)
  1. <?php
  2. //Display slide
  3. include('myfirst.tpl');
  4. ?>
A hint of what I want to achieve is below:
PHP Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 16
Solved Threads: 9
Junior Poster
mexabet is offline Offline
148 posts
since Mar 2008
Oct 16th, 2009
0
Re: How can I code an included template to appear only on two pages?
Something like this?:

PHP Syntax (Toggle Plain Text)
  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. }
Reputation Points: 82
Solved Threads: 74
Posting Pro in Training
Graphix is offline Offline
401 posts
since Aug 2009
Oct 16th, 2009
0
Re: How can I code an included template to appear only on two pages?
Thanks Graphix,

I have managed to fix it, but will keep your code in case of next time.
Click to Expand / Collapse  Quote originally posted by Graphix ...
Something like this?:

PHP Syntax (Toggle Plain Text)
  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. }
Reputation Points: 16
Solved Threads: 9
Junior Poster
mexabet is offline Offline
148 posts
since Mar 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: going mad now mysql db password change fails
Next Thread in PHP Forum Timeline: PHP Form without Java





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC