|
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 |
Andrew_M Smarty n00b
Joined: 04 Mar 2015 Posts: 2
|
Posted: Wed Mar 04, 2015 3:05 pm Post subject: Using a javascript function of an included file |
|
|
Hi,
I have a tpl file in which I included another tpl file containing some javascript functions. The question is: how can I call these functions in included file?
Do I have to declare them in the included file? How?
Sorry if the question seems dumb, I'm new at smarty and found nothing that explains my doubt
Thanks! |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Mar 04, 2015 5:29 pm Post subject: |
|
|
You can't. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Mar 06, 2015 2:05 am Post subject: |
|
|
AnrDaemon wrote: | You can't. |
This is wrong.
Once a template containing javascript functions is loaded these functions are known by your browser and you can call them anywhere. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Mar 06, 2015 2:07 am Post subject: |
|
|
How's it related to Smarty and PHP? |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Mar 06, 2015 2:19 am Post subject: |
|
|
AnrDaemon wrote: | How's it related to Smarty and PHP? |
If you define a javascript function in a template with <script type="text/javascript"> it's kown by the browser once the template is loaded and it can be called from any template. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Mar 06, 2015 2:26 am Post subject: |
|
|
Smarty is a template engine written in PHP.
If you managed to add JavaScript interpreter into it, I didn't see it in announce, sorry. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Mar 06, 2015 2:32 am Post subject: |
|
|
AnrDaemon wrote: | Smarty is a template engine written in PHP.
If you managed to add JavaScript interpreter into it, I didn't see it in announce, sorry. |
I think the question was how to call the functions in included tpl files. |
|
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
|