|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Parsing code snippets from database
Problem:
I'm using a template-based system to display pages. What I want to do is make the system extensible by adding objects to a database and then retrieve the objects and output them using a page template. The workflow will look something like this: Call function page function page reads template page function page calls db snippet function page parses template page and inserts code snippet output page parses snippet. So what I want to do is have the user access http://www.domain.com/display.php?id=nnnn display.php reads displaytemplate.html display.php finds <<codesnippetid>> and retrieves the corresponding snippet. replaces <<codesnippetid>> with the code writes this to the browser in a way that allows the snippet to be parsed then. Does anyone have any idea how I could accomplish this easily ? I have a basic framework in place, but my resulting page displays the code instead of the parsed code. Last edited by Kiwi : September 11th, 2002 at 09:45 PM. |
|
#2
|
|||
|
|||
|
Yeah, id like info about this too - for the same reason
Right now I am using strreplace() to replace the code, but that defeats the purpose doesn't it? or maybe im wrong?Cheers, Joe of 4Life ![]()
__________________
Check out 4Life today! |
|
#3
|
|||
|
|||
|
hmm, try creating a class file that handles the templates, create a function to retrive the file name, one to set the parameters and one to create the page.
|
|
#4
|
|||
|
|||
|
Kiwi,
Why not give a template system a try? No need to re-invent the wheel... I use patTemplate for my development, and find it to be an incredible system! There's also Smary, but I haven't used it yet. Check them both out and decide for yourself which is the better system for you.
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#5
|
|||
|
|||
|
Quote:
Thanks, Frankie...funny enough I'd just been looking at smarty and was thinking it may be the best approach, but I'll have a look at patTemplate too. ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Parsing code snippets from database |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|