magento獲取當前頁面url位址
在magento中,可以通過core/url助手類中的getcurrenturl()方法獲取當前頁面的url位址
$currenturl
=
$this
->helper(
'core/url'
)->getcurrenturl();
//在社會化分享中,當前頁面的url位址非常有用
helper('core/url')->getcurrenturl(); ?>"
>share on facebook
magento得到當前頁面的url,得到當前產品頁面的url
<?php
//獲取當前url
echomage::helper('core/url')—>getcurrenturl();
//判斷是否為首頁
//如果是1.4.x
if($this->geturl('') ==$this->geturl('*/*/*',array('_current'=>true,'_use_rewrite'=>true))):
echo"homepage";
else:
echo"not in homepage";
endif;
補充說明:
$this->helper('core/url')->getcurrenturl();
在購物車頁面新增登入框時我們往往不需要預設的跳轉至「我的賬戶」頁面,這個時候我們就需要進行設定magento登陸之後返回登入之前的頁面
在cart頁面新增
mage::getsingleton('customer/session')->setbeforeauthurl(mage::geturl('*/*/*', array('_secure'=>true)));
或者 mage::getsingleton('customer/session')->setbeforeauthurl(mage::helper("core/url")->getcurrenturl());
即可實現magento登陸之後返回登入之前的頁面
c 獲取當前頁面URl
2 通過js獲取 thisdloc document.location thisurl document.url thishref document.location.href thissloc self.location.href thistloc top.location.href thispl...
獲取當前頁面的URL
window location host 返回url 的主機部分,例如 www.com window location hostname 返回www.com window location href 返回整個url字串 window location pathname 返回 a index.php或...
059 獲取當前頁面位址
1.window.location物件可用於獲取當前頁面位址 url 並把瀏覽器重定向到新頁面。2.window.location.href屬性返回當前頁面的url。3.window.location.hostname屬性返回 當前頁面的 網際網路主機的名稱。4.window.location.pa...