Including Link Vault from SSI
When I wrote my previous post about Including Link Vault from Languages other than PHP, I wasn’t aware of a special quirk about Server Side Includes(SSI).
The #include virtual SSI element can be used to include the results of a program executed via a CGI interface. In this case, we use a PHP program. When SSI makes a sub-request to execute the program, it changes all the server variables to reflect the new request except REQUEST_URI. Since the Link Vault client software prefers to grab the url key from the REQUEST_URI, we can use this to our advantage.
Place the following code in a file called wrapperssiXXXXXXXXX.php in the same directory as your lvXXXXXXXXX.php file. Replace the X’s with your LV security code.
< ?php
// This is meant to be called via an #include virtual using Server Side Includes(SSI)
// The LV client software gives preference to the REQUEST_URI server variable for determining the correct url key.
// Since SSI leaves REQUEST_URI set to the url of the original SSI page instead of the #include virtual url,
// all that's needed is to include the LV client software and call the DisplayLinks() function.
require_once('lv7fzcWOCj8QjmHZH5.php');
print DisplayLinks(5,'',' - ','','');
exit;
?>
To use wrapperssiXXXXXXXXX.php use the following instruction:
<!–#include virtual=”/wrapperssiXXXXXXXXXXX.php” –>
This is a link to an SSI page with Link Vault that uses wrapperssiXXXXXXXXXXX.php to include links.
The wrapper code I created in my previous post, is a general solution for all languages. It accepts the correct Link Vault url key in the LINK_VAULT_UrlKey query string variable. This is necessary because when you include the output of a CGI program in other languages like Perl, REQUEST_URI is updated to reflect the url of the CGI program, not the original Perl script that called it.