View previous topic :: View next topic |
Author |
Message |
twiss Smarty n00b
Joined: 04 Oct 2008 Posts: 1
|
Posted: Sat Oct 04, 2008 3:46 am Post subject: Javascript error in Smarty |
|
|
HI, Could someone help me please.
I am trying to implement an AJAX script for tabs into my template but I am having difficulty with it. I obtained the script from here:
20bits dot com/projects/dynamic-ajax-tabs/
It seems to work fine in HTML but I can't quite seem to cut it in Smarty... Help please!!! ps. I'm a newbie...
This is the script...
Code: |
<div class="tabbed-pane">
<ul class='event_home_tabs' >
<div class='lit'><a href="#" class="active" id="pane1">a</a></div>
<div class='li'><a href="#" id="pane2">b</a></div>
<div class='li'><a href="#" id="pane2">c</a></div>
<div class='li'><a href="#" id="pane2">d</a></div>
</ul>
<div class='event_home_info'>
<div class="tabbed-container" id="MyPane_container">
<div id="MyPane_overlay" class="overlay" style="display: none">
<h3>Loading…</h3>
</div>
<div id="MyPane" class="pane"></div>
</div>
</div>
</div>
{* Code for Prototype *}
<script src="./templates/prototype.js" type="text/javascript"></script>
<script src="./templates/TabbedPane.js" type="text/javascript"></script>
<script type="text/javascript">
new TabbedPane('MyPane',
{
'pane1′: 'pages/pane1.html',
'pane2′: 'pages/pane2.html'
},
{
onClick: function(e) {
$('MyPane_overlay').show();
},
onSuccess: function(e) {
$('MyPane_overlay').hide();
}
});
</script> |
and this is the error I recieve...
Fatal error: Smarty error: [in home.tpl line 111]: syntax error: unrecognized tag: 'pane1': 'pages/pane1.html', 'pane2': 'pages/pane2.html' (Smarty_Compiler.class.php, line 439) in /home/worldcup/public_html/XXXXXX/include/smarty/Smarty.class.php on line 1095 |
|
Back to top |
|
Celeb Administrator
Joined: 17 Apr 2007 Posts: 1025 Location: Vienna
|
Posted: Sat Oct 04, 2008 4:46 am Post subject: |
|
|
Wrap your JavaScript around {literal}{/literal} tags so it won't get interpreted by Smarty. _________________ Darn computers always do what I tell them to instead of what I want them to do. |
|
Back to top |
|
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
Posted: Mon Jan 19, 2009 5:44 pm Post subject: Javascripts in an external file is good. |
|
|
Until you do not have to use Smarty to produce the javascripts, you can write your sciprts in an external .js file and use them with <script src='...'></script>
This does not allow you to use { and } within your template files. And, you can be saved.
By using exteral javascript files, you can win a chance of your javascripts being cached by the browser. If you write them embeded in an html output, they will not be cached.
But, still, if you must use Samarty to product embeded javascripting within an html output, you should use it. Just take care of the delimiters. |
|
Back to top |
|
colinmcc Smarty n00b
Joined: 22 Aug 2009 Posts: 1
|
Posted: Sat Aug 22, 2009 5:52 pm Post subject: |
|
|
Celeb wrote: | Wrap your JavaScript around {literal}{/literal} tags so it won't get interpreted by Smarty. |
I think you'll definitely confuse Smarty noobs like me by saying that!
You actually mean "Wrap {literal}{/literal} tags around your JavaScript so it won't get interpreted by Smarty." |
|
Back to top |
|
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
Posted: Sun Aug 23, 2009 4:14 pm Post subject: externalize the scripts |
|
|
May be.
But I also do some suggestions at the same momemnt.
Use javascripts in an external files, and link them using <script src='myfile.js'></script>, rather than writing the javascript codes immediately into your html output.
Also, do not create a condition where you need to use {literal} and {/literal} tags. The same rule applies to css as well.
Both of these rules may not be under some standards, but are highly useful, if you follow them.
Thanks. |
|
Back to top |
|
zottona Smarty n00b
Joined: 15 Oct 2009 Posts: 1
|
Posted: Thu Oct 22, 2009 4:56 am Post subject: |
|
|
How do a play a flash movie BEHIND some javascript menus I have running on a page? I currently have a javascript dropdown menu on top of my webpage (when the user mouses-over the menu, the menu expands downward). I have a flash file directly below the menu. Whenever the user mouses-over the menu, the submenu items disappear BEHIND the flash movie... making them unviewable (and unclickable). How do I make it so the flashmovie shows up BEHIND the menu? |
|
Back to top |
|
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
|
Back to top |
|
|