Bookmark Us Script

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 01-14-2009, 10:33 PM
New Pligger
 
Join Date: Jul 2007
Posts: 12
Hello,

I am trying to add a javascript "Bookmark Us" script so users can simply add us to thier favorites but having problems finding where to put the code. Does anyone know how to do this?

Dynamic Drive DHTML Scripts- Bookmark Site script

Code:
<script type="text/javascript">

Step 1: Add the below code to the <head> section of your page:

/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}
</script>
Code:
Step 2: Create either an image or text link that will be used as the Bookmark Site link. For the href attribute, use the following code:

javascript:bookmarksite('title_of_site', 'url_of_site')Here's an example:

<a href="javascript:bookmarksite('Dynamic Drive', 'http://www.dynamicdrive.com')">Bookmark this site!</a>
Remember, if your site's title contains apostrophes, they need to be backslashed when entered:

<a href="javascript:bookmarksite('Mike\'s Place', 'http://www.google.com')">Bookmark this site!</a>
Reply With Quote
  #2 (permalink)  
Old 01-14-2009, 11:38 PM
Yankidank's Avatar
Pligg Founder/Coder/Designer
Pligg Version: SVN
Pligg Template: Wistie
 
Join Date: Dec 2005
Location: Ocala, FL
Posts: 4,934
Send a message via AIM to Yankidank
any javascript used in tpl files needs {literal} and {/literal} tags wrapped around them.
First part could put in pligg.tpl
Second part could be placed wherever you want, you will probably find a spot in it using pligg.tpl too.

The Twitter Module for Pligg CMS!
Register, Login, and Submit Stories with Twitter. An absolute MUST HAVE for all Pligg sites!
Reply With Quote
  #3 (permalink)  
Old 01-15-2009, 12:01 AM
New Pligger
 
Join Date: Jul 2007
Posts: 12
Thank you. I was just putting the java outside the {literal} and {/literal} tags which I didnt you had to put them inside.

Works great.
Reply With Quote
  #4 (permalink)  
Old 09-14-2009, 04:55 PM
Casual Pligger
Pligg Version: 1.0.3b
Pligg Template: Arthemia
 
Join Date: Jul 2009
Location: Madrid, Spain
Posts: 38
With this code you can compatibility with more brownsers ...

Code:
{literal}
<script type='text/javascript'>
<!--
var IEstring = "<a href='javascript:window.external.addFavorite"
IEstring += "(location.href,document.title);' title='favoritos'>favoritos<\/a>" ;
var NSstring = "favoritos click<b>[ctrl+D]</b>";
var OPstring = "favoritos click<b>[ctrl+T]</b>";
var OTHstring = "favoritos"
var whichString = OTHstring ;
var agt = navigator.userAgent.toLowerCase();
var app = navigator.appName.toLowerCase();
var ieAgent = agt.indexOf('msie');
var nsAgent = app.indexOf('netscape');
var opAgent = app.indexOf('opera');
if (ieAgent!= -1) { whichString = IEstring; } else if (nsAgent!= -1){ whichString = NSstring; } else if (opAgent!= -1){whichString = OPstring; }
document.write(whichString)
-->
</script> 
{/literal}
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Script Virus in Pligg 1.0.0 Download? jstablein Questions and Comments 1 07-24-2009 02:49 AM
Internal Server Error cvcxl Questions and Comments 2 02-29-2008 07:51 PM
Premature end of script headers d4dirty Questions and Comments 3 01-03-2008 11:22 AM
Injecting values from Pligg into Google Script aaronpais Questions and Comments 4 06-02-2007 05:23 PM
Invoke a bot Perl Script and periodic Queue Deleter dagmaggot Questions and Comments 3 07-16-2006 06:20 AM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development