$contents=' <p>Hello {{$username}}, here's a list of all the users:</p> <div id="accounts"> @if (count($accounts) <= 0): No accounts found. @else: Is account. </div>'; $contents = preg_replace( array( "/{{/", "/}}\n/", "/}}/", "/\[\[/", "/\]\]/", '/^\s*@(.*)$/m', '/\[:\s*block\s(.*)\s*:\](.*)\[:\s*endblock\s*:\]/Usm', ), array( $autoEscape ? ")); ?>\n\n" : "); ?>\n\n", $autoEscape ? ")); ?>" : "); ?>", "<?php ", " ?>", "<?php \\1 ?>", "<?php if (array_key_exists('\\1', \$this->inheritBlocks)) { print(\$this->inheritBlocks['\\1']); } else if (\$this->inheritFrom === NULL) { ?>\\2<?php } else { ob_start(); ?>\\2<?php \$this->inheritBlocks['\\1'] = ob_get_contents(); ob_end_clean(); } ?>", ), $contents ); return($contents); }
Dostaję coś takiego:
Hello , here's a list of all the users:
No accounts found. Is account.
Czyli w ogole nie zamienia {{}} bo specjalnie dałem tam preg_replace rzed wszystkim slowo "string"
Nie wyświetla if i else ale waruek olewa i wyswietla każdą możliwość