News for hackers. Stuff that matters.
Re:PHP 7 Virtual Machine by DenisM on Monday April 17, 2017 @01:37AM (#14129385)
Perhaps you can send me down the righ path?

I want my users to be able to send emails from their iPads, and those emails would be generated based on templates. There will be many such templates built in, and eventually users will be able to hire web developer-type person to make custom templates.

My thinking was that PHP is the most popular language for that sort of thing, so it would be nice if could support that. My second choice is handlebars. I'm not sure if JSX would do the job?

Any thoughts appreciated.

Re:PHP 7 Virtual Machine by jawngee on Monday April 17, 2017 @01:45AM (#14129402)
Re:PHP 7 Virtual Machine by my_ghola on Monday April 17, 2017 @02:33AM (#14129548)
PHP is not a templating language. You can build a template engine with it, but then, you can build one with any other language.

If your app is in swift or objective-c, look into template libraries for those languages. Simple Google search tells me there's a couple of options including one using handlebar's format.

Re:PHP 7 Virtual Machine by DenisM on Monday April 17, 2017 @10:25AM (#14131058)
How is this not a template? It generates valId HTML out of data.

  <?php 
  for ($x = 0; $x <= 10; $x++) {
    echo "The number is: $x   <br>";
  } 
?>
Re:PHP 7 Virtual Machine by nathan_f77 on Monday April 17, 2017 @08:29AM (#14130458)
If you just need formatting without logic, then you could use something like Markdown.

Someone else already mentioned GRMustache [1], and that looks pretty good.

I'm not sure if there is an iOS version, but you could look for something like liquid [2]. I think liquid is usually a better choice for user-controlled templates, especially when you're rendering on a server. But if they're just compiling the templates on their own device, then handlebars (GRMustache) would be the right way to go.

[1] https://github.com/groue/GRMustache

[2] https://github.com/Shopify/liquid

Re:PHP 7 Virtual Machine by jwdunne on Monday April 17, 2017 @01:48AM (#14129409)
If solely for templating emails, I would go with handlebars.

You could use PHP but then you have a whole host of other stuff that you don't want or need in a templating language.

Re:PHP 7 Virtual Machine by LinuxFreedom on Monday April 17, 2017 @06:53AM (#14130186)
Re:PHP 7 Virtual Machine by fdsfsda7fsda on Monday April 17, 2017 @05:09AM (#14129934)
Re:PHP 7 Virtual Machine by bencoder on Monday April 17, 2017 @09:11AM (#14130630)
I don't think there are implementations of twig outside of PHP, so this isn't useful for the op
Re:PHP 7 Virtual Machine by fdsfsda7fsda on Monday April 17, 2017 @10:56AM (#14131283)
there is I use JTwig with Java + Spring all time

same syntax