Created
June 16, 2011 21:16
-
-
Save j/1030308 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# header content stored in database | |
<div id="wrapper"> | |
<div id="header"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# body content stored in database | |
<div id="form-content"> | |
<div id="creativebody" style="padding-top: 0 !important; padding-left: 32px; padding-right: 32px; margin-bottom: 20px"> | |
<div id="offers"> | |
<div class="offer"> | |
{php} echo 'Hello!'; {/php} | |
{php} | |
$array = array(1,2,3,4,5); | |
foreach ($array as $value) { | |
echo $value . "<br>"; | |
} | |
{/php} | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="clear"></div> | |
<a href="{{ redirectUrl }}" id="click-now" target="_blank"><div id="footergraphic"></div></a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# footer content stored in database | |
<div style="font-size: 12px; margin: 10px 0; text-align: center"> | |
The third-party product names, logos, brands, and trademarks shown on this website are the property of their respective owners. These companies are not affiliated with ________________. | |
</div> | |
<div id="footer" style="padding-top: 0;"> | |
<a target="_blank" class="footer" href="/privacy.php">Privacy Policy</a> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace JStout\MainBundle\Component\Twig\Extension; | |
use Twig_Extension, | |
Twig_Filter_Method, | |
Twig_Environment; | |
class Parser extends Twig_Extension | |
{ | |
public function getFilters() | |
{ | |
return array( | |
'allow_php' => new Twig_Filter_Method($this, 'twig_allow_php_filter', array('needs_environment' => true)), | |
); | |
} | |
function twig_allow_php_filter(Twig_Environment $env, $value, $startTag = '<?php', $endTag = '?>') | |
{ | |
if (false !== strpos($value, $startTag)) { | |
if ($startTag !== '<?php' && $endTag !== '?>') { | |
$value = preg_replace('/'.str_replace('/', '\\/', $startTag).'(.*?)'.str_replace('/', '\\/', $endTag).'/s', '<?php $1 ?>' , $value); | |
} | |
eval('?>' . $value . '<?php'); | |
return ''; | |
} | |
return $value; | |
} | |
public function getName() | |
{ | |
return 'parser'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment