SSI and CGI : Capture a value?
This isn't an SSI or a CGI board, but I hear ColdFusion is quite SSI related, and it's the best place for this question I hope.
I'm wondering if it's possible to do something like this:
"html" page (actually XSL transformed XML page) has an SSI #include or #exec, then an SSI #if statement that does "something" based on a computation in the CGI...
Here's my questions with relation to that..
If I nest SSI functions will they be called in child > parent order or parent > child order? Can I read/write form/environment parameters in the CGI and read them back in the SSI #if?
I may have no need to do this eventually, but I only want my target modder-base to need to alter XSL files (to change style etc) and not look at CGI scripts... CSS is ok but not quite good enough, and I don't want to "read" XSL files in the CGI to simulate seamlessness... :( Any helper will get big shouts on my new site!
^_-
Matt
MattEvans
Veteran Poster
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64
It was very simple actually. I didn't need to use SSI #ifs atall! The file gets parsed before the XSLT does any work, so:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl=" <a href="http://www.w3.org/1999/XSL/Transform">http://www.w3.org/1999/XSL/Transform</a> " version="1.0">
<xsl:template name="logincontrols">
<xsl:variable name="userID"><!--#include virtual="../../cgi/sustain.cgi"--></xsl:variable>
<xsl:choose>
<xsl:when test="$userID = '-1'">
[Display some login-related info here]
</xsl:when>
<xsl:otherwise>
[Display some user-specific info here]
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
works just fine, because by the time the template is called, the user's id number (or -1) for null is in that variable. Pretty cool, pretty cool. I have a custom MIME type "SSIXSL" to avoid parsing every XSL file every time...
XSL is pretty fantastic.
MattEvans
Veteran Poster
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64