Question for hand-coders

uoba

Re: member
Since I've delved into XHTML and CSS, my reliance upon DWMX has decreased (mainly because I use straight MX, and for most of the CSS I do, it cannot render correctly (and MX2004 is too slow)).

I'm happy to be able to free myself, and also to use it when necessary. However, one interesting thought came to my mind...

How do hand-coders deal with templates? Templates obviously save a lot of time. I change one part of the code in a template, the changes occur in the linked files.

How do you handle this with hand coding? Am I being naïve? :confused:
 
I use my free PHP-enabled web host of choice, Host Ultra, and simply upload the files every time I change something. However, I'm not sure what kind of template you're using, so this may be different for you... what kind of file are you using for your template?
 
Well, since I don't know any other way at present, all templates are done in DWMX. Hence, they would be .dwt files (normally a master html file located in a template folder in the root directory)

What I need to understand is, whether the way DW does templates, is the same way in standard (X)HTML.
 
I personally use Find & Replace in BBEdit, which has a multifile find/replace capability.

Eg: I want to change my copyright date in my whole website.

I open BBEdit, Find and Replace.
Find: (c)2002 Replace (c)2003
Multifile search checkbox: checked.
Multifile criterion: Website (which automatically searches a whole folder, incl. nested ones if precised).

You can have multiple websites. Read more: http://www.barebones.com/products/bbedit/features.shtml
 
For things like nav bars, footer text, etc that is on every page, you could either
a) use a bit of php to: include the footer, header, whatever in each page, or make a master page (index.php) and use ?page=whatever links to tell it which page to include in the content area
b) use some javascript to do either of the above
 
Thnx guys.

Pengu, your PHP suggestion was like a slap in the face to wake me up! Of course! I should realised!

The great thing about using the PHP include as well is that you don't have to rely on unneeded code as in dw templates (i.e. the referenced code/page doesn't need all the html. head etc. tags).

Nice. :)
 
I don't like using ?page= for includes,
I use the Require Include code in PHP.

I basically design the layout as a straight-up PHP page, keeping in mind how I want to break it up (nav bar, header, footer, content, etc.).

I then create new files and copy 'n paste the sections I want into each file and name them appropriately (usually something like nav.inc.php).

Then the main index file and all the files that don't have the inc in the filename simply have nothing but a bunch of the require include codes calling each file.

I love PHP! I just wish I knew more than I do about it. :p
 
If you use bbedit there is a pretty good templating system built in. You can just use #bbinclude <file> or something, and bbedit includes the file. It's neat, but then <?php include="<file>"?> works just fine too.
And toast - in BBEdit 7 you can use #yearnum# instead of writing the year, And it will change automatically (I think you just need to open up the file on new years - it can't be completely automatic...)
 
I suppose using the #bbinclude becomes another proprietary bit of code again though? Just as DW.
 
Yeah, but the only non proprietary solution is copy and paste, am I wrong? Using php seems to be the least most versatile, but which ever method you chose you end up with mostly the same result.
 
As long as I can get my head around the php way, I will hopefully stick with it (since our main developer likes to do it this way also, so it'll keep me up to speed with him!)

I dunno, I sort of see the php route as perhaps being more versatile, just a little bit trickier.
 
Thnx Pengu, I may take you up on that during the dark hours of a lonely night developing away! ;)
 
I, too, prefer to use the PHP method, though I prefer to have everything in one file called "template.php" as it makes it easier to maintain.

This is from a file I use called "HTML PHP Page Template":
PHP:
<?
require( "./extras/template.php" );
$title="";
begin( $title );
?>




<!-- Replace this comment with content. -->




<?

terminate();
?>
So in my template.php files I have 2 master functions called "begin( $title='' )" and "terminate()". I tried calling it "end()" but the PHP server didn't seem to like that.

By the way, feel free to use this as a template for your own pages.
 
Smarty is a great template engine for PHP. It saves so much time when working with dynamic pages. If you have pages mainly built up of content processed by PHP this is a lifesaver!

Check it out: http://smarty.php.net/
 
Great thanks Claruz, will have a look (would rather do it manually, but this'll help out by looking at how it works)...
 
I use Dreamweaver, and could care less if it renders in design mode or not. All I use it for is it's code coloring and file management abilities when dealing with XHTML & CSS.

MX2004 trial is much faster than MX on the Win platform, and seems the same for me (maybe a bit faster actually) on my Mac.
 
MX 2004 seems hella slow for me, even in code view... have ordered BBEdit 7 for it fantastic code working.
 
I use ProjectBuilder for HTML coding. It's just great to have everything in one window. I also downloaded an extra for PB that gives me colour coding in HTML and PHP! It's as good (if not better, with the project view) as BBEdit and it's free :) Nothing against BBEdit, I have BBEdit lite and love it, but I can do what I want for free with PB.
 
Back
Top