Handlebarsjs PHP rendering

孤者浪人 提交于 2019-11-30 03:02:15

I start a new project to do this task, its here :

https://github.com/XaminProject/handlebars.php

Not so much tested but its usable enough.

lightncandy is a pure PHP library that supports almost all features of handlebars (Does not require a PECL library)

Try mustache.php it's not the same but handlebarsjs is based on it so it's very much alike.

This heavily depends on how you are dealing with Handlebars templates. Are you embedding them in the HTML? Are you loading them separately? Are you saving them locally and then compiling? If you are embedding in HTML, you can just put some PHP tags there and you're done.

If you are loading them separately, you'll have to load the template file within PHP (e.g: file_get_contents, fopen/fread), process the information you want, and then save the file again (e.g.: file_put_contents, fopen/fwrite).

PHP can render anything. Just put your PHP open/close tags and do your magic.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!