frenchtowner Posted September 5, 2008 Share Posted September 5, 2008 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 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted September 5, 2008 Share Posted September 5, 2008 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. 0 Quote Link to comment Share on other sites More sharing options...
chickendippers Posted September 5, 2008 Share Posted September 5, 2008 You're using the URL cart.php/#a_place_184 It should be cart.php#a_place_184 0 Quote Link to comment Share on other sites More sharing options...
frenchtowner Posted September 5, 2008 Author Share Posted September 5, 2008 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 0 Quote Link to comment Share on other sites More sharing options...
Zorro67 Posted September 8, 2008 Share Posted September 8, 2008 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} 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.