Home Download Buy Blog Forum Support

How to do Dreamweaver-style HTML templates?

How to do Dreamweaver-style HTML templates?

Postby Axer on Wed Dec 26, 2012 9:20 pm

So I recently switched over to Sublime Text 2, loving it so far. One thing I loved about Dreamweaver was its templates feature. I make a lot of large websites for clients and DW's built-in template system (.dwt files) was fantastic for it. I know Sublime Text 2 has snippets, but do they offer all the dynamic functionalities that the .DWT files do?

I like the snippets feature and the tab trigger options for instantly importing code, but what if I want to control specific elements? For example, say I made a giant navigation bar with sub-navigations for each one and made a snippet out of it. Then I import it into other pages on my site via the tab trigger. Now what if the client wants one of the names for the sub-navigation changed to something else? I'm going to have to change it on every single page, right? Or will just changing it in the snippet file update all the pages?

I'm very used to Dreamweaver's template system and I'm wondering if Sublime Text 2's snippets feature is powerful enough to handle that kind of dynamic functionality and whether or not it's capable of updating one template element across all the pages (that the template is applied to) on the fly.

Any advice/tips/suggestions appreciated.
Axer
 
Posts: 1
Joined: Wed Dec 26, 2012 9:13 pm

Re: How to do Dreamweaver-style HTML templates?

Postby svenax on Fri Dec 28, 2012 10:19 am

Sublime snippets are not dynamic in that way. Once inserted in a document, they expand to plain text. I don't know if something similar to DW templates exist.

But if you like how DreamWeaver does it, and already are using such functionality, why do you want to switch?
svenax
 
Posts: 151
Joined: Tue Dec 20, 2011 12:47 pm

Re: How to do Dreamweaver-style HTML templates?

Postby PinnacleWebDesign on Fri Dec 28, 2012 2:09 pm

What I do is to use server side includes [http://en.wikipedia.org/wiki/Server_Side_Includes] to handle the sections of code, such as menus or footers, that are common across a site, so, for example, in your page you add the menu using something like this:

Code: Select all
<?php require_once('includes/navigation.inc.php'); ?>


My navigation.inc.php file (I use the .inc in the file name just to signify that it is an 'include') would contain this:

Code: Select all
   <div id="nav">
      <ul>
         <li><a href="/index.php" title="Home">Home</a></li>
         <li><a href="/about.php" title="About Us">About Us</a></li>
         <li><a href="/services.php" title="Services">Services</a></li>
         <li><a href="/contact.php" title="Contact">Contact</a></li>
      </ul>
   </div>


HTH

Cheers,
Mick
PinnacleWebDesign
 
Posts: 33
Joined: Sun Aug 09, 2009 6:43 pm
Location: UK

Re: How to do Dreamweaver-style HTML templates?

Postby amphetamine on Sat Dec 29, 2012 3:58 am

You could perhaps hack something vaguely similar together with snippets and macros but in the general case, templating to that extent is way outside the domain of a text editor.

Anyway, the last poster was bang on. I'd go even further and say that any other method of doing it is actually wrong (substandard at the very least). Don't rely on your editing software to maintain consistent static pages for you. It's cumbersome and, beyond a certain point, practically untenable.
amphetamine
 
Posts: 23
Joined: Fri Dec 14, 2012 8:59 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 37 guests