Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Using a javascript function of an included file

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Andrew_M
Smarty n00b


Joined: 04 Mar 2015
Posts: 2

PostPosted: Wed Mar 04, 2015 3:05 pm    Post subject: Using a javascript function of an included file Reply with quote

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! Razz
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed Mar 04, 2015 5:29 pm    Post subject: Reply with quote

You can't.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Fri Mar 06, 2015 2:05 am    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Mar 06, 2015 2:07 am    Post subject: Reply with quote

How's it related to Smarty and PHP?
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Fri Mar 06, 2015 2:19 am    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Mar 06, 2015 2:26 am    Post subject: Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Fri Mar 06, 2015 2:32 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP