Zen Cart Logo
Forums / General Questions / what is the php code to return the url of the current page?

what is the php code to return the url of the current page?

Views: 1,691

Results 1 to 8 of 8
7 Mar 2012, 8:13 PM
#1
webkat avatar

webkat

Zen Follower

Join Date:
Jan 2012
Location:
New England
Posts:
238
Plugin Contributions:
0

what is the php code to return the url of the current page?

I'm trying to edit the products page so that there is a link under the product image to "See Additional Images" that links to an anchor down where the additional images are. I've tried making the link to #moreimages but instead of just moving down the page it loads the url of my site followed by the anchor and I don't know why... so I need to code it so that it fills in the url of the current page, then the anchor. But I am not a php programmer and I don't know the code. I know it will be ```php

<?php echo [something here],'#moreimages'; ?>
7 Mar 2012, 9:09 PM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: what is the php code to return the url of the current page?

Zencart has an automated, simple-to-use, and very sophisticated function to handle additional product images.

LOTS of posts on this, and even a tutorial, I believe...

7 Mar 2012, 10:03 PM
#3
webkat avatar

webkat

Zen Follower

Join Date:
Jan 2012
Location:
New England
Posts:
238
Plugin Contributions:
0

Re: what is the php code to return the url of the current page?

I understand how Zen Cart handles additional product images. It's just that they're so far down the page that I'm worried some people might not know they are there, so I want to put a link under the main product image that draws the browser down the page to where the other images are.

8 Mar 2012, 5:53 AM
#4
gjh42 avatar

gjh42

Black Belt

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

Re: what is the php code to return the url of the current page?

Or you could move the additional images up to just below the main image, for instance...

8 Mar 2012, 6:09 PM
#5
webkat avatar

webkat

Zen Follower

Join Date:
Jan 2012
Location:
New England
Posts:
238
Plugin Contributions:
0

Re: what is the php code to return the url of the current page?

I don't' want to do that. It would get in the way of the product description.

8 Mar 2012, 7:16 PM
#6
gjh42 avatar

gjh42

Black Belt

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

Re: what is the php code to return the url of the current page?

DrByte has given good explanations of how to use anchor links, including here and here (especially post 11).

8 Mar 2012, 7:39 PM
#7
skipwater avatar

skipwater

Totally Zenned

Join Date:
Jun 2008
Location:
Washington, DC
Posts:
775
Plugin Contributions:
1

Re: what is the php code to return the url of the current page?

What is the php code to return the url of the current page?

<?php echo '<a href="'.zen_href_link($current_page."#moreimages").'">More Images</a>'; ?>

Skip

8 Mar 2012, 10:24 PM
#8
webkat avatar

webkat

Zen Follower

Join Date:
Jan 2012
Location:
New England
Posts:
238
Plugin Contributions:
0

Re: what is the php code to return the url of the current page?

gjh42:

DrByte has given good explanations of how to use anchor links, including here and here (especially post 11).

Thanks, that second link had the answer I needed. This is the code that worked:

<a href="<?php echo zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('number_of_uploads')) ) . '#additional'; ?>">additional images</a>

I guess for anchor links in my EZ pages I'm just going to have to suck it up and put in the relative url along with the anchor. Fortunately there are a much more limited number of EZ pages than there are products!