There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
how to duplicate compoents in pages?


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
Mor's Avatar
Mor Mor is offline
Junior Member with 18 posts.
 
Join Date: Jun 2004
Experience: Intermediate
05-Nov-2006, 11:02 AM #1
how to duplicate compoents in pages?
I would like to duplicate major sections of pages in multiple pages and then be able to modify them all by modifying the master.

FrontPage has shared borders, which accomplishes this, but it is limited to four borders. I need a similar but more flexible process which can be applied to the whole page.

I've seen this before, and I think it's well known by many who are much more knowledable, but my level so far has been rather primative. I've been able get by modifying one by one, but now I'm getting so many pages that it's just too inefficient.

If anyone can direct me to script, I would appreciate very much.
Eriksrocks's Avatar
Computer Specs
Senior Member with 1,859 posts.
 
Join Date: Aug 2005
Location: Minnesota
Experience: Advanced
05-Nov-2006, 11:08 AM #2
This can easily be accomplished using PHP includes.

But first, what is your hosting package and who are you hosting with? If your host supports PHP, then you can do it by simply putting each "master" in a separate file with an extension of .php.

So for example, you could have:

header.php
footer.php
news.php
sidebar.php

etc...

Then, on the file you want to include them all on, you just put
PHP Code:
<?php include("FILENAME.php"); ?>
(wherever you want to include them) and it will copy it into the page. Just make sure to name the file that includes them with an extension of .php.

And by the way, don't use Frontpage if you can help it.

EDIT: Here is more info if it is a bit confusing for you:
http://www.w3schools.com/php/php_includes.asp
Mor's Avatar
Mor Mor is offline
Junior Member with 18 posts.
 
Join Date: Jun 2004
Experience: Intermediate
05-Nov-2006, 11:15 AM #3
Thanks for the quick reply

Then does each php file need a header, body and so forth? or just, say a table?

The reason I ask is I need to use these files in succession on the same pages so that there would be no border or space in between the background images

Thanks again
Mor's Avatar
Mor Mor is offline
Junior Member with 18 posts.
 
Join Date: Jun 2004
Experience: Intermediate
05-Nov-2006, 12:44 PM #4
OK, I got it working, but the page utilizing it also has to be renamed php. Although i found alittle blurb on a tips page answereing a question on how to use it in htm pages by someone who was concerned about existing page rankings and didn't want to rename all their pages.

This is a good start. Thanks again
covert215's Avatar
Account Disabled with 2,651 posts.
 
Join Date: Apr 2006
Experience: Web Designer
05-Nov-2006, 12:48 PM #5
An important hint- Unless you have a server running on your computer, you cannot run the .php file like you would view an html one. The php file needs to be on a server to be viewed
Mor's Avatar
Mor Mor is offline
Junior Member with 18 posts.
 
Join Date: Jun 2004
Experience: Intermediate
05-Nov-2006, 02:06 PM #6
Yes, it's becoming clear there may be more complications. godaddy is my host, and I've got one example functioning, so it must support php, but..

FrontPage does not display php files in the folder list when working on line, so once I've left and return, they don't appear to be there. Unless I can figure a way to find them. They're available if I remember the name, but then FrontPage opens them in note pad.

I could have duplicates on my PC and open them in notepad.

One site advises the following:

Frequently asked questions:

Question 1
How can I use PHP include for easy site
maintenance if all my web pages currently have .html or
.htm extensions? I don't want to lose their current search
engine rankings.

Answer
Insert the code below into notepad, name it
.htaccess and upload it to the root folder of your server.

AddType application/x-httpd-php .html
AddType application/x-httpd-php .htm

Now just follow the 9 steps as outlined above and you will
be able to keep your current page extensions ( .htm..html
or .php) and still use PHP include. This will allow you to
keep the same search engine rankings as you had before you
made your site dynamic.



...but I'm unsure of a filename: ".htaccess" nothing preceeding the "." ?? Working on this but haven't finished it yet.
covert215's Avatar
Account Disabled with 2,651 posts.
 
Join Date: Apr 2006
Experience: Web Designer
05-Nov-2006, 02:25 PM #7
That is correct.

.htaccess with no name. You may have to give it a name to start, then rename it.
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,082 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am
05-Nov-2006, 08:11 PM #8
.htaccess is unusual because, as covert said, it has no name. Just an 8 letter file extension.

This may also come from the fact that on UNIX machines, a . before a name indicates a hidden file and .htaccess in a sense is one of these hidden files. i.e. you don't see it when you browse a website.
__________________
-----------------------------
| 404: Name Not Found |
-----------------------------
PLEASE NOTE: If I happen to help you in a post, or just simply reply to it, doesn't mean I want to be bombarded with PMs. I answer all questions in posts, not in PMs. Thank you, and have a good day.

<?php $h = 'Hello '; $w = 'World'; echo $h.$w; ?>

My Favorite Editors:
Windows: Crimson Editor
Mac: Taco HTML Edit
Linux: gPHPEdit
Eriksrocks's Avatar
Computer Specs
Senior Member with 1,859 posts.
 
Join Date: Aug 2005
Location: Minnesota
Experience: Advanced
07-Nov-2006, 06:24 PM #9
So yes, you may need to name it something like a.htaccess when you create it on Windows but when you upload it rename it to .htaccess.

Quote:
Originally Posted by Mor
FrontPage does not display php files in the folder list when working on line, so once I've left and return, they don't appear to be there. Unless I can figure a way to find them. They're available if I remember the name, but then FrontPage opens them in note pad.

I could have duplicates on my PC and open them in notepad.
Yeah, it's a major problem with FrontPage unfortunately. When I used FrontPage (a while ago) I would have every page as HTML also and then edit it as HTML with the PHP code and stuff, and then at the end I would just go to Save As > And save it with an extension of .php.

But of course if you set up the .htaccess then it wouldn't matter because you could just save it as .html anyway.
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 08:28 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.