PDA

View Full Version : bookmark code



modom
12-31-2002, 06:25 PM
Hi,

This is the bookmark code to place a box in the store that people can bookmark your site with.

<!-- Add Favorites //-->
<?php
if (strstr ($HTTP_USER_AGENT, "MSIE")) {
$self = "http://".$HTTP_HOST.$REQUEST_URI;
?>

<?php
/*$info_box_contents = array();
$info_box_contents[] = array('align' => 'left',
'text' => BOX_INFORMATION_BOOKMARK
);
new infoBoxHeading($info_box_contents, false, false);

$rows = 0;
$info_box_contents = array();*/

if ($HTTP_GET_VARS['products_id']) {
$product_box_info = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.language_id = '" . $languages_id . "'");
$product_box_info_values = tep_db_fetch_array($product_box_info);
$text = "<a href=\"javascript:window.external.AddFavorite('$self','$H TTP_HOST Online Shop - " . str_replace("'", "\'", $product_box_info_values["products_name"])."')\">Bookmark ".$product_box_info_values['products_name']."</a>";
}
else {
$text = "<a href=\"javascript:window.external.AddFavorite('$self','$H TTP_HOST Online Shop')\">Bookmark Us</a>";
}

$info_box_contents[] = array('align' => 'center',
'text' => $text);

new infoBox($info_box_contents);
?>

I have removed the <tr> and <td> tags and also commented out the first lines at the top to remove the header of the box.

How can I get this code completely out of the box and turn the text link into a graphic link?

I have tried commenting out this code various ways but it just removes the whole box section:

$info_box_contents[] = array('align' => 'center',
'text' => $text);

new infoBox($info_box_contents);

Any help would be appreciated.

Thanks!

|3ackdraft
01-01-2003, 07:00 AM
do you need the Bookmark in a box?

Here is the code for a simple bookmark script.

Put this in the <head>



<script language="JavaScript">
<!-- Begin
function bookmark() {
bookmarkurl="http://www.yoursite.com"
bookmarktitle="WebPage Title"
if (document.all) window.external.AddFavorite(bookmarkurl,bookmarkti tle)
}
// End -->
</script>


put this in the <body>

<a href="javascript:bookmark()"><img src="your_bookmark_image.gif" alt="bookmark our site"></a>

Mike

modom
01-01-2003, 08:31 AM
Thank you so much!

I tried it and it is working in the header.php. I put head tags above the copyright notice like this:
<head>
<script language="JavaScript">
<!-- Begin
function bookmark() {
bookmarkurl="http://www.mdesigns.biz"
bookmarktitle="WebPage Title"
if (document.all) window.external.AddFavorite(bookmarkurl,bookmarkti tle)
}
// End -->
</script>
</head>
<?php
/*
$Id: header.php,v 1.36 2002/08/15 17:29:47 dgw_ Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright (c) 2001 osCommerce

Released under the GNU General Public License
*/

I hope this is the way you do it.

|3ackdraft
01-03-2003, 08:33 AM
Melinda

In this example I am using default.php
don't put this in the header.php

This is a javascript and 9 times out of 10 you put your javascript functions in the head or your html document.



<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">

<script language="JavaScript">
<!-- Begin
function bookmark() {
bookmarkurl="http://www.mdesigns.biz"
bookmarktitle="WebPage Title"
if (document.all) window.external.AddFavorite(bookmarkurl,bookmarkti tle)
}
// End -->
</script>

</head>