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

How to Integrate Jquery in smarty

 
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 -> Add-ons
View previous topic :: View next topic  
Author Message
klaing ny
Smarty n00b


Joined: 03 Dec 2010
Posts: 1

PostPosted: Tue Jan 18, 2011 7:23 am    Post subject: How to Integrate Jquery in smarty Reply with quote

Hi, I'm new with smarty. I want to integrate Jquery with smarty. Does anyone has sample or tutorials to integrate Jqury with smarty.

Thanks
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Tue Jan 18, 2011 8:48 am    Post subject: Reply with quote

What exactly do you mean by integrate?
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Tue Jan 18, 2011 3:02 pm    Post subject: Reply with quote

Just put jQuery in templates just like you would use it with plain HTML. Be careful using { and } tags in javascript so Smarty doesn't try to parse them as Smarty tags. Smarty 3 will ignore them if they are surrounded by white space. Otherwise use {literal}{/literal} tags around stuff you want Smarty to ignore.

Also be careful of filepaths in javascript. They are going to be relative to the URL path, not the template file or php file path.
Back to top
View user's profile Send private message Visit poster's website
Gibouille
Smarty n00b


Joined: 28 Mar 2011
Posts: 1

PostPosted: Tue Apr 12, 2011 8:04 am    Post subject: Reply with quote

I want to be able to use jquery in SMARTY and have my php constants available in the jquery context through {$smarty.const}

should my javascript be in .js or .tpl files ?

what's the deal with
<script type="text/javascript">
//<![CDATA[
//]]>
</script>

and
{literal}{/literal}
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 -> Add-ons 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