Help with Dreamweaver templates

rorybas

New Member
Prime Account
Messages
23
Reaction score
0
Points
1
I think this is the correct forum but apologies if not. I use Dreamweaver and I make good use of Dreamweaver templates so that changes I make to a template ripple through to all pages based on this template - a great timesaver. However, Dreamweaver seems to have a whole in this functionality and it is code outside of <HTML>. It appears that all code outside is either fixed in the tempate or not. So you can not have code that ripples through and have code specific to a page that is based upon the template. Has anyone found a way around this?
Thanks
 

walidno1

New Member
Messages
395
Reaction score
0
Points
0
sorry, but why would u want a part of the code outside <HTML> tag?? Then its not rendered as html by the browser as far as I know. I use templates in Dreamweaver and if u visit my site, u wud see the only thing wrong with it is that its incomplete!!
 

rorybas

New Member
Prime Account
Messages
23
Reaction score
0
Points
1
Hi Walidno1. Server scripting code often goes outside the HTML and sometimes must be outside HTML to work. If you have used Dreamweaver server behaviours (dymamic pages, forms, web applications etc) then you will have added code outside of HTML. I have created a template in the past that had some dynamic content. Then the individual pages have had their own dymamic content. Both require code outside of HTML. So when I have changed the dymamic content on the template I have then had to make the same change to all pages based on the template. I hope that explains it. Thanks
 

walidno1

New Member
Messages
395
Reaction score
0
Points
0
what kind of server side scripting are u talking abt that needs to go to template??
 

rorybas

New Member
Prime Account
Messages
23
Reaction score
0
Points
1
In my last example of an events site I had the next event and news items on each page and thus in the template. Each of these extracted the relevant data from a database. This required Dreamweaver recordset server behaviours. I was using PHP/MySQL as my server model.
 

nuwanpra

New Member
Messages
45
Reaction score
2
Points
0
I'm not much clear on your problem. But as far I know Dreamweaver does not write any lines outside of <html> tag. Except the <!DOCTYPE> tag.

When we are using templates what it does is simply locking all common content of the page. As you specified in .dwt template.

If you want to add javascripts or css styles which will be common to all pages then you can add those to tamplate(.dwt) file. But better to keep those scripts as separate files and just make a like to those in template file. If you put all your scripts on template you will have to update all other pages (which is referring your template) every time you make changes to scripts.

Hope this will help...
 

rorybas

New Member
Prime Account
Messages
23
Reaction score
0
Points
1
Thanks nuwanpra. Dreamweaver (I am using CS3 if that helps) does put code outside of HTML (before <!DOCTYPE> even). It does this with PHP server side code when you choose a server behaviour as I stated in previous messages. I know this because I am always curious as to what code it puts in and I look in code view. I fully understand your point about javascript and css and I would, like you put all in a separate file - indeed that is how Dreamweaver does it for client side scripting such as form field validation. It just seems to add loads of code to the actual file for the server side stuff! The only idea I have heard so far is to copy the code into an server side include file so that changes can be made to the include file rather than every page. However, I was hoping someone would have an even neater solution than that - or that I was just not understanding how to do this. I wonder if the later versions of Dreamweaver are cleaner in this respect. Thanks for your comments.
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
Don't worry about the code outside of the HTML document -- it's not served to the browser; it's processed by the PHP interpreter. (PHP has its own native includes method that works something like SSI, but with a great deal of programmatic control.)

The DW server behaviours are just a set of callable PHP functions that are essentially the same as the ones used in IIS on a Windows server for ASP(X), and so on -- by keeping the same code generation in Dreamweaver and just changing the server behaviour components for different web servers, the DW client has a lot less work to do.

It's what's sent to the browser that counts. If that goes bad, then do a View->Source of the web page and post the rogue code here.
 

walidno1

New Member
Messages
395
Reaction score
0
Points
0
hey, if u have too much problem, here is a thought: until u get the solution, just copy and paste the code for template in those pages and use the code there (without using the template in those pages)
 

rorybas

New Member
Prime Account
Messages
23
Reaction score
0
Points
1
Thanks for the responses.
walidno1. I think copy and pasting to a PHP include file is the simplest option given that DW does not manage this well. I think that is simpler than copy and pasting the changes to every page based upon the template.
essellar. I understand that the code outside of the HTML is processed by the PHP interpreter rather than the browser. I also understand that PHP has its own includes method. Finally, I understand that DW server behaviour are calls to external functions. However, the issue is copying this code to many different pages based upon a template. This is why I will opt for include files.
Thanks
 
Top