|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||
|
|||
|
Template system
I have couple of questions about Writing a Template System in PHP tutorial. I have this template system and now I am wondering how should I get the dynamic content into it. If I have for example 50 pages I have to do a file for each page to folder dat/... page1, page2...page50.
How should I do the dynamic content and links in menu? |
|
#2
|
|||||
|
|||||
|
RE: Template system
That depends on the engine you use, the syntax varies. But, in general, you have a PHP file that takes care of the programming aspect, and sends the results in the form of variables to the template, which is simple HTML with some custom tags for dynamic content. So in reality you would have two files for each page: a .php file and a .tpl (or whatever) page. Here is an example, using Smarty:
PHP file (index.php): php Code:
Template file (index.tpl): {* Smarty *} <html> <head> </head> <body> <h1>Hi, {$name}</h1> </body> </html> <!-- End of index.tpl --> That's the very basic of course. Most template engines can also loop through arrays, perform basic mathematic calculations and so forth. |
|
#3
|
||||
|
||||
|
RE: Template system
Quote:
If you're using the templating class from the tutorial, what I've done is pass a get variable and use that to determine which dat/file to use. -Tim |
![]() |
| Viewing: Codewalkers Forums > Other > Tutorials > Template system |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|