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
https://forums.phpfreaks.com/topic/218458-template-handling-ssi/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.