Hello,

i want to put code to every new each node.
here is that code:

<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
<a class="addthis_button_facebook" style="cursor:pointer"></a><a class="addthis_button_wykop" style="cursor:pointer"></a><a class="addthis_button_email" style="cursor:pointer"><a class="addthis_button_blip" style="cursor:pointer"></a><a class="addthis_button_twitter" style="cursor:pointer"></a></div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4d455a2044dd7376"></script>
<!-- AddThis Button END -->

But i dont want to display bookmarks on front page after every node, because when I click specifief bookmark button, I will add only main adres like www.mypage.com, not the www.mypage.com/node/44.

What can I do, to make this bookmarks visible on every node page, but be hidden on front page.

[Edited to add <code> and </code> tags: nevets]

Comments

nevets’s picture

A few thoughts

I suspect you really are interested in only output the javascript when viewing full nodes (not teasers). If that code is node.tpl.php you can use a check on $teaser like this

<?php if ( !$teaser ) : ?>
--- Javascript here ---
<?php endif; ?>

You could also use the add this module which as an option for this.

nidhhog’s picture

Yes this is it. Could you tell me also how to display code in teasers, with full functionality ( mean: bookmarks will add ex. www.mysite.com/node/42 , www.mysite.com/node/44 etc.)

?

nevets’s picture

Change (assuming this in node.tpl.php)

<div class="addthis_toolbox addthis_default_style addthis_32x32_style">

to

<div class="addthis_toolbox addthis_default_style addthis_32x32_style"
       addthis:url="<?php print url("node/$node->nid", array('absolute' => TRUE));?>"
       addthis:title="<?php print $node->title;?>"
>
jaypan’s picture

Side point: Java and JavaScript are entirely different things.

Contact me to contract me for D7 -> D10/11 migrations.