boxturt Posted September 12, 2003 Posted September 12, 2003 I have 20,000 .html pages on my site. I wanted to add headers and footers using SSI so I put this in each html file : <!--#include virtual="/includes/songheader.shtml"-->and relied upon (as I have and do on this site) : AddType text/x-server-parsed-html .html in .htaccess to work around the shtml/html problem. Now however, even though the pages are being served, everything is there, the error log is filled with : ...unable to include "/includes/songheader.shtml" in parsed file /home/lyricsp/public_html/alpha/songs/a/anysong.html I am sooooooo lost. I know I should have checked the error log before I did all 20,000 pages but because they were rendering properly I didn't think anything of it. Quote
borfast Posted September 13, 2003 Posted September 13, 2003 (edited) Take out the first slash (/) from the include path. Instead of ><!--#include virtual="/includes/songheader.shtml"--> put just ><!--#include virtual="includes/songheader.shtml"--> or, better yet, you can also use a full path, like so ><!--#include virtual="/home/lyricsp/public_html/includes/songheader.shtml"--> Hope it helps Edited September 13, 2003 by borfast Quote
boxturt Posted September 13, 2003 Author Posted September 13, 2003 Thanks for the input. I tried both ways and unfortunately neither worked. This time I got the error processing message on an unformatted page. Now I'm really stuck Quote
TCH-JimE Posted September 13, 2003 Posted September 13, 2003 Hi, You will need the / in it as its the start of a folder. Are all the pages .shtml that your including into? Try renaming the files your inclduding so they are just basic .htm files Or try php includes, far easier! Jim Quote
boxturt Posted September 13, 2003 Author Posted September 13, 2003 (edited) Yes, I'll try just .htm next. If I put a php includes into the mainpage.html don't I have to rename it mainpage.php? (please don't make me have to rename 20,000 pages and 20,000 links and, and, and......) Thanks folks, All your input is ever helpful, I appreciate it. ====================================== Okay, I'm dumb. Well - I panic easily and sometimes forget to look at the entire picture. Turns out almost all the errors (100s and 100s) were attached to the same IP. Of course they are now blocked which only gives me 100s and 100s of different errors but at least I know everything seems ok. Although I'd really appreciate it if a few of you would check out a few lyrics pages and let me know if you're seeing a "normal" page or just onelongrunonsentence because I am still getting the error. Edited September 14, 2003 by boxturt Quote
surefire Posted September 14, 2003 Posted September 14, 2003 If I put a php includes into the mainpage.html don't I have to rename it mainpage.php? Yes... and no. The server needs to know the page has php code so you either need to name it .php or you have to change your .htaccess file in a similar fashion as you did with the SSI. Quote
boxturt Posted September 14, 2003 Author Posted September 14, 2003 I see, same rules apply - makes sense. I may still do it that way (with php) AFTER I get this mess all starightened out..lol Thanks Jack - I had a feeling you might answer ......all I wanted was complete control - is that too much for a lowly turtle to ask??!! Quote
boxturt Posted September 16, 2003 Author Posted September 16, 2003 Grrrrrrrrrrr. I've tried everything I can think of and I'm still getting the same errors in the error log - ...unable to include "/includes/songheader.shtml" in parsed file /home/lyricsp/public_html/alpha/songs/a/anysong.html - even though the page is delivering the includes file. It doesn't appear to be happening with any specific browser that I can tell. It all works fine for me in IE6, NS7, Mozilla, Opera and even though the CSS falls apart it works in NS4.72 Still lost.......................... Quote
surefire Posted September 16, 2003 Posted September 16, 2003 It doesn't appear to be happening with any specific browser that I can tell.SSI is a server side technology. So all the 'magic' goes on at the server before the page is even sent to the browser. That's why I love server side script so much. Here's what I found Uncomment the following AddType directive in the web server configuration file (~/www/conf/httpd.conf) on your Virtual Server to designate that all .shtml files be parsed by the web server for server side includes: AddType text/html .shtml AddHandler server-parsed .shtml That's from http://www.2kweb.net/support/virtual/web/conf/ssi.html So maybe you need to add this extra line or two of code in your .htaccess I don't use SSI and opt for PHP... but you already knew that. Quote
boxturt Posted October 1, 2003 Author Posted October 1, 2003 Seems it remains no matter what I do *sigh* So it goes Quote
TCH-JimE Posted October 1, 2003 Posted October 1, 2003 Hi, Just a quick thought, change: "songheader.shtml" to "songheader.htm" "anysong.html" to "anysong.shtml" Any luck? I would say that php includes would be better. Jim Quote
surefire Posted October 1, 2003 Posted October 1, 2003 (please don't make me have to rename 20,000 pages and 20,000 links and, and, and......) If you are managing the site by putting up 20,000 static pages then you could save yourself tons of time and energy by driving this off a database. CMS (Content Management System) of some sort. I really think that you would benefit from putting this content into a database and switching php includes for the ssi functions. Upfront investment will pay big dividends. Quote
boxturt Posted October 1, 2003 Author Posted October 1, 2003 Yes, thank you guys. I know a database driven setup would be better. Perhaps when I am better in a few months I can tackle that major task Quote
boxturt Posted December 6, 2003 Author Posted December 6, 2003 I am now seriously considering doing this off a database but it is a scary proposition. So much content and I fear I will have to individually redo 21,000 pages. I'm not even sure where to start. I keep looking at 'things' and just get more confused or depressed..lol Here is the template w/content that we use - perhaps someone can point me in the right direction, laff hysterically or tell me to dream on..... fine - I'll use "Dream On" as the example" (saved as dreamon.html) <html><head> <title>Dream On</title> <link rel=stylesheet href="/css/songpagestyles.css" type="text/css"> </head> <body> <!--#include virtual="/includes/songheader.html"--> <!--#include virtual="/includes/texttoggle.html"--> <table width=750 align=center border="0" cellpadding="5" cellspacing="1"> <tr valign=top align=center> <td align=left> <pre><h1><div id="lyr"> <!-------PASTE SONG LYRICS AND ALL INFO BETWEEN THESE TWO LINES---> DREAM ON Aerosmith Every time when I look in the mirror All these lines on my face getting clearer The past is gone it went by, like dusk to dawn Isn't that the way Everybody's got the dues in life to pay I know nobody knows where it comes and where it goes I know it's everybody sin You got to lose to know how to win Half my life is books written pages live and love from fools and from sages You know it's true,OH All these things come back to you Sing with me, sing for the years Sing for the laughter, sing for the tears Sing with me, just for today Maybe tomorrow, the good lord will take you away Yeah, sing with me, sing for the year sing for the laughter, sing for the tear sing with me, just for today Maybe tomorrow, the good Lord will take you away Dream On Dream On Dream On Dream until your dreams come true Dream On Dream On Dream On Dream until your dreams come true Dream On Dream On Dream On Dream On Dream On Dream On Dream On Sing with me, sing for the year sing for the laughter, sing for the tear sing with me,just for today Maybe tomorrow, the good Lord will take you away Sing with me, sing for the year sing for the laughter, sing for the tear Sing with me, just for today Maybe tomorrow, the good Lord will take you away. <!-------PASTE SONG LYRICS AND ALL INFO BETWEEN THESE TWO LINES---> </div></h1></pre> </td> <td align=right><!--#include virtual="/includes/google_ads.html"--></td> </tr> <tr valign=top align=center> <td colspan=2><hr></td> </tr> </table> </body> </html> I suspect that I will have to create all new field in each page, title, author, performer, etc. Yea, this is getting scarier and scarier. Quote
borfast Posted December 6, 2003 Posted December 6, 2003 (edited) Hello Ty! From the template you posted, seems quite easy to get the lyrics from a database! The hard part would probably be to set up the whole stuff - transforming all those 21000 pages into.... ONE! Here's a piece of code to start: ><html> <head> <title>Dream On</title> <link rel=stylesheet href="/css/songpagestyles.css" type="text/css"> </head> <body> <!--#include virtual="/includes/songheader.html"--> <!--#include virtual="/includes/texttoggle.html"--> <table width=750 align=center border="0" cellpadding="5" cellspacing="1"> <tr valign=top align=center> <td align=left> <pre><h1><div id="lyr"> <!-------PASTE SONG LYRICS AND ALL INFO BETWEEN THESE TWO LINES---> <?php //******************************* // Get the lyrics from the database and print them to the HTML page //******************************* $db = mysql_connect(localhost, "dbusername", "dbpassword") or die ("Unable to connect to database."); mysql_select_db(<dbname>, $db) or die ("Unable to select database."); $id = $_GET['id']; // Gets the value of the 'id' variable passed in the URL $query = "SELECT * FROM lyrics WHERE id='$id'"; $result = mysql_query($query, $db) or die("Error executing query: " . mysql_error()); $row = mysql_fetch_array($result); echo nl2br(htmlentities($row['lyrics'])); ?> <!-------PASTE SONG LYRICS AND ALL INFO BETWEEN THESE TWO LINES---> </div></h1></pre> </td> <td align=right><!--#include virtual="/includes/google_ads.html"--></td> </tr> <tr valign=top align=center> <td colspan=2><hr></td> </tr> </table> </body> </html> That piece of code that replaced the actual lyrics is the PHP code that will fetch the lyrics from the database and write it up on the page. Now comes the hard part: you'll have to create a database (if you don't have one already - use CPanel for this) and inside that database you'll have to create a table (use phpMyAdmin) - I called it 'lyrics' on the SQL query but you can chage it's name as long as you adjust the $query statement. The table structure could be as simple as having a column named 'id', which would uniquely identify those lyrics and another column named 'lyrics', which will hold the actual lyrics' text. The first column (id) would be of type INTEGER and with the special 'flag' AUTO_INCREMENT set to true. The second one could be set to TEXT or MEDIUMTEXT - the difference is that the first one holds up to 65535 characters and the second can store up to 16777215; I'd say TEXT is enough but you'll know that better than me. And now, the real tough part: insert all the lyrics into the database! This can be done using phpMyAdmin, too. When doing this, leave the 'id' field blank (it will be incremented automatically). After having done all this, the lyrics can be fetched from the database by getting the URL in the form http://yoursite.com/lyrics.php?id=X where X is the database id of the lyrics you want to fetch. Well, this is a pretty good start. Try implementing this first with just a few lyrics inserted into the database and then, if you want to keep going, I'll help you with implementing the rest - getting the list of all the lyrics from the database, etc Edited December 6, 2003 by TCH-Raul Quote
boxturt Posted December 6, 2003 Author Posted December 6, 2003 EEEEEEEEEEEEEEEEK!! Thanks. After I re-read this a few hundred times I may get it..lol Yea, I will go slowly with this as I can tell I'd be in way over my head. But what the heck! Quote
borfast Posted December 6, 2003 Posted December 6, 2003 It's not that complicated, really! The PHP code is probably the easiest part, as you don't even need to know what it does (though it would be good if you did). The part that may be difficult for you to understand is the one about creating the database and the table. After that, you only need to copy/paste the lyrics into the database. If you need any help, you know where to reach me Quote
Deverill Posted December 6, 2003 Posted December 6, 2003 That seems like a big task Ty. If you decide to do it then I wish you all the best. On one of my sites I have a some-file.php that is basically the head/body/etc tags and stuff and then have a PHP include statement for /Content/some-file.htm to have the changable soft middle parts. I'd like to figure a way to have just one file for the .php thing since it is identical for all pages except the include statement. If that can be done it may be another way to do what you want. Quote
boxturt Posted December 7, 2003 Author Posted December 7, 2003 Thank you gentlemen. I really don't know if I am up to the task yet. I'm thinking maybe I should start at the beginning, rebuild slowly from the initial index page up. As I work my way in hopefully I will be gaining more knowledge about all this. Then there's the 'able to focus' factor which I'm not real good at these days But I'm gonna try something with all this, that's for sure Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.