Will do, but unfortunately I keep running into things:
Here is the code I have in the $page_info['contents'] var:
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr align="center" valign="middle">
<td width="150">{PHP}echo "hello world";{/PHP}<img src="images/pages/Cat_P00.jpg">{PHP}echo "again";{/PHP}</td>
</tr>
</table>
I am using this preg_match_all right now but it isn't giving me exactly what I need:
preg_match_all("/^(.*?)\{PHP\}(.*?)\{/PHP\}(.*?)$/",$page_info['contents'],$matches);
This gives me this:
Array
(
[0] => Array
(
[0] => <table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr align="center" valign="middle">
<td width="150">{PHP}echo "hello world";{/PHP}<img src="images/pages/Cat_P00.jpg">{PHP}echo "again";{/PHP}</td>
</tr>
</table>
)
[1] => Array
(
[0] => <table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr align="center" valign="middle">
<td width="150">
)
[2] => Array
(
[0] => echo "hello world";
)
[3] => Array
(
[0] => <img src="images/pages/Cat_P00.jpg">{PHP}echo "again";{/PHP}</td>
</tr>
</table>
)
)
Which is close but not. I can't get it to break out both.
Here is my train of thought - however derailed it may be 🙂
I would use preg_match_all to get all aspects of the content (html before {PHP}, code between {PHP}{/PHP}, html between php codes and so on)
I would then basically have it
echo $matches[1][0];
echo eval($matches[2][0]);
echo $matches[3][0];
Am I on the right track with this thought or is there a better way?