magento Get Base Url,Skin Url,Media Url,Js Url,Store Url和Current Url以确保安全 [英] magento Get Base Url , Skin Url , Media Url , Js Url , Store Url and Current Url for secure

查看:79
本文介绍了magento Get Base Url,Skin Url,Media Url,Js Url,Store Url和Current Url以确保安全的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是magento的新手.我正在开发一个模块.为此,我有一些要显示链接的cssjs文件.我目前有

I am newbie to the magento. I am developing a module. For that I have some css andjs files that I want to display links. I currently have the links like

<link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('module_tryouts/css/jquery.fancybox-1.3.1.css');?>" media="all" />

<link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('module_tryouts/css/jquery-ui-1.8.custom.css');?>" media="all" />

但是在浏览了一些链接之后,我才知道该链接应该是安全的,以便该模块可以与mazebridge集成在一起.

But after going through some of the links I came to know that the link should be secure so that the module can be integrated with mazebridge.

http://jagdeepbanga.com/blog/magento-get-base-url-skin-url-media-url-js-url-store-url-and-current-url.html

http://www.webdosh.net/2011/04/magento-get-skin-url-get-media-url-get.html

http://www.magentocommerce.com/boards/viewthread/7894/

http://www. yireo.com/tutorials/magebridge/integrations/1213-integrating-magebridge-with-other-magento-extensions

那么有人可以告诉我如何解决此问题吗?如何提供到js和css文件,图像的安全链接,以便可以与mazebridge集成.任何帮助和建议,将不胜感激.谢谢

So can someone kindly tell me how to solve this issue? How to give a secure links to the files of js and css, images so that it can be integrated with mazebridge. Any help and suggestions will be really appreciated. Thanks

推荐答案

"URL访问"列表下方

Below URL Access list

  1. 基本URL:

  1. Base URL:

{{base url=''}}

  • 商店网址:

  • Store URL:

    {{store url='test.html'}}
    

    也只存储URL

    {{store url=""}}
    

  • 媒体网址:

  • Media URL:

    仅获取媒体网址

    {{media url=''}}
    

    如果您有一些文件夹路径

    if you get some folder path

    {{media url='imagefolder/imagename.jpg'}}
    

  • 皮肤网址:

  • Skin URL:

    {{skin url='images/imagename.jpg'}}
    

    仅获取皮肤网址

    {{skin url=''}}
    


    1. 在magento中获取基本网址:

    1. Get Base Url in magento:

    $baseurl = Mage::getBaseUrl();
    

    获取没有index.php的基本网址

    Get Base Url without index.php

    Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); 
    
    // output: http://example.com/
    

  • 当前网址

  • Current Url

    $currentUrl = Mage::helper('core/url')->getCurrentUrl();
    

    $currentUrl = Mage::getUrl('*/*/*', array('_current' => true));
    

    if (!in_array(Mage::app()->getFrontController()->getAction()->getFullActionName(), array('cms_index_noRoute', 'cms_index_defaultNoRoute'))) 
    {
        $currentUrl = Mage::helper('core/url')->getCurrentUrl();
    }
    

  • 皮肤网址:

  • Skin URL:

    $skinUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
    

    不安全的皮肤网址:

    $skinUrl = $this->getSkinUrl('images/imagename.jpg');
    

    保护皮肤网址:

    $this->getSkinUrl('images/imagename.gif', array('_secure'=>true));
    

  • 媒体网址

  • Media URL

    $mediaUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
    

    $mediaUrl = Mage::getBaseUrl('media');
    

  • 获取Js URL:

  • Get Js URL:

    $jsUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
    

    $jsUrl = Mage::getBaseUrl('js');
    

  • 获取商店网址:

  • get store URL:

    $storeUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
    

  • 获取首页网址:

  • Get Home URL:

    $homeUrl= Mage::helper('core/url')->getHomeUrl();
    

  • 获取目录路径

  • Get Directory paths

    Mage::getBaseDir('design') // Get design directory path
    Mage::getBaseDir('code')   // Gives code directory file path
    Mage::getBaseDir('lib')    // Gives lib directory file path
    Mage::getBaseDir('skin')   // Gives skin directory file path
    Mage::getBaseDir('var')    // Gives var directory file path
    Mage::getBaseDir('cache')  // Gives cache directory file path
    Mage::getBaseDir('log')    // Gives log directory file path
    

  • 创建模块网址:

  • Create module URL:

    Mage::getUrl('module/controller/action');
    

  • 这篇关于magento Get Base Url,Skin Url,Media Url,Js Url,Store Url和Current Url以确保安全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