I want to be get a template system going where it looks something like this:
html code
{php,
insert custom
data}
end of html
I want the contents within the bracket to be replaced by whatever I want, and everything else to be the same.
I want to be able to send specific variables within, such as:
{type NEWS
color BLUE
font COURIER
}
,which would return news article in color blue with courier font.
After creating the template, it would be saved as an html file with no php code in it.
What's the best way to do this?
Should I use <?php (variables) >? Is there any issue with using <?PHP ?>
multiple times throughout the page?
template system
Moderator: General Moderators
-
jaymoore_299
- Forum Contributor
- Posts: 128
- Joined: Wed May 11, 2005 6:40 pm
- Contact:
... what you want is XML ...
searching the API or google will find you a quick example to get you up and running in 30min.
SimpleXML is really easy, if that is not available use the XML-parser and a function to make it easily read (can be found on php.net usercontributions).
searching the API or google will find you a quick example to get you up and running in 30min.
SimpleXML is really easy, if that is not available use the XML-parser and a function to make it easily read (can be found on php.net usercontributions).
Last edited by Syranide on Fri Jun 03, 2005 2:00 am, edited 1 time in total.
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
If there was a degree of consistency in their use of design patterns, plus a seperation of logic and view, it would be fantastic. Mambo's DB-class for example has some nice ideas & they seperate content and view, but not logic and view. And that's what I find most taxing: their constant mix of logic and view. Thus, while they are, by name, using "templates", they are not implementing the concept and are loosing the benefits by design.
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
Like I said some may find it obscene. However, I think the Mambo example maybe useful to jaymoore_299 because he does not seem to need anything more complex than good ol' PHP scriptlets.patrikG wrote:If there was a degree of consistency in their use of design patterns, plus a seperation of logic and view, it would be fantastic. Mambo's DB-class for example has some nice ideas & they seperate content and view, but not logic and view. And that's what I find most taxing: their constant mix of logic and view. Thus, while they are, by name, using "templates", they are not implementing the concept and are loosing the benefits by design.