Jump to content

templates, master file?


justinh
 Share

Recommended Posts

Hi all,I'm a hobby web page developer and need to re-do some simple web sites. I'm just getting into CSS and don't know if this is the right forum or even a valid question :umnik2:. Here is the basic question: Is there a way to use a 'master' page where when you click a menu link it just loads different content, while keeping the header, footer, and menu areas static? Or, is there some way to create multiple content pages that stream/link in all the status areas (via CSS maybe)? I'm asking because if I make a change to a core item (menu, header, etc) I don't want to have to edit ten pages to make them all the same. I'm guessing all these huge commercial web site admins don't have to do that :Pleased: . I'd appreciate any hints or links or info! I think 'template' may be an applicable term here, but HTML editors seem to treat templates as just another HTML file used to create a new one. I'm thinking it may also mean a live template-like thing. Thanks,Justin

Link to comment
Share on other sites

You need a server-side language to do it. The most basic way in PHP is to just include the content.

<?php  // Determine what page we're on to get the title and content  // if(), switch() ... {  $title = 'Something';  $content_file = 'something.php';  // }?><!DOCTYPE html><html>    <head>	    <title><?php echo $title; ?></title>    </head>    <body>	    <!-- Put a header and a menu here -->	    <?php include $content_file; ?>	    <!-- Put a footer here -->    </body></html>

Link to comment
Share on other sites

Guest So Called

You're right at the point I was when I discovered PHP and MySQL. Long story short, you move your content to a database (MySQL) and generate your pages with PHP, and you can have your common header and footer in your database. (My external CSS is served from the database too.) My database has an entry for each content page with only the "meat" of the content (mostly just formatted in HTML paragraphs with CSS classes for different paragraphs) and my PHP accesses the database and slaps on common headers and footers. This is why I moved from static HTML and CSS. With PHP I can change the layout of my entire site and all my content at once. With CSS I can change the appearance with just one file edit. Learn PHP and MySQL.

Link to comment
Share on other sites

*cough*Look up CMS*cough*It is exactly what you want and it is, like these guys have stated, PHP and MySQL :)Good Luck

Link to comment
Share on other sites

Guest So Called

Or even better, 'LAMP.' Linux+Apache+MySQL+PHP. You can buy hardware and rent an Internet connection, and everything else you need for a server is open source! My mind boggles! Gutenberg would have had a wet dream if he had known what was coming to the future: http://en.wikipedia.org/wiki/Johannes_Gutenberg Before Gutenberg the churches had the monopoly on dissemination of book knowledge and upon publishing. Monks copied their texts. Nobody but the church and nobles could afford books. Gutenberg invented the press and then the wealthy could afford books. Then the Internet was invented and everybody, even you and I, can afford our own presses, and we can introduce our content to everybody in the world for a mere pittance. I pay less than $100/year for access to my printing press, and virtually everybody in the world can read my content if they want. And the cheapest press in the world is shared hosting, and LAMP and/or/with some CDS/CMS like WordPress or Drupal or SMF or whatever. Or learn LAMP and write your own.

Link to comment
Share on other sites

If you use Dreamweaver and plan to update the site yourself you can create a Dreamweaver template from a master page and convert it to a template. You can then drag it from the assets panel onto a blank document and voila, you just change the content in an area you designate for content. The rest of the page is locked from editing. If you change the main template design then it will update all the other pages too without affecting content. http://webdesign.about.com/od/dreamweaverhowtos/ig/Create-a-Dreamweaver-Template/

Edited by afish674
Link to comment
Share on other sites

If you use Dreamweaver and plan to update the site yourself you can create a Dreamweaver template from a master page and convert it to a template. You can then drag it from the assets panel onto a blank document and voila, you just change the content in an area you designate for content. The rest of the page is locked from editing. If you change the main template design then it will update all the other pages too without affecting content. http://webdesign.abo...eaver-Template/
I DESPISE dreamweaver templates... they are terrible. PHP Include files are much better in my honest opinion...
Link to comment
Share on other sites

I DESPISE dreamweaver templates... they are terrible. PHP Include files are much better in my honest opinion...
Thats fine, I would tend to agree with you, but as someone who does web design as a hobby he may not be familar with PHP. Its just another way of doing it. I've recently had them cause issues by messing up doctype declarations. Learning PHP is on my to do list.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...