Forums / Basic Configuration / Basic 'simple button to URL in sidebox - HowTo Example needed

Basic 'simple button to URL in sidebox - HowTo Example needed

Locked

Views: 1,565

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
8 Oct 2009, 4:00 PM
#1
beau91324 avatar

beau91324

Zen Follower

Join Date:
Jul 2009
Posts:
149
Plugin Contributions:
0

Basic 'simple button to URL in sidebox - HowTo Example needed

I have created a sidebox that I want to but some basic/simple buttons, like the search button in the search sidebox. My problem is I'm a novice at PHP programming (I am an experience programmer I just don't know PHP that well yet) and I'm having some problems understanding what I'm seeing in the see, so I'm asking for a good explination of just what is going on in tpl_search.php.

All my button needs to do is a simple href to an external URL like https://www.google.com.

Beau

8 Oct 2009, 4:09 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Basic 'simple button to URL in sidebox - HowTo Example needed

Do you want a button to an external URL, or do you want some sort of search function attached to it?

8 Oct 2009, 4:14 PM
#3
beau91324 avatar

beau91324

Zen Follower

Join Date:
Jul 2009
Posts:
149
Plugin Contributions:
0

Re: Basic 'simple button to URL in sidebox - HowTo Example needed

I just want a button to an send the user to an external URL when pressed. I'm using it to send my users to our Forum support site: audiobookstownsquare.yuku.com

I'm looking for the simplest, cleanest way to do this is a sidebox because I will be adding other links to other places later.

Beau

8 Oct 2009, 4:25 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Basic 'simple button to URL in sidebox - HowTo Example needed

If you want this separate from the existing sideboxes, you can install the Blank Sidebox mod and put your button code in it.

If you don't want the button in a box, you can hide the box heading and border in your stylesheet, using the box id to limit the effect to that box.

8 Oct 2009, 4:28 PM
#5
beau91324 avatar

beau91324

Zen Follower

Join Date:
Jul 2009
Posts:
149
Plugin Contributions:
0

Re: Basic 'simple button to URL in sidebox - HowTo Example needed

Yes, I understand that, but what is the code I put in the sidebox to create the button itself? That's what I need to understand, know.

Beau

8 Oct 2009, 4:54 PM
#6
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,668
Plugin Contributions:
0

Re: Basic 'simple button to URL in sidebox - HowTo Example needed

Use simple HTML -

<a href="YOUR_URL"><img src="path_to_your_image.gif" /></a>

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

8 Oct 2009, 5:01 PM
#7
beau91324 avatar

beau91324

Zen Follower

Join Date:
Jul 2009
Posts:
149
Plugin Contributions:
0

Re: Basic 'simple button to URL in sidebox - HowTo Example needed

thanks, any idea how I could get the button type used in the search sidebox, or is it a gif too?

Beau

8 Oct 2009, 5:43 PM
#8
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,668
Plugin Contributions:
0

Re: Basic 'simple button to URL in sidebox - HowTo Example needed

You can use a GIF, JPG or PNG image

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

8 Oct 2009, 10:19 PM
#9
beau91324 avatar

beau91324

Zen Follower

Join Date:
Jul 2009
Posts:
149
Plugin Contributions:
0

Re: Basic 'simple button to URL in sidebox - HowTo Example needed

Newbie question time: How do you figure out the path to a graphic. I have tried <img src="free.gif" /> with the free.gif in the images folder in the same level as the sidebox folder that has the sidebox php file with the code and I see nothing. As you can see in the code below I'm using the Blank Sidebox as a starting point.

<?php
/**
 * blank sidebox - allows a blank sidebox to be added to your site
 *
 * @package templateSystem
 * @copyright 2007 Kuroi Web Design
  * @copyright Portions Copyright 2003-2007 Zen Cart Development Team
 * @license [url]http://www.zen-cart.com/license/2_0.txt[/url] GNU Public License V2.0
 * @version $Id: blank_sidebox.php 2007-05-26 kuroi $
 */

  $content = '';
  $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
  $content .= '<a href="http://audiobookstownsquare.yuku.com"><img src="free.gif" /></a>';
 
  $content .= '</div>';
?>

Beau

9 Oct 2009, 10:45 AM
#10
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Basic 'simple button to URL in sidebox - HowTo Example needed

You'll need the path in the img tag. A relative path would be: <img src="../images/free.gif"> That's two dots before the slash. You can also put in the entire path (http:// etc.), but you can run into problems on secured pages that way.

9 Oct 2009, 12:28 PM
#11
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Basic 'simple button to URL in sidebox - HowTo Example needed

And that (../images/free.gif) would be the path to an image in the correct template image folder, /includes/templates/your_template/images/free.gif.

The /images/ folder in the root of the Zen Cart installation is intended mainly for product images, while template-specific images go in the template folder.

14 May 2010, 12:08 PM
#12
g1smd avatar

g1smd

Zen Follower

Join Date:
Mar 2010
Location:
UK
Posts:
449
Plugin Contributions:
0

Re: Basic 'simple button to URL in sidebox - HowTo Example needed

gjh42:

And that (../images/free.gif) would be the path to an image in the correct template image folder, /includes/templates/your_template/images/free.gif.

The /images/ folder in the root of the Zen Cart installation is intended mainly for product images, while template-specific images go in the template folder.

It is the browser that resolves the relative URL reference, so:

from the page at www.example.com/zencart/index.php?some-parameters the reference "../images/free.gif" points to www.example.com/images/free.gif.

and

from the page at www.example.com/index.php?some-parameters the reference "../images/free.gif" points to www.example.com/../images/free.gif.

Neither of those are what you want.

I can't stress enough that simply linking to images using "/zencart/images/free.gif" and "/images/free.gif" references with a leading slash simplifies everything instantly.

In that case, template images are referred to using "/zencart/includes/templates/your_template/images/free.gif" and "/includes/templates/your_template/images/free.gif" references.

Online since 1995.