yordan
Sep 22 2006, 08:47 PM
| | A often-changing text in a static page, or a same set of lines in several pages... How can I include a file inside a html page ? #include will probably be a wrong syntax, but... i would have to have mything.html which is often changing, and I would like it to be inserted in main.html as well as in menus.html and in news.html. Could I insert something like #include mything.html in each page, and then, if I want to modify myghing.html the modifications are seen in all the pages where it's included ? Or do I ask something stupid ? |
Comment/Reply (w/o sign-up)
pyost
Sep 22 2006, 09:06 PM
If you are using pure HTML, I believe it can only be done with frames, which is so not good, nor professional. However, you could also use a small portion of PHP, and that would make your life easier. There's a function in PHP called include(), and it just includes a file in the page. So, instead of having the same text on multiple pages, replace it with <?php include("text.html"); ?>. Then create a text.html file with the appropriate content.
Comment/Reply (w/o sign-up)
minnieadkins
Sep 22 2006, 11:26 PM
I agree include is great in PHP. Be careful how you use it however, there's a difference in 'include' and 'require'. You should like into those 2. That's how I do it and it works great for me. Either use include files for missing chunks of similiar html or make a standard include file and put functions in it to print out the html for you. Whatever you prefer.
Comment/Reply (w/o sign-up)
vujsa
Sep 23 2006, 12:26 AM
Take a look at this and see if it is along the lines of what you are wanting to do. CMS101 - Content Management System DesignIf that is what you are wanting to do then you got some work to do... - First, you'll have to change the extention of all of the files that want to use php in from .html to .php!
- Second, you'll have to edit all of those pages again but this time to replace the frequently edited material with the php include code.
- Third, create the various files that you wish to include in you web pages.
- Forth, add a rewrite rule to your .htaccess file to forward page requests for your .html files to your new .php files.
This seems like a lot of work but the end result will really save you a bunch of time in the future because like you said, you could edite a single file to make major changes to your entire website. This type of system can be as simple as just inserting the file contents at the place specified in the webpage to allowing you to use a single template file with various modules and files for website tools and content. I can help you with the basic coding for either option but the overall system will be up to you to design since you are the one that has to use it. Just let me know what information you are interested in and I'll try my best to explain how to do it. If you are intersted in a more complex system where a single template file is used, this will require the use of complex urls like index.php?this=1&that=2&other=3Also, have you considered using a CMS program like Joomla? vujsa
Comment/Reply (w/o sign-up)
nightfox
Sep 24 2006, 05:51 AM
QUOTE(vujsa @ Sep 22 2006, 08:26 PM)  - Forth, add a rewrite rule to your .htaccess file to forward page requests for your .html files to your new .php files.
Nope... you could always just have it reversed where .html is parsed as .php. Then you don't need to bother changing any file extensions and the what not. You can keep it all the same. [N]F
Comment/Reply (w/o sign-up)
vujsa
Sep 24 2006, 06:43 AM
QUOTE(nightfox @ Sep 24 2006, 01:51 AM)  Nope... you could always just have it reversed where .html is parsed as .php. Then you don't need to bother changing any file extensions and the what not. You can keep it all the same.
[N]F
Yep, and here is why. PHP should be parsed as PHP and HTML should be left alone to do its thing. Problems begin to arrise when you start messing around with your handlers. If you slowly begin to convert your website over to PHP generated, then eventually you'll have all PHP file anyhow. I guess my point is that if you are going to do something like this, then you might as well do it right the first time. Eventually, most of you HTML requests will disapear and only PHP requests will be left. The rewrite rule is just to prevent you old links from being dead. If you set it up correctly, the search engine spiders will even update your links instead of creating new ons in their database. My advice is to update your files with whatever PHP you want or need to use and just Save As a PHP file instead of HTML. You'll have to edit most of your files anyhow to insert the PHP that is required so it wont really be much more work to save it as PHP other than updating any internal links from .htm to .php. vujsa
Comment/Reply (w/o sign-up)
yordan
Sep 24 2006, 11:10 AM
OK, seems to need more work than expected. Also SSI should work, as said here http://www.netmechanic.com/news/vol2/server_no8.htm The syntax "<!--#include virtual="other_page.htm" -->" looks exactly what I would like to do. Unfortunately, you cannot check the result on your own laptop, you should see it only after downladed on the web server, and even then SSI could happen not to work. Yet another great idea which is not easy to implement. sigh !
Comment/Reply (w/o sign-up)
vujsa
Sep 24 2006, 06:09 PM
One additional problem with SSI is that most servers require you to rename your file extentions to .shtml!  How many files do you have? It is possible to write a small script that change all of your internal links and save the file with the .php extention. As for the forwarding of your old HTML request to your new PHP files take a look here: http://www.astahost.com/redirecting-all-ht...ite-t10490.htmlWhat was it that seemed to be so much work? If it is changing all of the extentions, then I think I can help out with a simple script to change everything over. If it is editing your files to insert the PHP code, I can't really help there because more than likely there isn't enough of a pattern to your sight for a search and replace script. If all of your pages use pretty much the same layout, then it might be possible to replace your existing content with a PHP code. For example if you have the exact same menu on every page, then we can do a search and replcae based on that pattern. I'm more than happy to give you a hand with this if you want and I can show you the most simplified methods possible. Remember, if we are going to forward all of your old HTML requests to your new PHP files, then fixing all of the internal links doesn't have to happen right away since the request will get to the right place anyway.  So just by adding the forwarding rule and changing all of your extentions, your website would continue to work but would now be PHP ready.  Your PHP files don't actually have to contain PHP to work.  Hope this helps. vujsa
Comment/Reply (w/o sign-up)
nightfox
Sep 24 2006, 09:21 PM
QUOTE(vujsa @ Sep 24 2006, 02:09 PM)  One additional problem with SSI is that most servers require you to rename your file extentions to .shtml!  True. Internet Information Services (Windows servers) don't really care what the extension is. Just another reason why Windows servers shouldn't be allowed... [N]F
Comment/Reply (w/o sign-up)
Chesso
Sep 25 2006, 01:43 AM
Well, to be honest I haven't read much of the replys but this is probably obvious to some and may very well have been mentioned already to some degree, but this is how I do it. My web host (co-incidentaly Asta-Host heh heh) supports PHP, so I use includes, for my header/footer/left navigation/shoutbox and so on. Soon I will also be using them to have seperate meta tag data for different pages that could benefit from it (and also with more individualised titles). It's fairly simple to use with .php pages, where you want the source brought in just use: include 'myfile.html'; or include 'myfile.php'; etc. Which I believe just directly injects the source of the file you wish to include at that point. I use this also for the inclusion of my database connection file, instead of having that code re-written lots of times through several documents.
Comment/Reply (w/o sign-up)
vujsa
Sep 25 2006, 08:26 PM
yordan, I don't think you should give up on the easy maintainence option so quickly. I know that the idea of trying to develope a website based on a laguage that you are just starting to learn is probably pretty scary. Since you don't have a lot of pages to edit, I think you have a great opportunity to learn as you go. There are various tutorials at AstaHost that can show you how to set up an Apache server on your local system complete with PHP and MySQL that can be used to test scripts offline. The server is rather easy to set up and doesn't require many system resources unless it is serving webpages. You might give it a shot and play around with it for testing. That's how I learned. Another thing to remember is that your PHP file doesn't actually have to contain any PHP! So you can name your files .php but they will just be HTML. You can insert little bits of PHP into your pages without much programming knowledge. index.php HTML <html> <head> <title> Sample HTML / PHP Webpage </title> <meta name="description" content=""> <meta name="keywords" content=""> <meta name="author" content="vujsa"> </head> <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080"> Begin content here, but don't forget to add the date: <?php echo date('l dS \of F Y h:i:s A'); ?><br> Add more content here! </body> </html>
This would give you a result like so: QUOTE(Sample HTML / PHP Webpage) Begin content here, but don't forget to add the date: Monday 15th of August 2005 03:12:46 PM Add more content here!
Pretty simple huh. Now here is what you were interested in: content.php CODE <?php echo "Begin content here, but don't forget to add the date: ". date('l dS \of F Y h:i:s A') ."<br>\n Add more content here!"; ?>
index.php HTML <html> <head> <title> Sample HTML / PHP Webpage </title> <meta name="description" content=""> <meta name="keywords" content=""> <meta name="author" content="vujsa"> </head> <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080"> <? include("content.php"); ?> </body> </html>
You still get the same output in the web browser when you view index.php: QUOTE(Sample HTML / PHP Webpage) Begin content here, but don't forget to add the date: Monday 15th of August 2005 03:12:46 PM Add more content here!
Now if you want to change the content, you only need to edit content.php. This isn't as useful as it would be with either a template system which I think you aren't interested in yet or if you have the same chunk of data on every page like a menu. Now that we have further reduced your ignorance, you might be less apprehensive about trying to do this. Any questions? vujsa
Comment/Reply (w/o sign-up)
Similar Topics
Keywords : include, file, html, page, fast, changing, text, pages, put, file, include, file, html, pages
- Increase Your Knowledge Of Html Language
(11)
Safari And Hosts File
Overriding the file?? (8) I found this to be quite alarming when I found that sites I blocked using HOSTS were still
accessible by Safari. My HOSTS file consists of many automatically added entries by Spybot S&D and
SpywareBlaster and similar programs, but I also have some user added entries also. It is a 228KB
file, and a small segment that I added looks like this: 127.0.0.1 myspace.com 127.0.0.1
www.myspace.com 127.0.0.1 ca.myspace.com I found it to be inaccessible by all user accounts
using Firefox, Internet Explorer, Opera and Flock. However, I tried accessing it using Safari an....
Free Online Media File Conversion - No Software Installation Required
(12) http://www.media-convert.com/ Online alternative to Mediacoder
(http://mediacoder.sourceforge.net/), dBpoweramp (http://www.dbpoweramp.com/), SUPER
(http://www.erightsoft.com/SUPER.html) or Konverter (http://www.kraus.tk/projects/konverter/).
Converts everything 50 Megs or under. Pretty neat for documents and music. Definitely only useful
for small files (transferring them over the net to convert kind of sucks) but it could easily be a
quick solution if you don't have any software for the job. This thing is just begging to be put
into a client-side application wi....
The Best Free File Hosting Site !
Check This Out (6) Hi, I found i nice site I really use this because it acts like a usb flash drive because your
the only one who can access it unlike rapidshare and megaupload I know your aksing for it and here
it is http://www.dropboks.com It is the most simplest of all file hosting sites you can upload
up to 50MB and 1GB storage a month and unlimited bandwidth so you can get most of it check it out
!!!....
How To Bypass The Disabling Of Right-clicking In Pages.
(13) The convienient way: Right Click on anywhere in the page and hold it down. Wait for the rightclick
is disabled message to come out, still holding the right mouse button. Once the messagebox comes up,
use the left mouse button to click on OK, still holding the right mouse button. Move the mouse to
anywhere in the page and release the right mouse button. Tada! Your right click menu is up! The not
so convienient way: If you are using Microsoft Internet Explorer, Click on Tools, and then Internet
Options. Click on the Security Tab and then set the security level to CUSTOM....
Custom 404 Errorpages : How ?
how can I make my own 404 error pages ? (10) I would like to create my own 404 error pages, with a custumized message like "sorry, not ready yet,
but I'm working hard". What is the procedure for creating customized 404 pages ? Do I simply
have to put a "404" subfolder in the www folder, with a index.html page inside ? Or is it more
complicated ?....
Free Large-file Sharing Host
A host where you can upload large files for sharing them with friends (12) http://wibzy.com/ This host is very interesting because it's supposed to have no filesize
limitations, you should be able to uplead up to one giga files ! More than one CD in a single file !
Il will try it as soon as I will have a decently fast upload Internet connexion. QUOTE This is a
fast file hoster that has no download timer and no limits on downloading!!! Upto 1GB Upload! Also
very easy to use+image upload capabilites. At the end of the upload, the server gives you the
address of the download URL (for instance http://wibzy.com/download.php?file=31490....
Limewire Gets Sued Man
file sharing to be destroyed (19) QUOTE LimeWire was sued by the RIAA in federal court on Friday, accusing the company LimeGroup,
which runs LimeWire, of helping illegal music downloads by users all across America. The total suit
is worth approximately 150,000 dollars, but LimeWire is confident that they are not at fault. Other
file sharing services, such as the torrent indexer Isohunt, located at www.isohunt.com, have
experienced similar suits, but the fact that these companies are based in foreign countries protects
them from the copyright legal action that the RIAA and MPAA is doing against these ....
Idocs: A Good Html Starter Guide
(0) Hey everyone. If anyone is new to html and need some help on how to get started
http://www.idocs.com is a great site to use. They go over everything you need to know and are very
helpful. Another good html help site is http://www.davesite.com . they have good info on
everything and were very helpful to me.....
Free Unlimited File Storage
Unlimited File Uploads (19) If you want to know about free file hosting, I have found a good website, Unlimited File Uploads,
25MB per file. 100% Free /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' />
Your own homepage (example) http://putfile.com/yourname Private file cabinet "My Files" And
much much more.... you will really enjoy this have fun /smile.gif' border='0'
style='vertical-align:middle' alt='smile.gif' /> /smile.gif' border='0'
style='vertical-align:middle' alt='smile.gif' /> I know about another website which offers 1 gb
free file storage. this sto....
Alt Txt Tooltip Popups Over Text Links, How To Do?
searching for a simple way... (14) How can I insert an alt txt caption for a text link, so that when they hover over the text it pops
up with more info about the link before the person clicks on it? Do I have to use an image map over
the text for that, or is there a simple function that does the trick?....
Need Some Html Help?
Where to find free HTML tutorials (3) If you're just starting out with Web page design, you'll probably want to know at least
basic HTML coding. It's easy to do, really. All that you need is Notepad and a basic knowledge
of how Web pages work. At the same time, there are plenty of advanced programming options that you
can pick up and use if you want extra effects or more specific commands at your control. JavaScript,
for example. Or maybe you want forms so that you can collect feedback from your visitors in one
standardized format. Or maybe you just want to know how to get tables into your page....
Myspace Code Changing
(11) Hey guys, I feel silly asking this question since you all seem to be so much more advanced than I
am, but a friend of mine wants me to change his Myspace code. He told me about a profile he saw
where everything was changed. Even the text in the menu links. How do you get into this part of
the code? and then, when you do finally find it, where do you post it so that it works on the
profile? I have a general knowledge of code and such, do I have to be more advanced to be able to do
this? Thanks........
Html Encoding Of Email Addresses (stop Harvesting)
(9) Many people leave his e-mail address on the homepage of his site. That is spammer's favorite.
They can browse your site and catch the email addess in their list. Then a lot of garbage email will
be sent to the email address. There are lots of solusion for the problem. One is to use a hyperlink
to another website to redirect the email address. It seems a little complicate. Another is html
encoding. That is, each alphabet of the email address will be enconded. For example,
"this@is.a.test" will be enconded into "this%40is%2Ea%2Etest". The encoded string seems nonsens....
Approx How Big Is A 1minute Movie File?
... (8) So lets say i get the package one of hosting with this website (which is totally awesome. And i
think its 20gigs, how many one minute movie clips could i aprroximately host?....
What Is The Wildcard Of The Dns?
for changing the setting of my domain (1) I want to learn about how to modify DNS setting by using PHP. Someone tell me that the DNS server
must support wildcard. What is it? Where can I find the information or the example?....
Uploading Html Webpages, Folders And Organization
newb question -_-'' (9) Hi, Quick question (I hope =P), I've started to create my own webpage (I currently have a
filler graphic up on my astasite) and I have something of a file tree on my computer with the
various pages and stuff related to it in different folders. Example (everything on the page is
within the main folder, within the other folders are data from other pages and graphics) Main
Folder *index.html *graphics *blah blah blah *Folder 2 **2nd page **graphics **blahblahblah *Folder
3 **3rd page **graphics **blahblahblah **Folder4 ***4th page ***graphics ***blahblahblah My Qu....
Text Link Rollovers
Gerat effect for your websites (7) Here is a simple effect for your website. What it does is when you hover your mouse icon to the text
link it will change its color. 1. Write this code in the head portion of your page. The head
portion is where you will find the tag. a.mylink:hover {color:#FF0000} this is the code
responsible in changing the color of your text link into red if the mouse icon is pointed to the
text link. 2. Whatever link you want to change into red everytime the mouse icon is pointed in to
it, just add this code in the tag class="mylink" example: Go To Yahoo So there it goes. B....
Help With Background And Text Colors
(8) Alright, the question is, what is the easiest combination of background colors to font colors on the
eyes? (what causes the least amount of strain) A while back I remember reading something that said
that black text on a white background is harder to read then white text on a black background, and
when I asked a webmaster friend of mind he said that he prefers black text on grey bg so, assuming
a webpage that consists solely of colored text and a colored background, what are the best choices?
white on black? black on white? black on grey? or some other combination? (or....
Storing Files With Your Email Box Space
store a file in your email account (4) this is something i often used to do when i got a file (usually software of some sort), and i wanted
to keep it so i would be able to access it for later download. i did it once to save aerosmiths mp3
"dont wanna miss a thing" which took me hours to locate on the net. of course at that time, i didnt
much take into account the possibility of using online storage servers like znail and so on.
anyway, i would create a blank email, then i'd upload the software and send it to myself. and
there it would sit in myemail box until i needed it, when i would download it again.....
What's The Diff Tween Html, Xhtml, And Shtml?
that's kind self explanitory (8) does any one know /sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> ?....
Xhtml Taking Over Html?
(9) I've heard of a rumour saying iexplore and firefox is soon going to switch to XHTML. I'm not
sure what it means but is there any difference or is it just a file ext. diff? I know HTML is a very
"happy-go-lucky" coding style (You don't have to caps most of the codes for example) and other
coding like php and JAVA is very strict. Will XHTML be stricter than normal old html? That reminds
me of shtml...its still working around is it?....
Free File Sharing Programs.
(17) What is the best file sharing program, ive heard of kazaa and limewire, are there anymore that are
better?....
Send a file up to 1 Gb free
(23) If you want send a large file to somebody, just go to http://s7.yousendit.com/ and put an email
address and upload the file. The file doesn't come to the account mail, just a link to download
the file. enjoy it. PS: The link expire after one week....
Looking for include, file, html, page, fast, changing, text, pages, put, file, include, file, html, pages
|
See Also,
*SIMILAR VIDEOS*
Searching Video's for include, file, html, page, fast, changing, text, pages, put, file, include, file, html, pages
|
advertisement
|
|