New Zenner
- Join Date:
- Mar 2010
- Posts:
- 74
- Plugin Contributions:
- 0
add a logo as a link to a sidebox?
I am using a blank sidebox and I want to add an image as a link to an external website.
How can I do this???
Started by artifaxworthing on 13 May 2010, 8:06 AM · Views: 1,534
New Zenner
I am using a blank sidebox and I want to add an image as a link to an external website.
How can I do this???
Black Belt
Your code looks right, except you missed the closing > in the </a> tag. It may also be that the image isn't where it's supposed to be. Once those are fixed, and it still doesn't work, try an absolute path to the image (http:// )
New Zenner
HI
its still not working where do we put the absolute path?
thanks
Black Belt
Same place you had the original href code. You've removed it, so I can't see exactly what you may have done.
Here's the code from my blank sidebox-with-an-image-link-to-facebook:
define('TEXT_LOGO2_SIDEBOX', '<a href="http://www.facebook.com/pages/Chief-Okemos-Sportsmans-Club/310761025377"><img src="includes/templates/cosc/images/facebook.gif"></img></a>');
Facebook.gif is an image I created.
New Zenner
hi I have re-inserted the code in the includes/languages/extra_definitions/blank_sidebox_defines.php and the image into the images folder but i still cant seem to make this a link is there somewhere else that we need to put the code?
Black Belt
Nope. Should work there. You can also insert the code in tpl_blank_sidebox.php.
When you say 'can't seem to make this a link', do you mean the image is there but isn't clickable?
Maybe if you post the code here, we might be able to spot something.
New Zenner
the code is as i written it and the image appears on the website but its not clickable.
http://artifaxonline.co.uk/t-shirts
Black Belt
I'm not seeing an <a href= ... in the source for that box, which you'll need to make it a link.
It looks like you put the image in the sidebox heading - might be better to turn the heading off and put the image in the body of the sidebox.
New Zenner
sorry ! we are still very confused :frusty: this is what the code looks like that we have put in this page we have also put the image which I have named facebook.gif in the images file.
Is it because of the name of the sidebox? or is it that we need to put this anywhere else? if we put it in the tpl_blank_sidebox.php we loose the whole box! are we putting in the wrong code for the wrong page?
http://artifaxonline.co.uk/t-shirts
blank_sidebox_defines.php( looks like this is this page)
<?php /** * blank sidebox definitions - text for inclusion in a new blank sidebox * * @package templateSystem * @copyright 2007 Kuroi Web Design * @copyright Portions Copyright 2003-2007 Zen Cart Development Team * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: blank_sidebox.php 2007-05-26 kuroi $ */ define('BOX_HEADING_BLANK_SIDEBOX', 'facebook.gif'); define('TEXT_BLANK_SIDEBOX', '<a href="http://www.facebook.com/pages/artifaxworthing/724fdcbd44d05d0c474160a28ee90faf"><img src="includes/templates/pc01/images/facebook.gif"></img></a>'); ?>Black Belt
Sorry, but I'm still not seeing that anchor code in your source code for the page, and, according to that code, the image should show in both the heading and the content of that box, and it isn't.
Did you save the edited file to the correct override directory (includes/languages/english/extra_definitions/PC01) ?
New Zenner
:smile::smile: we now have it working by using a logo sidebox, what code do we need to add/change to have this opening in a new window??
thanks for your help :D:D
New Zenner
sorry also how do we duplicate this box for another link?
Black Belt
Inside the <a href> tag, add another attribute target="_blank".
To duplicate the sidebox, clone all of the files, renaming with a 2 or something added to the name. Change all filename references accordingly.
If you just want a second link in the same location, you can add the code to the sidebox you have.
New Zenner
hi thankyou i have duplicated the logo box and called it logo_sidebox_defines2.php placed the new image in the images folder and changed the file titles and images for the new link, but unfortunately its still picking up the image and link for the facebook have i missed something out?
http://www.artifaxonline.co.uk/t-shirts
thanks again for your help
Black Belt
You must have some variables or constants in logosidebox2 that are the same as the ones in logosidebox, or perhaps some filename references inside files that have not been updated. We can't tell what ones without seeing all the PHP files.
If you want the second link below the first one, you are wasting effort by making a second sidebox. Just add the second link code to the original box files.
New Zenner
Hi
If i copy the code and place it below the other link I either loose all the links or the facebook still stays but without the twitter.
I have tried again to duplicate the logo code and called it 2 but now the twitter link shows and not the facebook!!:frusty:
http://www.artifaxonline.co.uk/t-shirts
tpl.logo_sidebox2.php
Link Option - uncomment this if you intend to use the logo as a link
$logoimage = '<a href="' . LOGO_SIDEBOX2_LINK . '">' . zen_image($template->get_template_dir(LOGO_SIDEBOX2_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . LOGO_SIDEBOX2_IMAGE, LOGO_SIDEBOX2_IMAGE_TEXT) . '</a>';
//comment this out if you use the above link option.
//$logoimage = zen_image($template->get_template_dir(LOGO_SIDEBOX2_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . LOGO_SIDEBOX2_IMAGE, LOGO_SIDEBOX2_IMAGE_TEXT);
**
logo_sidebox2_defines.php**
$content = '';
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '">';
$content .= $logoimage;
$content .= '</div>';
?>
define('BOX_HEADING_LOGO_SIDEBOX', '');
define('LOGO_SIDEBOX_IMAGE_WIDTH', '170');
define('LOGO_SIDEBOX_IMAGE_HEIGHT', '40');
define('LOGO_SIDEBOX_IMAGE', 'twitterbutton.gif');
define('LOGO_SIDEBOX_IMAGE_TEXT', 'Link to twitter');
//this is optional if you want to use the logo as a link
//replace your_link.com with the link you choose
define('LOGO_SIDEBOX_LINK', 'http://www.twitter.com/artifaxworthing');
?>
the code for the facebook is minus the number 2!
Black Belt
All of your defines refer to logo_sidebox constants. As I said, you need to convert ALL of them to the new name, like BOX_HEADING_LOGO_SIDEBOX2.
The "Link option" text is just a comment, and must remain commented or it will be treated as code and cause some form of error or incorrect performance.
Since both files use the $logoimage variable, the uncommented comment in the logo_sidebox2 code invalidates the statement and the variable keeps the value it had in the first sidebox.
Black Belt
When you add the second link code, you need to use mostly all new constants and variables (except for $content), and you do not duplicate the $content = ''; which wipes the variable clean.
Also, none of the $content statements should be in a define file. They will not be able to function correctly there. They belong in module or template files.
Zen Follower
Here is the code I used to get mine to show.
Renam ALL instances of "BLANK" to "??"
In all 3 files
define('BOX_HEADING_AM_SIDEBOX', 'American Made');
define('TEXT_AM_SIDEBOX', 'We are proud to say <br> everything we sell at <br><em><strong>Topnotch Bass Baits</strong>
</em> <br> is made in the <img src="http://xxx.xxx.xxx.xx/~zzzzzz/images/flag.jpg" /> ');
Hope it helps.
Big Al
BigAl49
Al Treadway
http://www.topnotchbassbaits.com
New Zenner
Hi thank you to all that have helped with this dreaded link sidebox :smile: we have now cracked it !! now we need these links to open in a separate window so you do not navigate away from our site
thank you for the code target="_blank" but we are unsure where it needs to go we have tried putting it in a few places but either get another line of text with that wording or we loose everything again:frusty: here is the line of text we think it goes into but where?
$logoimage = '<a href="' . LOGO_SIDEBOX2_LINK . '">' . zen_image($template->get_template_dir(LOGO_SIDEBOX2_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . LOGO_SIDEBOX2_IMAGE, LOGO_SIDEBOX2_IMAGE_TEXT). '</a>';
(this code is from tpl_logo_sidebox2.tpl)
Tell staff why this post should be reviewed.