2

I was having a "discussion" with my manager today about the merits of using PHP includes and functions as a template to build websites more quickly and efficiently. He has been using Dreamweaver templates for years and sees it as really the best way to go. I would like to start using some different and more efficient methods for web creation, because we need to get through our projects faster. I would like to know in detail what would make Dreamweaver dwts better than using code to accomplish the same task, or vice versa.

His reasoning is:

  1. When you change links on the dwt file, it changes links for every page made from that dwt.
  2. Even if you move pages around in directories, it maintains links to images
  3. Everyone in the company should do it one way, and this is the way he chose (there are two of us, with someone who's just started who needs to learn web design from the beginning, and he plans to teacher her the dwt method)
  4. If you edit a site made with a dwt, you can't change anything in the template (it's grayed out), making it safer
  5. If he's building sites with dwt, and I'm doing it with PHP includes, we can't edit each others' sites. It gets all over the place. When we have new employees in the future, it will get all crazy and people can't make changes to others' sites if they're out of the office.

I've been studying PHP these days, and am thrilled with how powerful it is for creating dynamic pages. The site in question which sparked this "discussion" is more or less static, so a dwt would work fine. However, I wanted to stretch my wings a bit, and the code was getting REALLY jumbled as the pages grew. So I chopped off the header, footer, and sidebar, and brought them in to all the pages with a php include, as well as dynamically assigned the title, meta data, and description for each page using variables echoed in the header.The reasons I like this better are:

  1. It's cleaner. If every page contains all the data for the header and footer, as well as the extra tags Dreamweaver throws in there, then I have to sift through everything to find where I need to be.
  2. It's safer. It's sort of like the above reason dwts are safe, except I do all my code editing in a text editor like Coda. So on occasion I have accidentally deleted a dwt-protected line of code because those rules only apply within dreamweaver. I can't chop off part of the header if I can't see it. Incidentally, this makes it easier to identify bugs.
  3. It's modern. I look through source when I see great pages made by designers and design firms I admire. I've never seen dwt tags. I believe by using PHP to dynamically grab files and perform other tasks that keeps me from having to go through and change something on every page, life becomes easier, and keeps things streamlined and up-to-date with current web trends and standards.
  4. It's simple. This should be at the top of the list. Like I said we have to train a new person in how to create for the web. Isn't it much better for her to learn a simple line of PHP and get an understanding for how the language works, rather than learn an entire piece of (not exactly user-friendly) software just for the purpose of keeping her work the exact same as everyone else's? On that note, I believe PHP is a powerful tool in a web designer's arsenal, and it would be a sin to prevent her from learning it for the sake of uniformity.
  5. It's fast. Am I mistaken in my thought that a page build with header and footer includes loads faster than one big page with everything in it? Or does that just apply when the body is loaded dynamically with AJAX?

I did extensive searching on Google and Stack Overflow on this topic and this is the most relevant article I could find:

Why would one use Dreamweaver Templates over PHP or Javascript for templating?

The answer is helpful, but I would really like to understand in more detail why exactly we shouldn't switch to a new method if it's simpler and has more potential. My manager insists that "the result is the same, so if there isn't something that makes me say, 'oh wow that's amazing and much better!', then we should just stay how we are now."

(I do apologize for the length of this question, but the guidelines asked that I be as specific as possible.)

