|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
umakantp Smarty n00b
Joined: 19 Feb 2015 Posts: 1
|
Posted: Thu Feb 19, 2015 6:50 am Post subject: Using Smarty in PHP and Javascript both |
|
|
You have been using Smarty in PHP and want to use it Javascript as well.
Here is the answer:- jSmart https://github.com/umakantp/jsmart
Usually you render all your template via PHP but say you want a modal dialog or anything to be shown via Javascript. You are normally left with two options.
1. Get the parse template from PHP via Ajax or so and show that
2. Write hard codded HTML in Javascript.
Using jSmart now you have 3rd option. You can now share templates with PHP and Javascript and both can make use of same templates.
Read template and parse in Javascript using jSmart. It normally supports all the syntax of Smarty 3.
Functions which are PHP specific like if you are using isset, empty...etc. These functions can be defined in Javascript as well and put to work. If you go to git repositories documentation you can see various examples of how to use it. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sat Jul 11, 2015 9:49 pm Post subject: |
|
|
I like this project. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|