I want access a query parameter (a and b values from url) in a magento cms page. Can some body help me the {{}} directives to print this value in cms pages.


You cannot get URL parameters directly from the CMS page on the Magento editor, unless you use Javascript, which you SHOULD NOT DO, the best solution is the following (by steps):

  1. Go to magento backend and edit the CMS page you want and put this code in its content: <div>{{block type="core/template" template="geturl.phtml"}}</div>

  2. Open your FTP and go to the template folder of your theme (ex: /app/design/frontend/base/default/template/) and create a file named geturl.phtml

  3. Inside this file you just created paste this code:

<?php $parameterA = $_GET["a"]; $parameterB = $_GET["b"]; echo $parameterA."<br>".$parameterB; ?>

  1. Visit your CMS page (http://magento.com/cms-page-identifier?a=jfls&b=jhdgfjsd) and view the result.

Let me know!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.