Community
  • 1
  • 1
  • 3
    My personal reasons against DW are: proprietary product lock-in; generally bad quality of generated code; websites are too complex for WYSIWYG tools; if you don't use the WYSIWYG features of DW it's not really the best possible editor. I am staying away from DW as far as I can. Having said that, you *can* produce decent sites in DW. If this is the most efficient way for your company, go for it. There's no absolute answer. – deceze Oct 26 '11 at 06:37
  • Your last point about PHP is wrong. PHP runs on the server side, and returns HTML when it's done. All includes will therefore go in the same HTML document as far as the web browser can tell. Static pages done by DWT is a lot faster (for some definition of "a lot"). – Emil Vikström Oct 26 '11 at 06:38
  • @EmilVikström: Gotcha, that's why I asked "Am I mistaken...". I had a suspicion that was the case but you've cleared it up for me. Thank you! That does still leave the question of the actual creation, but now I know about client-side load speed. Cheers! – DesignUtensil Oct 26 '11 at 07:09
  • I could list probably thousands of "amazing and much better somethings" PHP has over DWT, given that PHP is a legit, platform independent, server side programming language and DWT is just a proprietary method to maintain separate html files for each page (a web dev method which itself is inconvenient and dated to begin with...). Yes, PHP include() is nice, but it hardly qualifies even for the tip of the iceberg when it comes to PHP possibilities. The problem is, I dont know what exactly you might need from PHP, which features are relevant to you and which are not. – Sejanus Oct 26 '11 at 11:30
  • @Sejanus: Thank you for the input. I just started studying PHP recently so I know it really is only the tip of the iceberg, as you succinctly put it. At this point in learning the language I don't know what I don't know, so I'm still discovering new things every day. However, for the purpose of this question, I'm looking to sell my manager on using PHP to make templates that everyone can modify easily. If I'm on a beach somewhere with nothing but notepad and an ftp program, I can easily make changes to the entire site. If I don't have DW and it's all in dwts, I'm boned. – DesignUtensil Oct 26 '11 at 12:12
  • 2
    dream...what? didn't think DreamWeaver still existed. WOAH .. `How You Remind Me, Nickelback` was a hit when I last heard about DW..I know this comment isn't useful...but just wanted to say thanks for the nostalgic feelings.. – sdolgy Oct 26 '11 at 14:33

3 Answers3

1

Like I said in comments, without knowing what exactly sites you are working with it's hard to tell which PHP features are most important to showcase. However, I can try and describe the most simple kind of sites I was dealing with, and where and how PHP came in handy. If you work with something more complicated, the need of programming language may only increase.

The simple website may have a few different pages with text and images. I'm assuming nothing interactive (i.e. no inquiry form), no large amount of structured data (i.e. no product catalog), only one design template which is used by every page with no differences whatsoever. Here's the typical structure:

  • One PHP file (index.php) for handling all sorts of php-ish stuff
  • One design file (template.php for example) for storing everything html-ish (including header, footer and more. Basically all html with placeholders for text and menu)
  • One CSS file for, well, the site CSS
  • Most of the texts are stored in database or (worst case) just txt files. Menu (navigation) is stored in database as well
  • Images folder with all the needed images

The key features here are:

  • Simplicity. You only have as many files and code as you really need to keep things organized and clear
  • Reusability. You can basically copy/paste your php code with little to no changes for a new similar website
  • No duplicates whatsoever.
  • Data and design separation. Wanna change texts, fix typos? You do it without as much as touching design (html) files. Wanna make a completely brand new design for your website? You can do it without even knowing what those texts are or where they are kept.
  • like deceze said, no lock-ins. Use whatever software you like. (Including Dreamweaver)

PHP is responsible for taking texts, menus, design and rendering them all into a web page. If website is in more than 1 language, PHP code choose the right texts for the language of visitors choice.

If texts are stored in database, you don't even need notepad and ftp. You just need, i.e., phpMyAdmin (stored in server) so you can connect directly to database and edit any text you like using only web browser; from anywhere in the world. (I am assuming no real CMS). If you need to add one more page, you connect to database using myAdmin and browser, enter the page name (for menu) in 1 or more languages, enter the text for new page (in 1 or more languages), done! new page created, name placed in the menu, all hyperlinks generated for you. If you need to remove a page, you connect to database and click delete. If you need to hide a page for a while (i.e. for proof reading before publishing), you connect to database and uncheck "published" box.

All this doesn't come with just using database ofcourse, you need to program these features with PHP. It may take about 1 - 3 hours depending on experience and the code is fully reusable for every similar website in the future. Basically you just copy/paste php file, copy/paste database tables, enter new text and menu into database, put placeholders into your html file and done! brand new site created.

