Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty POST filter issue

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Un-Dead
Smarty Rookie


Joined: 16 Jan 2012
Posts: 6

PostPosted: Thu Jan 26, 2012 3:33 pm    Post subject: Smarty POST filter issue Reply with quote

Hello, Currently I have a post filter setup that looks like this:

Code:
function smarty_postfilter_inks($compiled, Smarty_Internal_Template $template)
 {
    $pattern = '/*mpi_includes/pages/.*.php';
   preg_match($pattern, $compiled, $matches);
   $compiled = str_replace($matches[0][0], "{php}include('".$matches[0][0]."');{/php}", $compiled);
   return $compiled;
 }


Which is to take mpi_includes/pages/whatever.php and turn it into a php include statement for that page.

The template file looks like this:

Code:
{include file="inside_header.logic"}
         <div id="content">
         <div id="right">
            <h1>{{$pagetitle}}</h1>
            {{$body}}
            {* {php}include('{{$body}}');{/php} *}
            <BR>
            {* <div id="fblike">{fblike}</div> *}
            </div>
         </div>
{include file="inside_footer.logic"}


and in my php I have:

Code:
$logical->registerFilter('pre','smarty_postfilter_inks','inside.logic');



However when run the output of the code does not get replaced, and I also get error codes such as :

Code:

Warning: preg_match() [function.preg-match]: Unknown modifier 'p' in /home/lcms/public_html/mpi_includes/functions/filters/prefilters.php on line 20
Back to top
View user's profile Send private message
Un-Dead
Smarty Rookie


Joined: 16 Jan 2012
Posts: 6

PostPosted: Thu Jan 26, 2012 3:41 pm    Post subject: Reply with quote

{{$body}} will output something that looks like:

Code:
mpi_includes/pages/static.php
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP