Note that there are some explanatory texts on larger screens.

plurals
  1. POstatic block of links, how to set an active class
    primarykey
    data
    text
    <p>On my category listing pages i have a static block on my left menu with two links:</p> <p>1) The category listing page link 2) CMS page of details.</p> <p>The CMS page of details calls the exact same static block on it's left menu too.</p> <p>My question:</p> <p>How can Magento know in the static block of links that it is on the listing page or the cms page, and add a class of "active" to the link so we can change the CSS styling for the "active" page that is being viewed?</p> <p>I'm open to a different approach then I currently have setup if that makes it more manageable. </p> <p>Thanks!</p> <p>EDIT 1</p> <p>Link block (grc_sidebar_links)</p> <pre><code>&lt;div class="arrow"&gt;&lt;a href="/category/a.html"&gt;Category A&lt;/a&gt;&lt;/div&gt; &lt;div class="arrow"&gt;&lt;a href="/cata-specs"&gt;Specs and Pricing&lt;/a&gt;&lt;/div&gt; </code></pre> <p>Sidebar block's html (grc_sidebar_spec_summary):</p> <pre><code>&lt;div class="sidebar_top"&gt;{{block type="cms/block" block_id="grc_sidebar_links"}}&lt;/div&gt; </code></pre> <p>And then in the category i have the following layout update for the page:</p> <pre><code>&lt;reference name="left"&gt; &lt;block type="cms/block" name="block_sidebar_top" before="-"&gt; &lt;action method="setBlockId"&gt;&lt;block_id&gt;grc_sidebar_spec_summary&lt;/block_id&gt;&lt;/action&gt; &lt;/block&gt; &lt;/reference&gt; </code></pre> <p>And then in the CMS page i have the following layout update:</p> <pre><code>&lt;reference name="left"&gt; &lt;block type="cms/block" name="block_sidebar_top"&gt; &lt;action method="setBlockId"&gt;&lt;block_id&gt;grc_sidebar_spec_summary&lt;/block_id&gt;&lt;/action&gt; &lt;/reference&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload