Code to display the present page URL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DelMonico Hatter
    Mivite Lite

    • Jun 2011
    • 7

    #1

    Code to display the present page URL

    Hello,

    This might be something I am missing that is totally obvious, but I am looking for a simple way to use some miva code on a the PROD page template to make it output the present page's URL. (I do have toolkit installed, if that helps.) I know that I can call the present page's URL using Javascript, but I don't want to do that for this situation.

    There are of course several versions of any given product page. The code I am seeking would have the URL of the page presently visible to the user.

    Thanks!

    Brandon
    DelMonico Hatter
  • Bruce - PhosphorMedia
    Developer Partner











    • Mar 2006
    • 11257

    #2
    Re: Code to display the present page URL

    <mvt:if expr="NOT g.secure">
    &mvt:global;sessionURL;
    <mvt:else>
    &mvt:global;secure_sessionURL;
    </mvt:if>

    But, why? Its in the URL Address bar.
    Bruce Golub
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
    phosphormedia.com

    Comment

    • DelMonico Hatter
      Mivite Lite

      • Jun 2011
      • 7

      #3
      Re: Code to display the present page URL

      Thanks for the info - I guess I need it without the sessionid though, since we use SEO Short Links.

      What I'm trying to do is duplicate the currently displayed link, but with a link to an anchor at the end to bring the customer further down the page, to see the product reviews on that page.

      Anchor format is #pr-header-{productcode}

      Thus:



      will get me to the reviews section of that page.

      To re-create the above, I use the following code:

      <a href="/&mvt:category:code;/&mvt:product:code;.htm#pr-header-&mvt:product:code;">

      Thee only thing is that we have more than one version of that page. The generic (no-category) version is:



      Hence I'm looking for some code that will show the user the URL as it is displayed, so that I can tack on a # anchor after.

      The solution I do have works for what we need it for, but I was hoping for an easy way to get the current user-displayed URL to output using miva code, if there was one.

      Best,
      Brandon

      Comment

      • Bruce - PhosphorMedia
        Developer Partner











        • Mar 2006
        • 11257

        #4
        Re: Code to display the present page URL

        Check the variable you have for: g.domain:name (&mvt:global:domain:name;). If that appears to be www.delmonicohatter.com, then use:

        &mvt:global:domain:name;/product/&mvt:product_code;.htm#pr-header-&mvt:product:code;

        on all pages. Since this is just a name anchor link to the same page, there is no reason to reference the category based version. However, if you want, just use a conditional (mvt:if expr="g.category_code") and include the category link.

        Lastly, since this is a on-page reference, you could probably get rid of the second product code reference and just use 'pr-header'.
        Bruce Golub
        Phosphor Media - "Your Success is our Business"

        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
        phosphormedia.com

        Comment

        Working...
        X