0

I am new to Joomla plugin development and I am trying to build a basic Hello World plugin.

What I want is for the text "Hello World" to appear in the front-end after the article title. I am running Joomla 3.3.6. The following is my code base:

/helloworld/

  • helloworld.xml


    <?xml version="1.0" encoding="utf-8"?>
    <extension version="3.3" type="plugin" group="content" method="upgrade">
            <name>plg_content_helloworld</name>
            <author>Test Author</author>
            <creationDate>04/02/2015</creationDate>
            <copyright>None</copyright>
            <license>GNU General Public License</license>
            <authorEmail>me@memail.com</authorEmail>
            <authorUrl>http://www.example.com</authorUrl>
            <version>1.0</version>
            <description>Simple Hello World Plugin that prints "Hello World" at the beginning of every article.</description>
            <files>
                    <filename plugin="helloworld">helloworld.php</filename>
                    <filename>index.html</filename>
            </files>
    </extension> 
  • helloworld.php
    <?php

    // no direct access
    defined('_JEXEC') or die;

    class plgContentHelloworld extends JPlugin
    {
        public function onContentAfterTitle($context, &$article, &$params, $limitstart)
            {
                            return "<p>Hello World!</p>";
            }
    }

    ?>
  • Empty index.html

I have set the "Show Intro Text" value on the article to all possible values and it still does not work. I am also struggling to find any decent resources online for Joomla Plugin creation. Does anyone know of any?

0

You can show a text near the required position changing the event to onContentBeforeDisplay.

In general, Joomla Docs is the best site for documentation. For instance , content events https://docs.joomla.org/Plugin/Events/Content.

Beyond plugin development, that can be very tricky, there are many options to introduce a text after an article text. For example, with a layout override

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.