University Web Developers

University Web Developers

This is related to the Western Michigan University web site.

The entire university uses a dreamweaver template, so any time I want to change a menu item, or an address, I have to change and re-upload all fifty pages in the site I run.

So I took it out of the template, cut the template into three parts, and named the top top.php and the bottom end.php.

Then, on each page, instead of having all the template code, I just have

{?PHP include ('top.php') ?}

content content content content
content
content
content

{?PHP include('end.php') ?}



This seems to work pretty well (compare this page, which uses it, with this page, which doesn't), but I'd like some input before I start using it with more popular pages.

For more documentation, go here

Tags: help, include, php

Views: 1

Reply to This

Replies to This Discussion

That's similar to a technique I used to use on an old site I used to run. I never had any real problems with it. I might recommend adding in some error checking though, so if for some reason one of those files doesn't exist or such, it will load some kind of default.

I can't testify to if there is a way more secure than this (assuming this is insecure, which I don't think it really is), but I know it never gave me problems.
I use that same method. Works great and saves time. You might consider breaking up your template into smaller includes. We have includes for our main menu, quickjump, search, sidemenu and footer links. This way I can have several different dreamweaver templates, but have the same includes on each. You can have variety and still be synched up in the important areas.

If you think you might use something besides PHP, you should used the the .inc extension instead of .php. We mainly use ASP.Net, but we also do a little PHP. Incs keep us from having to make different versions of the same include. The only problem with an inc file is that you can't use Dreamweaver's design mode with it, which may not be an issue for you. I think you can also do htm and html extensions for includes.

Side note - In case you don't already know, Incs are viewable through the browser, so if you plan to have php code included that has database connection passwords you should use a php extension, and store it in a secure location.

@Michael - Did you find a more efficient method?
Heh, yeah, a CMS. Hehe.

When I first started SuperSatellite like 6 years ago, it had a completely different purpose from what I use it for today (now just my blog, running Wordpress). Back then I was just getting started on the hardcore webmaster stuff, and one of the first things I pursued was creating a templating script to get me away from static pages. Just something like Sam was talking about, drop a header and footer onto pages so I didn't have to keep track of them all manually. I used it in conjunction with a CGI news script called Coranto to produce news files and ID arrays that effectively came together as a simplistic CMS. It wasn't long after that real CMS's started getting pretty good though, and the CGI script for news I was using wasn't very reliable.

Basically I had a file, view.php, that served as the page builder. It then took a variable called "page," checked it against the news ID array, and loaded the proper news file, which was basic HTML output by the CGI script. So it'd be like http://www.domain.com/view.php?page=home, home would reference an ID (a random 24 character string, this protected against file injection), and the ID would link to the news file. This had the advantage that the news files themselves didn't even need includes in them, since view.php read them in. Today, I'd probably use mod_rewrite though with simple URIs in place of variable laden URIs.

