PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old June 28th, 2002, 09:14 AM
jonathen jonathen is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Essex, UK
Posts: 44 jonathen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Template loading dynamic pages

Hi,

I wonder if anyone can help.

What I am trying to do is use my basic template system to call dynamic pages into the body of the template. So template.php has the basic header/footer includes, and in the body of template.php, I have another include calling body.php. On that page, I want to include some html (an image with some text) which will be displayed between the header & footer.

Now I know how to do this with one page, but I want it to be dynamic. See, I am using a java slideshow on another page (which needs http links) that has thumbnails that when you click on one, it will open the template.php with the default header/footer, and that thumbnail (enlarged) with it's description in the body of template.php. I assume the url to call these from the external slideshow would be (i.e) www.website.com/template/template.php?image#1 or something along those lines.

I can't for the life of me figure out what I need to include to enable this to work. Can anyone help me out please?

Thanks in advance )

Jonathen

Reply With Quote
  #2  
Old June 28th, 2002, 10:18 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Template loading dynamic pages

I'm assuming the easiest way to get what you want accomplished is to use URL variables as you mentioned. In the template.php you should be able to access those URL variables using the HTTP_GET_VARS array for example.

When clicking on the image in your other page it would call your template.php

http://yourwebsite.com/template.php?imagenum=1
echo $HTTP_GET_VARS["imagenum"];
---you should get 1

Then you can pull up the correct body template if you have multiple body templates or pass along those variables to a single body template and make that do all the work of choosing the correct image, html layout, etc..

Hope that helps,
-CBronson


Reply With Quote
  #3  
Old June 28th, 2002, 11:30 AM
jonathen jonathen is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Essex, UK
Posts: 44 jonathen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Template loading dynamic pages

Thanks, that's a great help

Reply With Quote
  #4  
Old June 29th, 2002, 04:14 AM
sethadam1 sethadam1 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Orlando, FL
Posts: 223 sethadam1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Template loading dynamic pages

I do something like this:

if (!empty($page)) {
$pageurl = $page . ".php";
if (file_exists($pageurl)) {
include($pageurl); } }
else {
//do this stuff
}


then you call it like so:

yourserver.com/index.php?page=contact

where contact.php would be the included file...

Reply With Quote
  #5  
Old June 29th, 2002, 04:15 PM
jonathen jonathen is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Essex, UK
Posts: 44 jonathen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Template loading dynamic pages

Thanks for that sethadam1 - I figured a way of calling images, but still need to call .txt files dynamically, so when I saw what you posted, I tried that, but it doesn't display the content of the .txt file when calling template.php?page=1.txt

The code I have used is as you said:

if (!empty($page)) {
$pageurl = $page . ".txt";
if (file_exists($pageurl)) {
include($pageurl); } }
else {
//do this stuff
}

Am I missing something?


Reply With Quote
  #6  
Old July 2nd, 2002, 09:53 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Template loading dynamic pages

this may be a typo but, if you pass '1.txt' then $pageurl will end up being be '1.txt.txt'

and make sure you still have register_globals set to 'on'. otherwise reference $page as $_GET['page']

Reply With Quote
  #7  
Old July 3rd, 2002, 09:45 PM
sethadam1 sethadam1 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Orlando, FL
Posts: 223 sethadam1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: RE: Template loading dynamic pages


Try the same code, you've used and call it like this:

template.php?page=1

Quote:

if (!empty($page)) {
$pageurl = $page . ".txt";
if (file_exists($pageurl)) {
include($pageurl); } }
else {
//do this stuff
}


Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Template loading dynamic pages


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway