SunQuest
           Tutorials
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOtherTutorials

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:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old February 24th, 2004, 05:23 AM
leandro leandro is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 leandro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
About Template System in PHP

Hi all,

I'm newbie in PHP (#1 language) and new user in Forum Codewalkers. I'm studying through scripts commented, all information in web and Codewalkers too.

After read the tutorial I had a doubt, but I did not find a solution in messages the forum.

My site will be very small. It will have only one glossary, a form for contact and a small news system.

The Script templating engine (by Timothy Boronczyk. Url: http://codewalkers.com/tutorials/58/1.html) works fine with my layout in HTML, but I'dont know where I use the my scripts (Glossary, Form FeedBack and News) with the template engine.

Example:

For test I created 2 files (get IP and Agent browser of the user):

user_info/ip.php
-------
php Code:
Original - php Code
  1. <?php echo "$REMOTE_ADDR";
  2. echo "<br><br>";
  3. echo "<a href="/user_info/agent.php">ver info browser</a>";
  4. ?>



user_info/agent.php
-------
php Code:
Original - php Code
  1. <?php
  2. echo "$HTTP_USER_AGENT";
  3. echo "<br><br>";
  4. echo "<a href="/user_info/ip.php">ver IP</a>";
  5. ?>


How use the templating engine for theses files, for example? And my scripts?

Reply With Quote
  #2  
Old February 25th, 2004, 07:37 PM
bluephoenix's Avatar
bluephoenix bluephoenix is offline
Levelheaded Curmudgeon
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Syracuse, NY
Posts: 507 bluephoenix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 13 m 2 sec
Reputation Power: 2
Send a message via AIM to bluephoenix
RE: About Template System in PHP

The templating script is written so that you are not limited to including just html or text files. You can use it to include other PHP files, also.

For example:
php Code:
Original - php Code
  1. <?php
  2. require_once('lib/template.php');
  3.  
  4. $page = new Page('std.tpl');
  5.  
  6. $page->replace_tags(array(
  7. 'ip' => 'user_info/ip.php',
  8. 'agent' => 'user_info/agent.php',
  9. 'menu' => 'dat/menu.html',
  10. 'content' => 'dat/content.html',
  11. 'footer' => 'dat/footer.php'
  12. ));
  13.  
  14. $page->output();
  15. ?>


... and then be sure to define your include macros in your template file ({ip} and {agent}).

Reply With Quote
  #3  
Old February 28th, 2004, 03:58 AM
leandro leandro is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 leandro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: About Template System in PHP

humm! Thank you very much, bluephoenix!

Reply With Quote
  #4  
Old February 29th, 2004, 11:25 PM
bluephoenix's Avatar
bluephoenix bluephoenix is offline
Levelheaded Curmudgeon
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Syracuse, NY
Posts: 507 bluephoenix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 13 m 2 sec
Reputation Power: 2
Send a message via AIM to bluephoenix
RE: About Template System in PHP

You're welcome ;)

Reply With Quote
Reply

Viewing: Codewalkers ForumsOtherTutorials > About Template System in PHP


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 5 hosted by Hostway