btwael / mammouth

Unfancy PHP
http://mammouth.boutglay.com
MIT License
214 stars 22 forks source link

request for string interpolation #46

Open jots opened 9 years ago

jots commented 9 years ago

It would be great if mammouth supported interpolation like coffeescript (and ruby): http://coffeescript.org/#strings "hello #{firstname} #{lastname || 'default'}"

also regex like ruby: print $1 if a =~ /string(.*)/

sanotto commented 9 years ago

you can do interpolation in this way: {{ result = 128 echo "This is the result: $result" }}

it will translate to:

<?php $result = 128; echo "This is the result: $result"; ?> This is an unintended side effect not a feature but it comes close to your needs

Manaus commented 9 years ago

+1 for interpolation, writing <a href="<?php echo './pages'.$thepage ?>"><?php echo $foo ?></a> or echo "<a href='./pages/$thepage'>$foo</a>" is quite a pain (I don't even know if I wrote it right)

btwael commented 8 years ago

Will be added soon, now mammouth (github master version) supports html interpolation, see #54