Welcome to Geeklog, Anonymous Saturday, August 31 2024 @ 11:47 pm EDT
Geeklog Forums
Social bookmarking hack
Status: offline
justrage
Forum User
Newbie
Registered: 06/23/07
Posts: 10
Here is a pretty painless hack to add social bookmarking to your site. I know there is a plugin that does this all ready but this script requires almost nothing extra from your hosting service (if your worried about performance).
I posted this onto hacks plugins but not too sure it it belongs there. If you want to download the file you can get it from http://www.techtricks.org/?p=11
You can see an example on www.justrage.com (top right corner and each story posted).
1) Open your head.thtml file for your theme(s) (/layouts/yourtheme/head.thtml).
2) Search for {menu} or place this where ever you perfer to have it displayed:
<script type="text/javascript">
<!--//
a2a_config = {linkname:'YOUR_SITE_NAME_HERE', linkurl:'http://YOUR_WEBSITE_HERE', onclick: 'true',prioritize:["slashdot", "myspace", "fark", "wordpress", "reddit", "stumbleupon", "google_bookmarks", "friendfeed"]};
//-->
</script>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
3) Save this file and load up your website to confirm the link is working.
4) Next open your storytext.thtml file (located in layout/YOUR_THEME/storytext.thtml) Add the following code where ever you want it disp
<div class="a2a_kit a2a_default_style">
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_120_16.gif" width="120" height="16" border="0" alt="Share/Bookmark"/></a></div>
<script type="text/javascript">
a2a_config.linkname = '{story_title}';
a2a_config.linkurl = '{article_url}';
a2a.init('page');
</script>
5) Save storytext.thtml and load your website to confirm it is displaying correctly. Change position until you find a good position within your site.
How does this all work?
When your page loads the javascript is executed and the first button is generated with the correct links/css. After this first loading of the javascript
the script is now called executed for each article that is displayed. by doing it this way we only have 1 javascript to load and its loaded only once and simply executed as needed!
I posted this onto hacks plugins but not too sure it it belongs there. If you want to download the file you can get it from http://www.techtricks.org/?p=11
You can see an example on www.justrage.com (top right corner and each story posted).
1) Open your head.thtml file for your theme(s) (/layouts/yourtheme/head.thtml).
2) Search for {menu} or place this where ever you perfer to have it displayed:
Text Formatted Code
<a class="a2a_dd header-navigation" href="http://www.addtoany.com/share_save">Share</a><script type="text/javascript">
<!--//
a2a_config = {linkname:'YOUR_SITE_NAME_HERE', linkurl:'http://YOUR_WEBSITE_HERE', onclick: 'true',prioritize:["slashdot", "myspace", "fark", "wordpress", "reddit", "stumbleupon", "google_bookmarks", "friendfeed"]};
//-->
</script>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
3) Save this file and load up your website to confirm the link is working.
4) Next open your storytext.thtml file (located in layout/YOUR_THEME/storytext.thtml) Add the following code where ever you want it disp
Text Formatted Code
<div class="a2a_kit a2a_default_style">
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_120_16.gif" width="120" height="16" border="0" alt="Share/Bookmark"/></a></div>
<script type="text/javascript">
a2a_config.linkname = '{story_title}';
a2a_config.linkurl = '{article_url}';
a2a.init('page');
</script>
5) Save storytext.thtml and load your website to confirm it is displaying correctly. Change position until you find a good position within your site.
How does this all work?
When your page loads the javascript is executed and the first button is generated with the correct links/css. After this first loading of the javascript
the script is now called executed for each article that is displayed. by doing it this way we only have 1 javascript to load and its loaded only once and simply executed as needed!
12
11
Quote
Status: offline
suprsidr
Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
Just a FYI - where you have:
both site_name and site_url are available in storytext.thtml and featuredstorytext.thtml
so that would be:
Makes it more cookie cutter
Oh and you'd also want this in featuredstorytext.thtml as well.
I applied this to mysite a couple of years ago... I had always meant to share... glad you did![Smile Smile](https://www.geeklog.net/forum/image_set/pixel.gif)
-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
Text Formatted Code
linkname:'YOUR_SITE_NAME_HERE', linkurl:'http://YOUR_WEBSITE_HERE'both site_name and site_url are available in storytext.thtml and featuredstorytext.thtml
so that would be:
Text Formatted Code
linkname:'{site_name}', linkurl:'{site_url}'Makes it more cookie cutter
Oh and you'd also want this in featuredstorytext.thtml as well.
I applied this to mysite a couple of years ago... I had always meant to share... glad you did
![Smile Smile](https://www.geeklog.net/forum/image_set/pixel.gif)
-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
12
10
Quote
All times are EDT. The time is now 11:47 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content