Inserting HTML and links in a Joomla 2.5 plugin settings page

Joomla 2.5 has reached its end of life as for 12/31/2014. Please be advised this may be a security risk to your website. You can view more information about the end of life here.

In our last article, we showed you how to use spacers in a Joomla 2.5 plugin’s XML file. Using spacer fields, you can add HTML to your plugin’s settings page.

How to use Spacers to add HTML

The key to using HTML within a plugin is to change:

  • > to >
  • < to <

If we wanted to insert the following link into a plugin’s settings page:

InMotion Hosting provides the <a href=’https://www.inmotionhosting.com/joomla-hosting/best-joomla-hosting.html’>best joomla hosting</a>

… We would need to change the code to:

InMotion Hosting provides the &lt;a href=’https://www.inmotionhosting.com/joomla-hosting/best-joomla-hosting.html’&gt;best joomla hosting&lt;/a&gt;

Example Spacer code that prints HTML

The following is the code we added to our plugin’s XML file and the results:

<field name=”great-joomla-hosting” type=”spacer” description=”InMotion Hosting provides joomla hosting” label=”InMotion Hosting provides the &lt;a href=’https://www.inmotionhosting.com/joomla-hosting/best-joomla-hosting.html’&gt;best joomla hosting&lt;/a&gt;” />

using-html-in-a-plugin-xml-file

0 thoughts on “Inserting HTML and links in a Joomla 2.5 plugin settings page

  1. hi ,

    how to add  id to this link

    i need to link user using user id  how to add id to this link

    this below link not working

    index.php?option=com_truematrimony&amp;view=newregistereduser&amp;id=[ITEM:ID]

     

     

     

    1. Hello Mathesh,

      Are you trying to link them to a users profile in this component? Can you provide the full url you are trying to redirect them to?

      Best Regards,
      TJ Edens

Was this article helpful? Join the conversation!