Help - Search - Members - Calendar
Full Version: SSI conditional help
HTMLHelp Forums > Programming > Server-side Scripting
Harley
I have been rewriting my fathers web site with server side includes to make future editing easier and faster.
colorwrite.webs.com
My web hosting service is running Apache/1.3.39 (Unix) mod_jk/1.2.26 mod_layout/3.2 mod_gzip/1.3.19.1a mod_throttle/3.1.2
No, they do not support php, and they have no idea they support ssi.

My question is can a fsize or flastmod be sent to a variable? or even better, used directly in an if directive?
I would like to keep my photo gallery images and descriptions in the same folder to find and edit them easily rather than wading through a massive html file like I was just a week ago. And also be able to reuse the descriptions on other pages.

-I have seen what I want to do several times in a google search, but my server does not seem to allow directives within directives like this...
<!--#config errmsg=""-->
<--#if expr="<!--#flastmod file="$fn/$ct.txt"--> != //" -->
<!--#include file="$fn/$ct.txt"-->
<--#else -->
No description for $fn/$in$ct.jpg, move on to next
<--#endif -->

-I have also seen this wich seems to only work in Apache/2
<!--#if expr="-A /$fn/$ct.txt"-->
<!--#include file="$fn/$ct.txt"-->
<!--#else -->No text for $in$ct.jpg
<!--#endif -->


-This is my current code (abbreviated), it works, but has limitations.
-contents of topic.html
<!--#set var="in" value="image name" -->
<!--#set var="fn" value="folder name" -->
<!--#set var="ct" value="01" --><!--#include file="list.shtml" -->
<!--#set var="ct" value="02" --><!--#include file="list.shtml" -->
and repeat
-contents of list.shtml
<!--#set var="ip" value=".html/gallery/project/$fn/$in" --> <!-- image path_info for link -->
<!--#set var="lnk" value="$pp$fn$ip$ct" --> <!-- link to image number whatever -->
<!--#set var="tp" value="$pp$fn/$in$ct.jpg" --> <!-- path to thumbnail number whatever -->
<li>
<a href="<!--#echo var="lnk" -->">
<img src="<!--#echo var="tp" -->">
<span>
<!--#config errmsg="No text for $in$ct.jpg"-->
<!--#include file="$fn/$ct.txt" -->
</span></a></li>
pandy
QUOTE(Harley @ Apr 18 2009, 06:41 AM) *

My question is can a fsize or flastmod be sent to a variable? or even better, used directly in an if directive?


Yes, but the syntax you use is all wrong. You can't nest directives for starters. I got a severe case of dumbness right now and have to go to beed in a hurry, but a think the solution lies here. tongue.gif
http://httpd.apache.org/docs/2.2/mod/mod_i...ml#substitution

Honestly, I know this can be done, but I'm not sure how to write it. I'll try tonight (it's morning now) if you haven't figured it out on your own by then, but I can't promise I can do it. Those dollar signs always get me. Hopefully Darin or someone else can straight this out.
Harley
I found this example today and it doesn't seen to work either?
There must be a way to do this, I have seen many examples that do not seem to work, is everyone else wrong, or did I miss something simple?

<!--#fcreated virtual="TEST.TXT" fmt="?" -->
<!--#if var={THE_FILE_NAME} eqs="" -->
File does not exist!
<!--#else -->
File exists!
<!--#endif -->
pandy
Hi, I spoke out of turn yesterday. It seems your first example is legit. But I think you have the quotes wrong. You have double quotes everywhere, like this.
CODE
<--#if expr="<!--#flastmod file="$fn/$ct.txt"--> != //" -->

Try to alternate double and single quotes, like this.
CODE
<--#if expr='<!--#flastmod file="$fn/$ct.txt"--> != //' -->


I haven't tried the whole thing. I just did this, which worked
CODE
<!--#if expr='<!--#flastmod value="test.txt" --> != //' -->
YES!
<!--#endif -->
Harley
Valiant effort, but still no dice. I can't believe how many 404s I have encountered looking for this info.
After Googling for about an hour I found this passage which seems to suggest the problem is the server version not allowing nested directives.
QUOTE
"All the information relates to PHP4 and Apache 1.3. Little appears to have changed with PHP5 but Apache 2.x seems on first glance to allow a more flexible approach to nesting SSI and PHP."

Perhaps the answer is to eliminate the IF ELSE and allow it to fail quietly on the client end, filling up the error log on the server end.
I would attempt to contact WEBS.COM, but they insist ssi is not enabled on their servers, and my Premium user support tickets take up to a week for flakey, sometimes horribly incorrect answers. They do not have an e-mail address.
I would cry if they found out the truth and turned ssi off.
pandy
I'm stumped too. I've never tried this before. Didn't my simple snip work either? If not, I guess it's the server. They run Apache 1.3?
Harley
Yes, they are
QUOTE
My web hosting service is running Apache/1.3.39 (Unix) mod_jk/1.2.26 mod_layout/3.2 mod_gzip/1.3.19.1a mod_throttle/3.1.2


I did get it running, I can ony imagine what their error log looks like without the If directives wacko.gif

example here:gallery/project/39oiltank.html
grykolip
i tryed to get it running but i coludnt sad.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.