Jump to content

Product Page Anchor Text Problem (go to item on same page)


frenchtowner

Recommended Posts

I have tried to make this work several ways and none of them have worked. I have some feature product "buttons" on the top of my product page. I want the user to be taken to the lower section of the page that shows the details of that product offer when they click on it. This is not working for me. I was using anchor text code, but I guess that doesn't really work because I have to place that code

<a name="name1">This is the Text Where the Anchor Will Land</a>
in my WHMCS control panel > Products > Details > Product Description text area.

 

I know there is a simple solution but I can't find one.

 

Here is my page where I have the problem:

 

http://www.frenchtowner.com/hosting-payments/cart.php

 

FT

Link to comment
Share on other sites

The Anchor Tag and the Name Attribute

 

The name attribute is used to create a named anchor. When using named anchors we can create links that can jump directly into a specific section on a page, instead of letting the user scroll around to find what he/she is looking for.

Below is the syntax of a named anchor:

<a name="label">Text to be displayed</a>
The name attribute is used to create a named anchor. The name of the anchor can be any text you care to use.

The line below defines a named anchor:

<a name="tips">Useful Tips Section</a>
You should notice that a named anchor is not displayed in a special way.

To link directly to the "tips" section, add a # sign and the name of the anchor to the end of a URL, like this:

<a href="http://www.website.com/html_links.htm#tips'>http://www.website.com/html_links.htm#tips">Jump to the Useful Tips Section</a>
A hyperlink to the Useful Tips Section from WITHIN the file "html_links.htm" will look like this:

<a href="#tips">Jump to the Useful Tips Section</a>
Basic Notes - Useful Tips

 

Always add a trailing slash to subfolder references. If you link like this: href="http://www.website.com/html", you will generate two HTTP requests to the server, because the server will add a slash to the address and create a new request like this: href="http://www.website.com/html/"

Named anchors are often used to create "table of contents" at the beginning of a large document. Each chapter within the document is given a named anchor, and links to each of these anchors are put at the top of the document.

If a browser cannot find a named anchor that has been specified, it goes to the top of the document. No error occurs.

Link to comment
Share on other sites

Chickendippers,

 

You're Great. I've done anchor texts many times but never on a php page where the html code was separated in different function sections. I didn't know if that was the problem or not. As you noted that wasn't it at all. It was a simple format mistake.

 

Thanks again.

FT

Link to comment
Share on other sites

Thanks for the tip, Sparky.

It finishes off Product Addon, Products and even Announcements nicely with a summary list below the heading at the top of each page, and article hotlinks..

 

just needed to add a "return to top" within the {for each} loop

 

Example code for Products

 

<p align="center" class="cartheading">Product Types</p>

<table class="cartbox" align="center"><tr>

{foreach key=num item=product from=$products}

<td><b><a href="#{$product.pid}" title="{$product.name}" >{$product.name}</a></b></td>

{if ($num + 1) is div by 2}

</tr>

<tr>

{/if}

{/foreach}

</tr>

</table>

<br />

{foreach key=num item=product from=$products}

<div class="cartbox" align="center"><a name="{$product.pid}"></a>

<h3>{$product.name}</h3>{if $product.qty!=""}<em>({$product.qty} {$LANG.orderavailable})</em>{/if}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated