I created a plugin to extend the article edit options.

The Name for my plugin is sectionary.

Here the code for the installation

<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="content" method="upgrade">

        <filename plugin="sectionary">sectionary.php</filename>
        <language tag="de-DE">language/de-DE/de-DE.plg_content_sectionary.ini</language>
        <language tag="de-DE">language/de-DE/de-DE.plg_content_sectionary.sys.ini</language>
        <fields name="params">


Here the code for the sectionary.php

// no direct access
defined ( '_JEXEC' ) or die ( 'Restricted access' );
class plgContentSectionary extends JPlugin {
     * Load the language file on instantiation.
     * Note this is only available in Joomla 3.1 and higher.
     * If you want to support 3.0 series you must override the constructor
     * @var boolean
     * @since 3.1
    protected $autoloadLanguage = true;

    function onContentPrepareForm($form, $data) {
        $app = JFactory::getApplication();  
        $option = $app->input->get('option');
        switch($option) {
            case 'com_content':
                if ($app->isAdmin()) {
                    JForm::addFormPath(__DIR__ . '/forms');
                    $form->loadFile('sectionary', false);
                return true;
        return true;


Here the code for the sectionary.xml which contains the data:

<?xml version="1.0" encoding="UTF-8"?>
<fields name="attribs" >
      <fieldset name="section1" label="SECTION1_TAB">
                    class="btn-group btn-group-yesno"
          <option value="1">JYES</option>
          <option value="0">JNO</option>
        <field name="sec1-headline" type="text" label="SEC_HEADLINE" filter="SAFEHTML" />
        <field name="sec1-bg-img" type="media" label="SEC_BG_IMG_LABEL" />
<fieldset name="section2" label="SECTION1_TAB">
                    class="btn-group btn-group-yesno"
          <option value="1">JYES</option>
          <option value="0">JNO</option>
        <field name="sec2-headline" type="text" label="SEC_HEADLINE" filter="SAFEHTML" />
        <field name="sec2-bg-img" type="media" label="SEC_BG_IMG_LABEL" />

At this point every things works fine. The plugin is installed perfectly. I can successfully save data in the article.

But I cant echo the saved data in my template file.

For example I use:

<?php echo ($params->sec1-headline); ?>

to echo the headline from fieldset name="section1"

but nothing happens.

What am I doing wrong?

  • 1
    It is not clear what your are trying to achieve. For instance, $params->sec1-headline is not right. '-' is an arithmetic operator. It shoud be $params->get('sec1-headline')
    – Anibal
    Jan 12 '15 at 16:57
  • Sorry I misspelled it. I meant: <?php echo $params->get('sec1-headline');?> but I get no output in my template file! Jan 12 '15 at 17:28
  • You do not give details about what events are you processing in the plug-in. In general, a plug-in do not have an output in the same sense than a module.
    – Anibal
    Jan 12 '15 at 18:20
  • I just need more data fields in the article as such in the standard. So I want to add more data fields with this plugin. Jan 12 '15 at 20:12

Besides the source code that you have published, you have to follow a plug-in structure to implement all the recommended events.

Particularly, to render the fields you have to implement onContentPrepare.

onContentPrepare() is called when the article is being prepared for display. This is the moment where HTML can be injected into what will be displayed.

Adding custom fields to the article component - onContentPrepare https://docs.joomla.org/Adding_custom_fields_to_the_article_component#onContentPrepare

  • @MarkusSteining It is the correct article for you to read, though, as it shows an example doing pretty much exactly what you want. So going over it from the beginning step by step should solve your issue. Jan 12 '15 at 21:24

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.