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

Can I include javascript in a .tpl?

 
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
rayj00
Smarty n00b


Joined: 15 Apr 2018
Posts: 3

PostPosted: Fri Nov 26, 2021 6:38 pm    Post subject: Can I include javascript in a .tpl? Reply with quote

So I am trying to implement a webrtc streaming feature in a social website application that uses PHP/Smarty. The webrtc feature runs on node and JavaScript. As I am fairly new to PHP and Smarty, I have concluded that the .tpl files are the files that actually show the website. My problem is getting some javascript to execute via the .tpl file.

Can this be done of am I barking up the wrong tree? I did do a search and pretty much came up empty.

Thanks for your help.

Ray
Back to top
View user's profile Send private message
rayj00
Smarty n00b


Joined: 15 Apr 2018
Posts: 3

PostPosted: Tue Nov 30, 2021 3:40 pm    Post subject: no replies? Reply with quote

Really? 62 views and no one can answer?
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue Nov 30, 2021 6:26 pm    Post subject: Reply with quote

Yes, this can be done. To Smarty(PHP), your TPL files are merely a byte stream. They take on HTML, JS or CSS (or any other) meaning only when viewed in the browser, long since Smarty finished its work. So, yes, you could embed literally any content in your TPL files. Even purely binary content, I did that before.

Quote:
Really? 62 views and no one can answer?

Bots are not known for being good talkers.
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