BigCommerce - Hosted Ecommerce Software by Interspire

Interspire Forum

 
Go Back   Interspire Forum > Interspire Shopping Cart Community Forum > Customization and Integration > Layout and Store Design Customization

Reply
 
Thread Tools Display Modes
  #1  
Old 03-24-2010, 11:30 AM
dave_finlayson + dave_finlayson is offline
Interspire Customer
 
Join Date: Jun 2009
Posts: 46
Default Current URL variable

Is there a variable that will output the current url (for product pages) available within Interspire?
__________________
Sports Warehouse
Reply With Quote
  #2  
Old 03-30-2010, 03:51 PM
flame + flame is offline
Interspire Customer
 
Join Date: Jan 2010
Posts: 65
Default

As far as I know there isn't one available in Interspire by default.

If you're comfortable with php you could write code to get it that way.

I usually use this function to get the current page's URL.

PHP Code:
<?php
function curPageURL() {
$isHTTPS = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on");
$port = (isset($_SERVER["SERVER_PORT"]) && ((!$isHTTPS && $_SERVER["SERVER_PORT"] != "80") || ($isHTTPS && $_SERVER["SERVER_PORT"] != "443")));
$port = ($port) ? ':'.$_SERVER["SERVER_PORT"] : '';
$url = ($isHTTPS 'https://' 'http://').$_SERVER["SERVER_NAME"].$port.$_SERVER["REQUEST_URI"];
return 
$url;
}
?>
Then use
PHP Code:
<?php
  
echo curPageURL();
?>
to echo out the current URL of the page.


Cheers,
Keith
Reply With Quote
  #3  
Old 03-30-2010, 04:27 PM
flame + flame is offline
Interspire Customer
 
Join Date: Jan 2010
Posts: 65
Default

As far as I know Interspire don't have a current page variable set by default.

If you're comfortable with PHP you could add some code to get it.

I usually use the following:-

PHP Code:
<?php
function curPageURL() {
$isHTTPS = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on");
$port = (isset($_SERVER["SERVER_PORT"]) && ((!$isHTTPS && $_SERVER["SERVER_PORT"] != "80") || ($isHTTPS && $_SERVER["SERVER_PORT"] != "443")));
$port = ($port) ? ':'.$_SERVER["SERVER_PORT"] : '';
$url = ($isHTTPS 'https://' 'http://').$_SERVER["SERVER_NAME"].$port.$_SERVER["REQUEST_URI"];
return 
$url;
}
?>
And then
PHP Code:
<?php
echo curPageURL();
?>
to echo out the current page URL.



Cheers,
Keith
Reply With Quote
  #4  
Old 09-04-2012, 05:11 AM
swecs + swecs is offline
Interspire Customer
 
Join Date: May 2009
Posts: 51
Default

Thanks. The only thing is that within Panels etc, entering PHP code doesn't seem to work. For example, I have a Panel where I'd like to enter the following code:

<div class="fb-comments" data-href="<?php echo curPageURL(); ?>" data-num-posts="2" data-width="580"></div>

(this is a code that will insert a Facebook comments plugin, but it needs the page URL to work properly)

but the above code doesn't work because the Panel file is a .html file.

Anyone have any ideas on any %%GLOBAL_%% variable or anything that could be added in to insert the page URL?

Cheers
Graeme
Reply With Quote
  #5  
Old 09-04-2012, 07:42 AM
swecs + swecs is offline
Interspire Customer
 
Join Date: May 2009
Posts: 51
Default

Actually I think I may have solved it. I think:

<script language="javascript" type="text/javascript">
document.write("<div class='fb-comments' data-href='"+location.href+"' data-num-posts='2' data-width='580'></div>");</script>

does the trick
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump