Jump to content

Template Handling SSI


AtomicRax

Recommended Posts

I'm trying to develop a website file manager. I want to allow SSI, and would like to handle it specifically..

 

$regexp = "<!--#include\s[^>]*virtual=(\"??)([^\" >]*?)\\1[^>]*\/-->"; 
if(preg_match_all("/$regexp/siU", $body, $matches, PREG_SET_ORDER)) {
foreach($matches as $match) {
$includeFile = $match[2];
} }

 

This snippet shows how you would get the included file path in the SSI code of the website body [ the $body tag ], but I don't need to just find it- I want to replace the SSI code with a simpler code in the HTML that appears in the editor for easy management.. Then switch back from my easier code to the actual SSI code..

 

Example:

 

Replace

<!--#include virtual="/newsManager/output.php"-->

 

With

{INCLUDE=/newsManager/output.php}

 

THEN when the user saves the page,

 

Replace

{INCLUDE=/newsManager/output.php}

 

With

<!--#include virtual="/newsManager/output.php"-->

 

 

Is there an easy fix or should I just switch to a full blown template engine.. even though this is the only required feature?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.