1

I want to add a top link and I do this by the following in local.xml:

   <reference name="top.links">
       <action method="addLink" translate="label title">
             <label>International</label>
             <url>javascript:void(0);</url>
             <title>international</title>
             <prepare/>
             <urlParams/>
             <aParams>class="international"</aParams>
         </action>
   </reference>

unfortunately although I see the link in the top, it does not add the class to it here is the output I get:

<li class=" last"><a href="javascript:void(0);" title="international">International</a></li>

I was wonndering why it does not show

<li class=" last"><a class="international" href="javascript:void(0);" title="international">International</a></li>
1

the tag name you use for the parameters of methods called from the layout file are irrelevant. They are passed to the method in the way they are found.
So in your example <aParams>class="international"</aParams> translates to position = 0.
See here the parameters supported by the addLink method

Your xml should look like this in order to work as you expect it:

<reference name="top.links">
   <action method="addLink" translate="label title">
         <label>International</label>
         <url>javascript:void(0);</url>
         <title>international</title>
         <prepare/>
         <urlParams/>
         <position>0</position>
         <liParams />
         <aParams>class="international"</aParams>
     </action>
 </reference>

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.