Which immediately makes most of the reasoning for DWT irrelevant. You don't move files around because you have only one html file and no directories, you don't need grayed out template because texts/images (content) and template are not even in the same file, there's no such thing as changing links in dwt file because it's PHP that generates them on the fly (these are not real links to real html files but rather links with parameters to tell PHP which exactly page must be rendered.. because remember we have just 1 file). The bottom line is, comparing features of the two side by side is like comparing features of a sword vs machinegun. Sharpness and length of the blade concepts are meaningless in a case of machinegun; while lifetime sword user won't really get the meaning of velocity and caliber before he tries and uses machinegun. And yet, while you can't compare their features one by one, no one brings sword to a gunfight for a reason :)

As for #3, currently there are many more people working with PHP than DWT (in a case you will need more employees in the future, or if other people will need to work with your websites later, etc.) As for #5, you can edit PHP websites with Dreamweaver as fine as DWT websites.

That's just off the top of my head. I wrote this in my lunch break so I likely forgot or missed quite a few things. I hope you will get a proper answer with detailed DWT vs PHP comparison too.

Sejanus
  • 3,253
  • 8
  • 39
  • 52
  • @Sejanus Wow. I can't thank you enough for taking time out of your lunch to write that up. I tried to high-five you just now but it just made my display all smeary. The situation from which the dialogue with my manager began was my use of PHP's include() to make a "template" for a cluttered site. I say "template" insofar that it merely separates sections such as the header, footer, and sidebar, from the main code for ease of updating, etc. But you're right, PHP is heaps deeper than that and your description excited the hell out of me to learn more. – DesignUtensil Oct 27 '11 at 07:33
  • Out of curiosity, Sejanus, I've been searching good places to learn more advanced template-making techniques in PHP like the process you described, but haven't found anything quite like that yet. I reckon I'm not using the right search terms. Do you think you could point me in a general direction where I could study up on that area of PHP use? Many thanks again! – DesignUtensil Oct 27 '11 at 07:37
  • @ DesignUtensil: you can try googling for Model-View-Controller (MVC) architecture. It does require some PHP knowledge, though. If you are beginner programmer, I'd suggest learning PHP basics first (storing/retrieving data from mySQL or other database, conditionals, writing your own functions, OOP, etc). In process you will find lots of different ways to make templating more efficient than just include 'header.html'; leave alone that DWT nonsense. – Sejanus Oct 27 '11 at 12:03
1

You simply can't compare PHP vs. DWT.
PHP is a programming language, where templating is just one of it's numerous features, and DWT is just a silly proprietary system to build simple web pages.

there is actually nothing to compare.

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
  • First, it's not proprietary. Second, PHP is chosen as the base for a site because it's great at templating, and choosing how to template a website is a MAJOR step that needs to be decided on before work begins. PHP does have many more features, but there is certainly something to compare when it comes to templating ability. – ndm13 Jun 06 '14 at 20:24
1

I would say that using DWT templates over PHP do have some advantages.

  • It does not need any extra server-side process, like PHP to process the files at the server.
  • You can serve all files to the user as .html files rather than .php files, though I suspect that it is possible to hide the .php extension. Why should any user see anything other than .html?
  • You don't have to learn PHP syntax/programming. It is true that you can do more with PHP that plain .dwt files but for plain templating the .dwt files can be just as clean.
  • It is not true that .dwt files are a lock-in technology. The feature is also implemented by other web editors, e.g. Microsoft Expression Web.
Michael S.
  • 95
  • 1
  • 7
  • Thank you for mentioning that DWT isn't locked-in! I came here to decide whether to go with PHP or DWT for the website I'm making in Expression Web 4. I don't know what other editors support it, but I'm sure there are some. Although I disagree with the extensions bit. Why would the user need to see any extension at all? Many MANY websites hide extensions and users seem to prefer that. But if you aren't careful, there are people that can attack PHP that couldn't if it was just DWT. – ndm13 Jun 06 '14 at 20:20