Jump to content

Which TPL file do I need to place a function in ?


Recommended Posts

I am having problems placing a function in the right TPL file, so its seen.

 

I have tried using {literal} {/literal} however that still does not work.

 

Any ideas; Thanks.

 

I am trying to call a function to share on a facebook wall, see below;

 

 

function streamPublish(name, description, hrefTitle, hrefLink, userPrompt){

FB.ui({ method : 'feed',

message: userPrompt,

link : hrefLink,

caption: hrefTitle

});

 

}

 

 

function publishStream(){

streamPublish("myproduct", 'This product is cool ', 'test', 'http://www.w.net/w.html', "test");

}

 

 

 

 

<div onClick="publishStream();"

style="position:absolute;display: block; cursor:pointer; ">

<img src="{$base_dir}themes/test/img/share.png">

</div>

Link to comment
Share on other sites

Which TPL file do I need to place a function in ?

That depends on where you want the snippet. Did you warp the JS in script tags

something like

<script type="text/javascript">
{literal}
function streamPublish(name, description, hrefTitle, hrefLink, userPrompt){
 FB.ui({
method : 'feed',
message: userPrompt,
link : hrefLink,
caption: hrefTitle
 });
}

function publishStream(){
 streamPublish("myproduct", 'This product is cool ', 'test', 'http://www.w.net/w.html', "test");
}
{/literal}
<script>
<div onClick="publishStream();"
style="position:absolute;display: block; cursor:pointer; ">
<img src="{$base_dir}themes/test/img/share.png">
</div>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...