![]() |
|
#1
|
||||
|
||||
patTemplate Templating Engine!?Well, thanks to a wonderful little patTemplate built in function called dumped I have finally figured out the basics of how to use this thing. I am still a bit stumpued however as to how to use my php functions within the template scheme, I mean, I have a function that includes different pages onto the site...this was my attempt at a rudimentary templating system of my own. Basically it uses a BUNCH of tables to create a static look at the top and left of the site while the white section on the bottom right changes depending on what url is requested, all pages go through the main page like: index.php?page=privpol will load the privacy policy in that white section, I would like to continue using this scheme within the template system if possible, if not well...no big deal, I still need to know how to call functions from within the template though...I don't really care HOW it get's done right this minute, I just need to get this site converted to templates before it gets too complex...any help would be muchly loved! Thanks folks!
|
||||
|
#2
|
||||
|
||||
|
If you're simply including FILES as different pages, then all you could do (without too much changes to your code) is to output the resulting html (of your include files) into a variable using ob_start() and friends...
Perhaps something like this: PHP Code:
I really don't know if this would work since I didn't test it out but I think you get the gist of it? TIP: Look at the patTemplate class file Elm, change all occurences of eregi() (I think it was) to preg_replace() for a NICE speed gain! __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#3
|
||||
|
||||
|
Hmmm...I'll definately look into that, but I am also using patDBC for my DB Extraction layer and I now have another problem, using the tutorial on the patTemplate web site about using DB's there was something missing from it that I REALLY NEED to have...how do I pass a variable (from the db) through another function BEFORE sending it to the template engine to be parsed, like I have a date in the DB wich is a unix timestamp, I need to have that passed through the date function before being displayed and same thing with the main news, it needs to be passed through bb_decode first...
|
|
#4
|
||||
|
||||
|
What do you mean by DB Extraction layer? If it means, using a class file to do all the db connections and such; I use my own, so I never looked nor have I had any experience using patDBC.
PHP Code:
INDEX.TMPL could look something like this HTML Code:
It's hard to figure out what you mean by functions in your post, so hopefully you have some sample code we can discuss it over. For formatting dates from MySQL, I prefer: Formatting Dates in MySQL this way. If you have better ideas, feel free to discuss them, I am also STILL learning. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#5
|
||||
|
||||
|
Hmmm...yeah I got this far, but my problem is certain rows need to be parsed by other functions BEFORE turning them into patTemplate variables, so would something like this work?:
PHP Code:
|
|
#6
|
||||
|
||||
|
sure... they would!
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
Recent GIDBlog
Accepted for Ph.D. program by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Please list your site on my search engine | jake2003 | Search Engine Optimization Forum | 5 | 18-Dec-2003 14:46 |
| How a search engine really works (In english) | jrobbio | Open Discussion Forum | 0 | 06-Jul-2003 18:13 |
| Search engine optimization bookmarklets | jrobbio | Search Engine Optimization Forum | 0 | 01-Jul-2003 15:15 |
| Search engine optimization tips and my experiences | jrobbio | Search Engine Optimization Forum | 3 | 20-Apr-2003 18:38 |
| Workaround to make portal website search engine friendly | jrobbio | Web Design Forum | 11 | 10-Feb-2003 17:25 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The