View Full Version : SSI inside SSI
StRacr
02-08-2000, 06:31 PM
Hey all,[nbsp][nbsp]
[nbsp][nbsp]I have a quick question..[nbsp][nbsp]
[nbsp][nbsp][nbsp][nbsp] How do I include a file from each directory into a page that's allready using SSI ?
[nbsp][nbsp][nbsp][nbsp]Here's how my pages are set up.[nbsp][nbsp]The top "title"[nbsp][nbsp]and menu on the left are one SSI file(header), then the main page,[nbsp][nbsp]then a SSI footer. The header file is called header.shtml and the footer is Footer.shtml.
what I want to do is add a different file from each directory into the header,[nbsp][nbsp]creating links back to each directory..[nbsp][nbsp] for example
if they click on the photo gallery from the main menu a link is placed in the "header" of the page like
main_page > Photo Gallery
If they click on a link in the Photo Gallery, links appears like
Main Page > Photo Gallery > Cars
Any sugestions on how to do this ?
Matt
GoDragRacing.com
Justin
02-08-2000, 08:07 PM
This can be done - just make sure that any files containing SSI are named .shtml - for example, if you need SSI calls within your header, it must be header.shtml.
There are other ways around this, too, but this is the simplest method.
Hope this helps.
------------------
Justin Nelson
FutureQuest (http://www.FutureQuest.net/index.php) Support
WOW! And to think I went around thinking there was no way for a year so I never even bothered to ask!
Yet another reason these forums pay for your FQ hosting many times over (even though now I don't have a site... yet).
-Tatu
StRacr
02-08-2000, 08:36 PM
wow,[nbsp][nbsp]that was fast :)
My files are named header.shtml and footer.shtml and i have
<!--#include file="back_links.txt" --> in the header file,[nbsp][nbsp]but when I go to a lower directory it just loads the "back_links.txt" from the directory thats called /ssi[nbsp][nbsp](where header.shtml is)
I was just going to put a "back_links.txt" file in each directory with the html for the links..[nbsp][nbsp] should I use something different than <!--#include file="back_links.txt" -> ???
Thanks,
[nbsp][nbsp]Matt
GoDragRacing.com
[nbsp]
Dan Kaplan
02-08-2000, 10:57 PM
I'm totally confused what's being asked and answered in this conversation, so I'll probably answer the wrong thing...[nbsp][nbsp]:)
Are you trying to figure out how to include your text file from different directories?[nbsp][nbsp]If so, you could just do:
<!--#include file="/back_links.txt" ->
assuming back_links.txt is in the /www/ directory.[nbsp][nbsp]If it's in a directory like /www/ssi/ then it would be:
<!--#include file="/ssi/back_links.txt" ->
Is that what you're looking for?
Dazed
Justin
02-08-2000, 11:09 PM
Actually you would need to use include virtual="/path/to/file.html" - not file... but that is not what he's asking...
Each page calls:
/ssi/header.shtml
/ssi/footer.shtml
Inside header.shtml you want to call a file within the current directory (of where the page is at, not where the header file is at) - but it's pulling it relative to the header file - I don't know if there is a way around this or not...
I would recommend experimenting with it until you figure it out - or include the "back_links" page from within each other page (which ruins the idea of an include within an include...)
Hope this helps....
------------------
Justin Nelson
FutureQuest (http://www.FutureQuest.net/index.php) Support
Dan Kaplan
02-08-2000, 11:22 PM
Oops, my bad on the file/virtual thing.[nbsp][nbsp]Got caught in the act cut-and-pasting...
Can you really -- or correctly -- include an HTML page within another HTML page?[nbsp][nbsp]Wouldn't that double up all the header and body tags and potentially confuse browsers?[nbsp][nbsp]Or am I still missing something here?
Doubly Dazed
[This message has been edited by Dan Kaplan (edited 02-08-00@10:22 pm)]
StRacr
02-09-2000, 12:05 AM
Thanks Justin,
[nbsp]I'll mess around with it till it works :)
Dan,
[nbsp][nbsp] The .shtml files are .txt files,[nbsp][nbsp]just renamed to work in SSI..[nbsp][nbsp]there's no body or html tags in them.
Later,
Matt
goDragRacing.com
Justin
02-09-2000, 03:41 AM
Dan,
What most people do is peice together a web page - for example, on my site (though this is PHP it's the same concept), header.php contains the meta tags (with random keywords but that's a different story), and the entire top HTML including the left hand navigation, and the start of the content cell in the table. Then footer tidy's everything up, closing the tables and ending the page. So my content pages have nothing but text,
and misc formatting tags - all tables, CSS, JS, and most PHP is all done in the header/footer :)
I think my other site is still using SSI (I have not updated it in many months and honestly do not remember... www.vdj.net (http://www.vdj.net) - pretty sure it's .shtml though :)) and for basically the same reasons.
This way, updating a copyright, adding a link, changing banners, or just about anything that would normally be redundant becomes a one-file edit. I would have it no other way :)
See also - www.aota.net (http://www.aota.net) www.FutureQuest.net (http://www.FutureQuest.net) www.HostFacts.com (http://www.HostFacts.com) - not to mention the FQ order forms, and probably a number of other sites I've had any part of - duplication of effort directly contradicts my laziness, and I must keep inner conflicts to a minimum... er, something like that ;)
------------------
Justin Nelson
FutureQuest (http://www.FutureQuest.net/index.php) Support
[This message has been edited by Justin (edited 02-09-00@02:44 am)]
Dan Kaplan
02-09-2000, 08:15 AM
Hi Justin,
I'm with you on the non-duplication thing -- I'm a straight-shootin' .shtml kinda guy![nbsp][nbsp]:)[nbsp][nbsp]What I was unclear about though, is that it appears we're talking about including an include, the second of which is an .shtml file with no proper HTML tags.[nbsp][nbsp]This seems incorrect to me.
Dopey
jbroder
02-10-2000, 01:17 AM
Not sure that I understand the topic entirely, but here is[nbsp][nbsp]an ssi that is aware where it is called from.
Index.shtml calls this script, and its job is to link all the files in the directory that called it.
$asker = $ENV{'DOCUMENT_URI'};
$asker =~ s/index.shtml//;
$basedir = $ENV{'DOCUMENT_ROOT'} . $asker;
chdir($basedir);
[nbsp][nbsp] @htmfiles=`ls -1 *html`;
etc......
Hope this helps.
Jon
Terra
02-10-2000, 02:39 AM
@htmfiles=`ls -1 *html`; I can't recommend this as it causes unnecessary forking to return back simple results...
Better:
opendir D, "./" or die "Could not open dir: $!\n";
@htmlfiles=grep { /\.html$/ } readdir D;
closedir D;
--
Terra
--Using the language for what it's worth--
FutureQuest
jbroder
02-11-2000, 02:20 AM
thanks. I'll try that instead.
vBulletin® v3.6.8, Copyright ©2000-2009, Jelsoft Enterprises Ltd.