|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Un-Dead Smarty Rookie
Joined: 16 Jan 2012 Posts: 6
|
Posted: Thu Jan 26, 2012 3:33 pm Post subject: Smarty POST filter issue |
|
|
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 |
|
Un-Dead Smarty Rookie
Joined: 16 Jan 2012 Posts: 6
|
Posted: Thu Jan 26, 2012 3:41 pm Post subject: |
|
|
{{$body}} will output something that looks like:
Code: | mpi_includes/pages/static.php |
|
|
Back to top |
|
|
|
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
|