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

Javascript error 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 -> Documentation
View previous topic :: View next topic  
Author Message
twiss
Smarty n00b


Joined: 04 Oct 2008
Posts: 1

PostPosted: Sat Oct 04, 2008 3:46 am    Post subject: Javascript error in Smarty Reply with quote

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


Joined: 17 Apr 2007
Posts: 1025
Location: Vienna

PostPosted: Sat Oct 04, 2008 4:46 am    Post subject: Reply with quote

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
View user's profile Send private message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Mon Jan 19, 2009 5:44 pm    Post subject: Javascripts in an external file is good. Reply with quote

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
View user's profile Send private message Visit poster's website
colinmcc
Smarty n00b


Joined: 22 Aug 2009
Posts: 1

PostPosted: Sat Aug 22, 2009 5:52 pm    Post subject: Reply with quote

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! Confused

You actually mean "Wrap {literal}{/literal} tags around your JavaScript so it won't get interpreted by Smarty."
Back to top
View user's profile Send private message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Sun Aug 23, 2009 4:14 pm    Post subject: externalize the scripts Reply with quote

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
View user's profile Send private message Visit poster's website
zottona
Smarty n00b


Joined: 15 Oct 2009
Posts: 1

PostPosted: Thu Oct 22, 2009 4:56 am    Post subject: Reply with quote

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
View user's profile Send private message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Thu Oct 22, 2009 5:17 am    Post subject: Use wmode Reply with quote

You may use wmode=true in your parameter.

I found a link for you:
http://www.longtailvideo.com/support/forum/Setup-Problems/16386/how-to-set-player-to-wmode-transparent-
Back to top
View user's profile Send private message Visit poster's website
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 -> Documentation 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