inherit
88478
0
Nov 28, 2024 17:05:24 GMT -8
Robyn
22,567
September 2006
millsberryfanrob
|
Post by Robyn on Apr 10, 2012 16:59:42 GMT -8
So I've got an archive website, which basically consists of copies of my older websites put under my archive page. I link to them and you can access them. However, I was thinking of an easy way for one to get back to the archive website quickly, and the idea of keeping my header content attached to each website came about. The problem with this is that I'd have to go through thousands of html pages and manually add the header info to each page. I'm not doing that of course, so I had recalled framing or iframes or something. But upon research and experience I remembered that it was negatively viewed upon and not supported by modern browsers or something like that. Thus comes the question. What do you think I should do? Is there a way to include the header code somehow or to make it easy for my visitors to return back (especially if they have wandered all around the website and wish to return to a different version)? And even cooler would be some code that automatically told you where you were in the website, like how proboards has: ProBoards Support :: General :: Coding and Design Boards :: General Programming Discussion :: Post Message My website could have: RobertCity.com - My research page - About the future - Links to external websites But of course just having the header content is good enough for me. ;D archive.robertcity.com/index.php is my archive website thus far. An example of what I'm talking about is the web archive website web.archive.org
|
|
inherit
150365
0
Aug 5, 2018 18:51:31 GMT -8
Violet
Oh, bless your heart.
2,928
December 2009
watchmen2013
|
Post by Violet on Apr 10, 2012 18:36:51 GMT -8
|
|
inherit
40157
tyrantlytamale 627939549 tjhtmlmaniac
0
Sept 3, 2023 15:17:02 GMT -8
Tylr
The stale taste of recycled air.
2,964
April 2005
tyrantlytamale
|
Post by Tylr on Apr 10, 2012 18:54:44 GMT -8
Regular frames would work, but I find them to be a little clunky. As far as I know, all browsers still support them. However, a lot of sites use framebreakers to get out a a frame if they're displayed in one. iframes is a similar idea, but it's embedded.
You can add the header info to every HTML page with a little bit of file functionality in PHP. Just throw an include() after the body tag and have it display a fixed div to the top of the browser, or some such thing. To do more with PHP, you could link to the parent folders for wherever the file is located.
My question is, did you really handwrite thousands of HTML pages?
|
|
inherit
88478
0
Nov 28, 2024 17:05:24 GMT -8
Robyn
22,567
September 2006
millsberryfanrob
|
Post by Robyn on Apr 11, 2012 17:01:12 GMT -8
I'll look into that and see! Regular frames would work, but I find them to be a little clunky. As far as I know, all browsers still support them. However, a lot of sites use framebreakers to get out a a frame if they're displayed in one. iframes is a similar idea, but it's embedded. You can add the header info to every HTML page with a little bit of file functionality in PHP. Just throw an include() after the body tag and have it display a fixed div to the top of the browser, or some such thing. To do more with PHP, you could link to the parent folders for wherever the file is located. My question is, did you really handwrite thousands of HTML pages? Cool info. Well the problem is editing each page to include the header... unless you know of a way to add a line in Notepad++ to each file... Thousands may be a slight exaggeration... maybe a few hundred? ;D
|
|
inherit
40157
tyrantlytamale 627939549 tjhtmlmaniac
0
Sept 3, 2023 15:17:02 GMT -8
Tylr
The stale taste of recycled air.
2,964
April 2005
tyrantlytamale
|
Post by Tylr on Apr 11, 2012 17:05:59 GMT -8
Well the problem is editing each page to include the header... unless you know of a way to add a line in Notepad++ to each file... Oooh no, I meant PHP can do that. Just while or foreach through all the files and modify the contents to include your header. One click and you're set (after writing the script to do it for you).
|
|
inherit
88478
0
Nov 28, 2024 17:05:24 GMT -8
Robyn
22,567
September 2006
millsberryfanrob
|
Post by Robyn on Apr 12, 2012 6:07:39 GMT -8
Well if someone knows the script to add to do so then that'd be great, haha!
|
|
inherit
97216
0
Nov 26, 2024 13:53:14 GMT -8
Bennett 🚀
Formerly iPokemon.
3,622
January 2007
catattack
iPokemon's Mini-Profile
|
Post by Bennett 🚀 on Apr 13, 2012 19:45:00 GMT -8
<?php function directoryToArray($directory, $recursive) { $array_items = array(); if ($handle = opendir($directory)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if (is_dir($directory. "/" . $file)) { if($recursive) { $array_items = array_merge($array_items, directoryToArray($directory. "/" . $file, $recursive)); } $file = $directory . "/" . $file; $array_items[] = preg_replace("/\/\//si", "/", $file); } else { $file = $directory . "/" . $file; $array_items[] = preg_replace("/\/\//si", "/", $file); } } } closedir($handle); } return $array_items; } $directory = directoryToArray("/path/to/directory"); $header = ""; foreach($directory as $val){ $contents = file_get_contents($val); $contents = $header."\n".$contents; file_put_contents($val,$contents); } ?>
Something like that. I didn't try it, just found this function in one of my files. Edit $header = ""; to the header to be included, and edit $directory = directoryToArray("PATH TO FILES YOU WANT TO BE EDITED"); Try this on some other files first, just to test. Put a few text files in a random directory and try that first. Btw, the path to the files has to include the whole path, so /home/user/public_html for example on a cPanel server.
|
|
inherit
150365
0
Aug 5, 2018 18:51:31 GMT -8
Violet
Oh, bless your heart.
2,928
December 2009
watchmen2013
|
Post by Violet on Apr 19, 2012 6:00:56 GMT -8
|
|
inherit
88478
0
Nov 28, 2024 17:05:24 GMT -8
Robyn
22,567
September 2006
millsberryfanrob
|
Post by Robyn on Apr 21, 2012 5:36:18 GMT -8
I really hate to say this but I've decided to simply inform my viewers to be careful not to click out of the archive site, and will have all archive pages simply opened in a new window.
Thanks for the help and codes though!
|
|
inherit
179665
0
Aug 7, 2012 18:46:57 GMT -8
Violin - Soul Power
Girls Protector
36
May 2012
soulpower
|
Post by Violin - Soul Power on May 16, 2012 15:57:20 GMT -8
hmmm.... I prefer to use to compare major code, UEstudio tools especially for solution Php code simpler and convenient glad to learn about the code base and core logic or more specific record is also referred to as (mnemonix) yawn
|
|
Former Member
inherit
guest@proboards.com
171777
0
Nov 28, 2024 20:08:21 GMT -8
Former Member
0
January 1970
Former Member
|
Post by Former Member on May 23, 2012 21:58:46 GMT -8
A better way of doing it would have been this: <?php include("includes/header.php"); ?> Setting everything up in includes is so much easier than having to edit every single HTML file. Save everything in .php format. I know this doesn't matter to you Robert as this is old, but just giving out a suggestion to other novice coders. So basically with that php code you can add in the logo, menu icons and anything else you have in the header portion can go in that file.
|
|
Former Member
inherit
guest@proboards.com
171777
0
Nov 28, 2024 20:08:21 GMT -8
Former Member
0
January 1970
Former Member
|
Post by Former Member on May 23, 2012 22:13:31 GMT -8
A better way of doing it would have been this: <?php include("includes/header.php"); ?> Setting everything up in includes is so much easier than having to edit every single HTML file. Save everything in .php format. I know this doesn't matter to you Robert as this is old, but just giving out a suggestion to other novice coders. So basically with that php code you can add in the logo, menu icons and anything else you have in the header portion can go in that file. Sure iPokemon's code is easy, but it would save a bunch of time to add headers, sidebars and footers into an include all in their own respectable files, thus if you need to change the footer but hate having to edit each, then all you have to do is edit footer.php. All files have to be in PHP format though. Index.php Header.php Sidebar.php (sidetable.php) Footer.php Header, sidebar, and footer goes into "includes" folder. So this is what your index.php file and EVERY page you have set up like this so like, about.php, contact.php, etc. <head> <title>Title of your site</title> <link href="style.css" rel="stylesheet" type="text/css" media="screen" /> </head> <?php include("includes/header.php"); ?> <div id="content"> <div id="leftcolumn"> <h2>TITLE</h2> <p>BODY TEXT</p> </div> </div> <?php include("includes/sidebar.php"); include("includes/footer.php"); ?> Of course your div and style tags will be a lot different from mine.
|
|