Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Help with template class
Old 04-06-2005, 05:48 PM Help with template class
Python's Avatar
Ultra Talker

Latest Blog Post:
A new site is launched
Posts: 374
Trades: 0
Hi... I could do with some help with PHP...

Basically Im building a template class which I have now finished.. its fairly simple though.

At the moment ive dne it so that i use tags like {TITLE} into the template and these work fine... however i need something more complex...

At the moment i define these tags with an array.. It is:

PHP Code:
$tags=array(
'TITLE'=>'This is my title',
'WELCOME'=>'This is my welcome message'
); 
Now what I want to do is to be able to put in my template the tag {LISTUSERS}

This needs to then output a table which has got a list of all the users in a mysql database... kind of like a while statement.

How can I do this?

Thanks
__________________

Please login or register to view this content. Registration is FREE

- Affordable web site design solutions
Python is offline
Reply With Quote
View Public Profile Visit Python's homepage!
 
 
Register now for full access!
Old 04-07-2005, 08:10 AM
ibbo's Avatar
Super Spam Talker

Posts: 880
Location: Leeds UK
Trades: 0
Why not just download one of the tried and tested templates from sourceforge.

I use XTemplate and it has all this stuff you need boxed off nicely. Xtemplate allows you to assign tags and parse blocks giving you a truely flexible framework for your pages.

XTemple pregs around for <!-- BEGIN: and <!-- END: blocks (you can even nest these.
So an example would be.
Code:
<!-- BEGIN: main -->
<!-- BEGIN: body -->
 {value}
<!-- BEGIN: body -->
<!-- END: main -->
I think that other template systems work in a similar fashion but to be honest I have never bothered to trying them.

Ibbo
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Linux user #349545 :
(GNU/Linux)iD8DBQBAzWjX+MZAIjBWXGURAmflAKCntuBbuKCWenpm XoA7LNydllVQOwCf
ibbo is offline
Reply With Quote
View Public Profile Visit ibbo's homepage!
 
Old 04-07-2005, 10:46 AM
Python's Avatar
Ultra Talker

Latest Blog Post:
A new site is launched
Posts: 374
Trades: 0
Well yes there is the option to use a templating system but id like to know myself how its done... just for learning sake...

I probably will end up using some sort of prebuilt templating engine but id just like to know how its done...
__________________

Please login or register to view this content. Registration is FREE

- Affordable web site design solutions
Python is offline
Reply With Quote
View Public Profile Visit Python's homepage!
 
Old 04-07-2005, 10:51 AM
ibbo's Avatar
Super Spam Talker

Posts: 880
Location: Leeds UK
Trades: 0
Then check out a sample one from sourceforge.

I'm sure after trawling through 2 or 3 of them you will get the jist of how they go about it.

Ibbo
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Linux user #349545 :
(GNU/Linux)iD8DBQBAzWjX+MZAIjBWXGURAmflAKCntuBbuKCWenpm XoA7LNydllVQOwCf
ibbo is offline
Reply With Quote
View Public Profile Visit ibbo's homepage!
 
Old 04-07-2005, 12:40 PM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Trades: 0
Templating is one of the things I have not had much experience with. If there was one engine I would use its one called patTemplate. There is a good devshed article here:
http://www.devarticles.com/c/a/PHP/S...th-PatTemplate

and you can visit the patTemplate site here:
http://www.php-tools.de/site.php

Sorry I can't be more help. Maybe you can check out the patTemplate code for more help.

-dk
__________________
Did I help you? If so, be nice and throw me some
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
dk01 is offline
Reply With Quote
View Public Profile
 
Old 04-07-2005, 01:11 PM
pitbull82's Avatar
Super Talker

Posts: 147
Name: Marcin Nabiałek
Location: Poland, Częstochowa
Trades: 0
I haven't had much experience with templates either. However Python everything depends on what you want - do you want to develop your PHP and that's why you've been writing template class or simple you want to use templates in your project?

If you want to simple use them in the project, I recommend you SMARTY: http://smarty.php.net - it's the most popular and powerful template class in PHP and therefore when you learn and understand how it works I think, that you'll be able to understand any other template classes.

Notice also, that in future SMARTY might become a part of standard PHP and that's the reason why it's sensible to choose that templates...
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
pitbull82 is offline
Reply With Quote
View Public Profile Visit pitbull82's homepage!
 
Reply     « Reply to Help with template class
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23186 seconds with 12 queries