将cms页面链接到特定图像

I have created a CMS page with the name collection.html and added the code like

{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="7" template="catalog/product/list.phtml"}}

I want to link this CMS page to the image which is displaying in the other page. How to link this page to particular image in the other page?

While you have created a CMS Page, you would have added some URL Key for the page.

  • Getting the URL in phtml

    $this->getUrl('cms-page-url-key');

  • Getting the URL in CMS Page or Static Block

    {{store direct_url="cms-page-url-key"}}

To get the CMS page url in template file

$this->getUrl('', array('_direct' => 'cms-page-key'));

To pass parameter with this

$this->getUrl('', array('_direct' => 'cms-page-key', '_query' =>'a=5&b=6'));
  • If the image is in CMS page or Static Block then you can do by this way

    <a href=" {{store direct_url="identifier_of_cms_page"}} ">
        <img ... />
    </a>
    
  • If the image is in phtml page then

    <a href=" <?php echo $this->getUrl('identifier_of_cms_page');?> ">
        <img .. />
    </a>