How to output php code in template

Notice: This thread is very old.
maximw
Member | 1
+
0
-

Ahoj!

There's one trouble.
Users can download PHP-scripts from my service and put it on theirs sites.
There's need to set some values in this PHP-script before download, such as user's API-token.

Can you tell me, please, how to do template that output PHP-code instead of HMTL/JS-code?

I put PHP-code in .latte file. And I tried to use Latte with {syntax double} mode, but it still show parsing error.

Thank you!

Last edited by maximw (2015-08-03 13:04)

CZechBoY
Member | 3608
+
+1
-

Show us your source of that .latte templates.

David Kregl
Member | 52
+
0
-

Hi there!

It's not that hard how it might looks like.

{php //or you can replace "php" with "?"
$foo = "my text";
echo $foo;
}
  • If in JavaScript context:
<script type="text/javascript" n:syntax="double">
	alert({{$foo->message}}); //for double syntax
</script>

Let me know if it helped or not.

Last edited by David Kregl (2015-08-04 10:10)