SSI and CGI : Capture a value?

Reply

Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

SSI and CGI : Capture a value?

 
0
  #1
Sep 4th, 2006
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
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: SSI and CGI : Capture a value?

 
0
  #2
Sep 5th, 2006
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:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:xsl="<a rel="nofollow" class="t" href="http://www.w3.org/1999/XSL/Transform" target="_blank">http://www.w3.org/1999/XSL/Transform</a>" version="1.0">
  3. <xsl:template name="logincontrols">
  4.  
  5. <xsl:variable name="userID"><!--#include virtual="../../cgi/sustain.cgi"--></xsl:variable>
  6.  
  7. <xsl:choose>
  8. <xsl:when test="$userID = '-1'">
  9. [Display some login-related info here]
  10. </xsl:when>
  11. <xsl:otherwise>
  12. [Display some user-specific info here]
  13. </xsl:otherwise>
  14. </xsl:choose>
  15. </xsl:template>
  16.  
  17. </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.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for ColdFusion
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC