Dynamic Templates |
Site Admin
|
Hi,
I'm sorry I didn't work in Dreamweaver for very long time... So probably I miss something, could you tell me in more details how the templates should work ? Would be fine to see a sample or two |
||||||||||||
|
|
Hi ddmitrie,
I totally understand and don't blame you. OK, well maybe if I describe the setup I'm using, it might be clearer. I have 3 levels:
Now, when I make a change to a top level template and I save the template, that change is automatically reflected in all the second level templates and third level pages that are linked to that top level template. Obviously, there can be more or less than the three levels that I use. What DW does to keep track of which parts of a page belong to the template is to insert it's own template comments into each page that is based on a template. They are:
That's pretty much all there is to it. Now, whenever a template is changed, DW scans the website for all the pages that refer to the template and replaces all the template text in each page. There are a some other features it includes which do make the template feature flexible (these are options on a menu):
I hope my explanation wasn't too long winded. I've given an example of each level below, so you can see how it all fits together: This is a top level template (called mainpage.dwt):
This is a second level template (called about.dwt):
This is a template-dependent page (called about.htm):
DebbieLeigh |
||||||||||||||||||
|
Guest
|
Looks resonable. Okay, suppose you made a linked list like this t1->t2->t3 and you need to see the resulted page. When and what tool does create the final html or php file ?
On the other hand, I think that Smarty is the best template-oriented way for PHP developers. Why don't you use Smarty ? |
||||||||||||
|
Dynamic Templates |
|
Hi ddmitrie,
Think of it more as a specialised find and replace function, which is really all that it is, rather than Smarty-like templates. It works on the content part of the pages (i.e. the bit containing the html rather than the bit containing the code). I only recently came across Smarty and do agree that it is a very good concept and tool to use. However, I have always designed my applications with modularisation and separation of logic from content in mind, so my website already does what Smarty does anyway. But even Smarty doesn't have this find/replace template functionality as it's not really designed for that. I modularise and parameterise a lot of the content of my pages similar to the way Smarty works, however I've found there are certain things, like layouts, that don't lend themselves easily to modularising, which is where this template functionality real comes into it's own. So to answer your question, relating the example you gave (t1->t2->t3) to my example:
So if I changed, say, the attributes of a table in t1 and saved t1, then the same table in t2 would be automatically changed and so would all the t3 level pages that are based on the t2 template. If I changed something in t2, t1 wouldn't be affected, but all the t3 pages would be changed. There is no 'tool' that creates the final page as all the pages are just normal html/php pages. As I said earlier, this is just a find/replace tool that helps enormously in the maintenance of websites. I'm not sure whether that's clear enough, but I can't think how else to explain it. DebbieLeigh |
||||||||||||
|
Guest
|
smarty rocks
|
||||||||||||
|
|
Here's a big tip I just spent hours figuring out...
Notice that in this example, you could not actually specify the Onload attribute in a page created from the second level template. In order to do this, you need to the second-level nested template and select Modify, Template Properties... and then check "Allow nested templates to control this" |
||||||||||||
_________________ A2 |
Dynamic Templates |
|
||
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by