Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#48744 - 01/12/2001 20:45 Server Side Includes (SSI) questions...
hybrid8
carpal tunnel

Registered: 12/11/2001
Posts: 7738
Loc: Toronto, CANADA
Ok, I just (shaddap!) started using SSI for a couple of pages, one of which is the matrix I posted about in the general forum. I've been meaning to use them for a long time, but never got around to it. (read note at bottom)

Anyway, I'm currently using using a few tags in my matrix pages: 1 to reformat the date string, 1 to print the date of the body-text document and 1 to feed the body-text document at the end of one of the main shtml files.

Currently I have two shtml files: "index" and "small"

The object is to have one page, but with two looks. A regular wide look and one that allows smaller formatting with some different graphics. I'd love to be able to have only the index file containing what's currently in the body and put the size-specific info into different files. Then when a link (or button if it needs to be that way) is clicked, set a variable and reload the page. When the page is reloaded I can use a conditional to check that variable and sub in the correct graphics.

So, my question finally.... What's the easiest way to do this? Specifically, the easiest way to set any type of variable that can both be checked by an SSI conditional and will persist through a document load?

Just while writing this I thought perhaps of using a forum button with a hidden value instead of the hyperlink I currently have at the top left. The conditional should be able to check forms values. Any other ways around this?

Ok, that's it. Pretty simple. :)

Bruno

Note mentioned at top:
I designed an entire semi-dynamic site with javascript and 1 person out of the thousands that visited harped on me for having used jscript. He was only willing to use Lynx and of course that didn't support jscript. Of course it also doesn't support graphics and that was one of the focus points of the site. I just can't figure some people out. :) In any case, SSI can be used to do some of the stuff I had been doing with jscript - but I still think it would be a nightmare to reimplement anything like what I did using only SSI. Ugh.
_________________________
Bruno
Twisted Melon : Fine Mac OS Software

Top
#48745 - 02/12/2001 07:09 Re: Server Side Includes (SSI) questions... [Re: hybrid8]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31565
Loc: Seattle, WA
You could always do it in ASP.
_________________________
Tony Fabris

Top
#48746 - 02/12/2001 08:14 Re: Server Side Includes (SSI) questions... [Re: tfabris]
drakino
carpal tunnel

Registered: 08/06/1999
Posts: 7868
You could always do it in ASP.

Eww...

But anyway, if you have access to either PHP or ASP on the server (any decent host will have one of these at a minimum), it would probably be the easiest route. I don't remember SSI being that great for what you are wanting to do with combining the two files into one. Then again, the last time I used it was a few years back under Apache.

Top
#48747 - 02/12/2001 08:25 Re: Server Side Includes (SSI) questions... [Re: drakino]
drakino
carpal tunnel

Registered: 08/06/1999
Posts: 7868
And I'll even be nice and provide a simple PHP script to do this. First, put your common header into the file. Then, when you get to the point where the two differ, do this:

< ?php if($smalldoc==1) { ? >
Put your small stuff here
< ?php } else { ? >
Big stuff goes here
< ?php } ? >

Then put your common footer of the page here at the bottom. To switch back and forth, create a link to file.php?smalldoc=1 or just to the file.php. When the ?smalldoc=1 is in the URL, it should display the small format version.

Top
#48748 - 02/12/2001 10:20 Re: Server Side Includes (SSI) questions... [Re: drakino]
hybrid8
carpal tunnel

Registered: 12/11/2001
Posts: 7738
Loc: Toronto, CANADA
Cool. I'm going to try that. My host is running Apache on Linux and should have the latest PHP installed. If not, I'll ask him to put it online.

The entire reason I began with the SSI was just to get away from any client-side work and to keep the "code" content in the pages to a bare minimum.

Another question... If I go the PHP route I'll need to replace two lines of SSI I have in there right now. Think you can provide me with the info for that too?

I need to be able to output the date that the file was last modified on and output that in the form "MONTH DAY YEAR" With SSI I do one reformat for the date and then one echo to print it.

Also, since I've never used any non-html pages to initiate a session, how should I structure the index file just in case someone doesn't type the PHP document name?

Thanks.

And Tony... No, NO ASP please. :) BTW, I did find that there's a version that will run under unix that I didn't know about - it's a useful suggestion to whomever was looking for a new ASP-capable host a few days ago.

Bruno
_________________________
Bruno
Twisted Melon : Fine Mac OS Software

Top
#48749 - 02/12/2001 14:59 Re: Server Side Includes (SSI) questions... [Re: hybrid8]
xavyer
member

Registered: 19/12/1999
Posts: 117
Something like this:

<?php date("m/d/y g:i:s A", filemtime("path_to_file/filename")); ?>

should do the trick. Also, there is an online manual for php at:

http://www.php.net/manual/en/

Top
#48750 - 02/12/2001 15:52 Re: Server Side Includes (SSI) questions... [Re: xavyer]
drakino
carpal tunnel

Registered: 08/06/1999
Posts: 7868
I usually use this on mine:
< ?php echo "Last modified: ".date( "F d Y H:i:s.", getlastmod() ); ? >
The getlastmod() command looks at the current file. And it also works when the command is actually in a shared file elsewhere. (I usually dump the common header/footer stuff into a seperate PHP file for easy changing. The old empeg logo site this this at a basic level, and RioCar.org does this quite a bit.

Top
#48751 - 02/12/2001 16:14 Re: Server Side Includes (SSI) questions... [Re: drakino]
xavyer
member

Registered: 19/12/1999
Posts: 117
I guess I misunderstood. I thought that hybrid8 was after the modification time of a supporting file.

Top
#48752 - 02/12/2001 21:10 Re: Server Side Includes (SSI) questions... [Re: xavyer]
hybrid8
carpal tunnel

Registered: 12/11/2001
Posts: 7738
Loc: Toronto, CANADA
Since coverting the command portions of the file to PHP instead of SSI, I can do away with the secondary datafile. So all I need to do is check the modified date of the current file. But your line will come in handy in the future as well, thanks.

Though I suppose I should get a book. Can anyone recommend any good PHP starter books? I don't have a problem with programming methodology and concepts, but the syntax and any language-specific oddities are what I'm most concerned with. Then of course learning whatever external support information I need (apache-specific stuff, etc...)

I've put the new page up. I changed the old index file to redirect (jscript top.location) to the new. I would have just left out the old file, but unfortunately I've used it in posted URLs.

Thanks Drakino for messaging me earlier with the added bits for the date. I also put in some extra echos to simulate portions of HTML comment tags. These cancel out a couple of comment tags in the HTML. This has the benefit of allowing me to comment out an entire section of the file to allow for editing in GoLive, and then have it ignored (because of the php canceling out the comments) when output through the server. :)

Seems to all be working like a charm.

Incidentally, I've also corrected a few more items, including some mods to the PhatBox portions (it's using a FAT32 partition I just found out today).

Bruno
_________________________
Bruno
Twisted Melon : Fine Mac OS Software

Top