Tramposch 1 Report post Posted August 12, 2009 I was wondering if somebody out there had already created an HTML page aggregator. What I want to do is that i have like 50 HTML pages in one directory, just containing a little bit of styling and a little bit of text, no php, js, or anything like that in there, but I want to make an Index.html page that brings each and every one of those pages, and shows ALL its contents in ONE page.Any ideas? Share this post Link to post Share on other sites
akashi 0 Report post Posted August 12, 2009 how about using frame, or if you prefer php then you could use file_get_contents and then write an output using echo. if the files has similar names like file1.html..file50.html, then it would be easier. Share this post Link to post Share on other sites
Tramposch 1 Report post Posted August 12, 2009 all the files end in .html, but Im not quite sure what you are saying, could you go into a bit more detail maybe? Share this post Link to post Share on other sites
akashi 0 Report post Posted August 13, 2009 (edited) you could just read the files as string using file_get_contents command in php, and then give an output using a echo. you could read the tutorial here : http://de2.php.net/file_get_contents an example : <?php$contents = file_get_contents('file1.html');echo $contents;?>save as a php file and put in the same directory and try run it. you could insert for command to loop, esp if your files have similarity in name like file1.html, file2.html. ... Could you try this first and tell me whether it works or not. I did try this script once and it worked but i'm not really sure whether this will work or you or not Edited August 13, 2009 by akashi (see edit history) Share this post Link to post Share on other sites
k_nitin_r 8 Report post Posted August 15, 2009 Hi!An alternative approach that simply involves adding in HTML comments is to use server-side includes. Different web server vendors may implement it differently, but with Apache's mod_include module, you simply have to insert something like this: <!--#include virtual="otherfile.html" -->in your main file. It will 'merge' the files, making them appear as a single file to the end user. You can also use this approach to develop standardized templates for displaying the header, footer, and navigation menu on the page so you do not have to change it on every page of your website if you do decide to change them - they could all reside in just one file with the web server putting them together whenever a user requests for the web page.I haven't looked into server-side includes in Microsoft Internet Information Service (IIS) yet so I can't tell you how to do it in IIS but you can install Apache on Windows too as Apache works on pretty much every major platform (Windows, Linux, MacOS, BSD).Alternatively, you can use PHP. The advantage of using PHP is that you aren't tied to a particular vendor, such as IIS or Apache, since you can install PHP as a module to work with either IIS or PHP. However, you would probably have to deal with security issues if your PHP scripts get complicated. Less software is usually better on servers as you have fewer security issues to deal with.Regards Share this post Link to post Share on other sites
fuzionmusic 0 Report post Posted August 19, 2009 What kind of information would you need to pull from 50 different HTML files? dare i ask why there are 50 HTML files on your site? Maybe the use of a database with a for loop or a while loop my remedy this? Share this post Link to post Share on other sites
k_nitin_r 8 Report post Posted August 19, 2009 Hi!I'm guessing the 50 HTML pages might be the result of a batch script that retrieves data from multiple sources, such as different news websites. Either that, or it could be a script that generates files instead of database records to keep things simple (no DBA or email admin intervention required).I would like to mention that the above approaches (other than the IFRAME) suggestion might cause a problem since the internal and external CSS styles applied to the earlier pages would affect the pages following. In-line CSS, however, would not cause this issue. You would also have to ensure that the pages do not have any broken markup as that could affect the rendering of other pages as well.Regards,Nitin Reddy Share this post Link to post Share on other sites
Saint_Michael 3 Report post Posted August 25, 2009 Well, you could just use includes to add the files to make it simpler and so php would be the easiest to go and that way you have an easier time formattign everythign with CSS. Or you could do it in flahs but I think you want to have it indext though. Share this post Link to post Share on other sites
galexcd 0 Report post Posted August 26, 2009 If it is a server running a unix based OS you could use a cron job that calls a command like: cat * > index.html That way you don't have to deal with php or js, or really anything. It will just automatically generate an index.html page at whatever interval you specify, that contains the content of all the files in the current working directory. Share this post Link to post Share on other sites