Actually, I still have backups of the old version of the site, I'd be happy to share my code if it interests anyone. Just understand that it was quite literally my first foray into PHP coding, and I haven't even touched it in probably 5 years (nor do I have interest in it, since I don't need it for anything, so if there are bugs, then there are bugs. I bet there are bugs :D ).
One method that does work with Dreamweaver's Design mode is the server-side include. It does precisely the same thing you're trying to do, except it doesn't require PHP to run.



Gotcha #1: You need support from your Web server, and the server might need to be configured to use it. I think Apache has had this forever, but by default config used to only work with the .shtml extension. You would also need Options Includes in the folder you're running (which might be set by default, or which you might be able to turn on with an .htaccess file, again, in Apache).

Gotcha #2: If you need to run PHP, then I don't think SSIs are strictly compatible with the PHP environment. They didn't traditionally work with CGI output, either. That said, I believe Apache 2 is able to place multiple filters on a file before it is sent to the browser, so it might be a configuration thing and not a true limitation any more.

I've been using SSI for templates for 9+ years. It's worked well enough we're having trouble justifying a Web CMS.
We are using SSI's right now on our current generation web templates.

Gotcha #3: They don't work across subdomains (at least in our case, but I'm 90% sure that's a limitation of SSIs, and not settings)

SSIs are a very good stopgap solution though since it's so lightweight.
You could make it work across domains on the same box with symbolic links or aliased/virtual folders. You could just add a copy of the include files on each domain, too. (Probably not worth it if your entire site structure gives every office or department its own domain.)

My favorite all-time SSI use was to set up a virtual host on the server with the same site root folder, but using an alias for the template folder where all the SSI goodies were. Instant site upgrade preview.

As for use across domains, I think you can put a fully-qualified URL as a PHP include, right?

<?php include('http://www.someplace.edu/template/top.ssi'); ?>

RSS

Elsewhere

Latest Activity

Profile IconBilly McDonald and Meg Thomas joined University Web Developers
Monday
Daniel Bashaw replied to Kimbel Jeffers's discussion Office Reservation software
"Hi Kimbel -- Does you manual process include a checklist and workflow documentation? If not, it sounds to me like checklists and schedulers are your best next steps. You can structure and document what you do now, and then look at it to see if there…"
Friday
Kimbel Jeffers replied to Kimbel Jeffers's discussion Office Reservation software
"The problem is we use a manual process right now and things keep falling through the cracks."
Thursday
Annette Spearman replied to Derek Tonn's discussion Freelance web design recommendations (small projects)
"Hi Derek, We can help you! I'll in box you all my info so we can connect and set up some time to talk. Annette "
Thursday
Mark Rothbaum posted a discussion

5-Minute Survey on Use of Facebook in Admissions

We're conducting our annual survey on Facebook and Admissions. Please take a few minutes to complete the survey at:http://www.varsityoutreach.com/FacebookSurvey/Our GoalOur goal is to explore trends related to how schools are using Facebook to reach out to prospective and admitted students.How Is the Data Used?All data will be shown in the aggregate. Answers from individual schools will not be released and will remain…See More
May 16
Profile IconSang Yoon and Brittany Smith joined University Web Developers
May 15
Colleen Brennan-Barry posted a discussion

HighEdWeb Welcomes Steve Wozniak & Scott Stratten

HighEdWeb is very pleased to announce HighEdWeb 2013 Annual Conference opening keynote speaker Steve Wozniak and closing keynote speaker…See More
May 15
faris ahmed commented on social networking web design's blog post Megastar Media Webby Award Honorees
"wow thats amazing article .  your stuff never fails to amaze me honestly . great work as always :D  something i would like to add in is that  the entries each year are rapidly increasing .  but i think thats cause they take the…"
May 14
Lynn Zawie posted a discussion

Freelance Web Developer Needed

Stony Brook University web team is looking for some help coding a new design.  HTML5, CSS3, JQuery, Responsive Design expertise needed.  If you are interested in bidding on this project, I am happy to share more details.  Work would need to begin early summer.  ..LynnSee More
May 14
Sara Michel commented on Lynn Zawie's group OmniUpdate
"Great blog post by Higher Education Marketing on leveraging Google pay-per-click ad extensions for higher ed."
May 14
Sara Michel commented on Lynn Zawie's group OmniUpdate
"Check out Naropa University's new online magazine. Looks awesome! Great job team."
May 13
Norma J Dowell replied to Derek Tonn's discussion Freelance web design recommendations (small projects)
"Hi Derek! First of all, apologies for taking so long to respond! Secondly, I am not your web developer for such an issue, but if you can find someone to pick their brain and use as a sounding board, it may be all you need.  In the past, when I…"
May 13
Daniel Bashaw replied to Kimbel Jeffers's discussion Office Reservation software
"Hi Kimbel. I know you've been tasked with finding a software solution, though I'm wondering if you may need an interim step first: Does your institution have checklists covering all of the steps needed in on-boarding, relocating, and…"
May 13
Kimbel Jeffers posted a discussion

Office Reservation software

I've been tasked with finding a software tool that helps manage the onboarding and exit process of new and departing faculty. Ultimately i would like this software to management faculty office interms of when resources can be removed from a particular office and when a new faculty member can be moved in with the necessary resources. This tool should have notifications and alerts so there are no conflicts with someone being removed from a office and someone being placed in a office. Does anyone…See More
May 11
Sara Michel commented on Lynn Zawie's group OmniUpdate
"Congrats to Harper College on going live with their new online course catalog! Looks great!"
May 10
Helen Mosher joined Aaron Rester's group
May 9
Helen Mosher joined Mark Greenfield's group
May 9
Helen Mosher posted a status
"After 8 years being away from higher-ed communications work, I'm very interested in returning."
May 9
Will Martin is now a member of University Web Developers
May 6
Sarah McMaster replied to Katra Farah's discussion Online chat interfaces
"Thanks, Daniel. We don't currently have any livechat solution so this is new fact-finding territory for us! I will keep the forum posted as/if we are able to move forward."
May 3

UWEBD has been in existence for more than 10 years and is the very best email discussion list on the Internet, in any industry, on any topic

About

© 2013   Created by Mark Greenfield.

Badges  |  Report an Issue  |  Terms of Service