How to add JavaScript and CSS to Smarty templates

How to write JavaScript code in Smarty template language (.tpl file),

Just add {literial} tag before and after JavaScript code like this,

<script type="text/javascript">
{literial}
// JavaScript code here
{/literial}
</script>

CSS also do the same way as JavaScript,

<style type="text/css">
{literial}
// CSS code here
{/literial}
</style>

More detail about {literial} at: http://www.smarty.net/docsv2/en/language.function.literal

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s