Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Putting Javascript Pop-Up in TPL file?

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
Emplehod
Smarty n00b


Joined: 04 Jan 2008
Posts: 2

PostPosted: Fri Jan 04, 2008 7:57 pm    Post subject: Putting Javascript Pop-Up in TPL file? Reply with quote

I'm new, forgive me if this is the wrong forum for this question.

I am using osDate and the main page template uses a column for menus named leftcolumn.tpl. I am trying to add an mp3 player (Wimpy) and I need to put a "Launch Player" button on this page that opens a pop-up window. Whenever I put the javascript code (generated by the Wimpy folks) into leftcolumn.tpl, the entire column disappears.

The pop-up code is as follows:

Code:
<script language="JavaScript" type="text/JavaScript">
<!--
function wimpyPopPlayer(theFile,id,stuff) {
  window.open(theFile,id,stuff);
}
//-->
</script>
<a href="javascript:;" onClick="wimpyPopPlayer('http://relationz.selfip.com/mp3s/myWimpy.html','wimpyMP3player','width=276,height=276')"><img src="http://relationz.selfip.com/mp3s/pop_up_pill.jpg" border="0" align="top"></a>


The tpl code looks like:

Code:
{strip}

<table width="80%" border=0 cellspacing=0 cellpadding=0>
<tr><td height="2"></td></tr>
{if $smarty.session.UserId != ''}
   <tr><td valign="top">
      {include file="panelmenu.tpl"}
      </td>
   </tr>
   <tr><td height="2"></td></tr>
   {if $smarty.session.active == 1 && $smarty.session.security.allowim == 1 }
      <tr><td valign="top">


      <table border="0" width="100%" id="table2" cellpadding="0" style="border-collapse: collapse" cellspacing="2">

                  
         
                  </table>

         </td>
      </tr>
      <tr><td height="2"></td></tr>
   {/if}
   <tr><td valign="top">
      </td>
   </tr>
   <tr><td height="2"></td></tr>
{else}
   <tr><td valign="top">
      </td>
   </tr>
   <tr><td height="2"></td></tr>
   <tr><td valign="top">
      {include file="stats.tpl"}
      </td>
   </tr>
   <tr><td height="2"></td></tr>
{/if}
{if $config.enable_shoutbox == 'Y' or $config.enable_shoutbox == '1'}
   <tr><td valign="top">
   {include file="shoutbox.tpl"}
   </td></tr>
   <tr><td height="2"></td></tr>
{/if}
{if $poll_data|@count > 0 }
   <tr><td valign="top">
      {include file="polls.tpl"}
      </td>
   </tr>
   <tr><td height="2"></td></tr>
{/if}
{if $adminblog|@count > 0 }
   <tr><td valign="top">
   {include file="adminblog.tpl"}
   <br />
      </td>
   </tr>
   <tr><td height="2"></td></tr>
{/if}
{if $story_data|@count > 0 }
    <tr><td valign="top">
      </td>
   </tr>
   <tr><td height="2"></td></tr>
{/if}
{if $loaded_languages|@count > 1 }
   <tr><td valign="top">
   {include file="lang_select.tpl"}
      </td>
   </tr>
   <tr><td height="2"></td></tr>
{/if}
   <tr><td valign="top">
      {$modosdate_leftcol}
   </td></tr>
   <tr><td height="4"></td></tr>
</table>
{/strip}


It would be great if someone could instruct me on how to fix this. I am not a computer novice, as I've set up my own server, a Linux IpCop router box, Apache, php, MySQL, and all my websites, but I am not that familiar with scripting.

Thanks
Back to top
View user's profile Send private message
Emplehod
Smarty n00b


Joined: 04 Jan 2008
Posts: 2

PostPosted: Fri Jan 04, 2008 8:27 pm    Post subject: Reply with quote

Sure, Dude, it's easy. Just put the pop-up code between these tags:

{literal}

<script language="JavaScript" type="text/JavaScript">
<!--
function wimpyPopPlayer(theFile,id,stuff) {
window.open(theFile,id,stuff);
}
//-->
</script>
<a href="javascript:;" onClick="wimpyPopPlayer('http://relationz.selfip.com/mp3s/myWimpy.html','wimpyMP3player','width=276,height=276')"><img src="http://relationz.selfip.com/mp3s/pop_up_pill.jpg" border="0" align="top"></a>

{/literal}

Wow, I am so great! Thank me!

HaHa. I found it out on my own. Thought I'd answer myself in case someone was searching for the same solution.

Thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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