I am using Joomla 3.6.5 version.

In article we can add Read More break point for blog view of articles or introtext in menu. When we click on Read More button in bottom of the page, it will add code:

<hr id="system-readmore" />

It's working fine. But my issue is different.

I have content of articles from third party. And I have php script with HTML and content to update article content. That script runs from cron job. I have also add this hr tag along with other content where I want to put break point.

But this not adding Read More text to my menu intro text. After cron job run I have looked in article content this tag is there. And one more point, as I have thought it may do changes of text break on click of Read More button, but strange! Without changing any thing if I save article again, it will show me a Read More text on menu intro text.

Any one can suggest that from which file this break point related changes are applied. Or any other solution to solve my issue.

Part of my script is here:

$dircontents = "<div>Lorem Ipsum is simply dummy text of the printing and typesetting industry.<hr id=\"system-readmore\" /></div>";


1 Answer 1


When an article is saved, JTableContent (\libraries\legacy\table\content.php) saves anything before the readmore tag in the introtext field and anything after in the fulltext field of the content table. The tag itself it not saved in the database.

You can see the structure of that table here: https://docs.joomla.org/Tables/content

The code Joomla uses to split the content up is as follows:

// Search for the {readmore} tag and split the text up accordingly.
        if (isset($array['articletext']))
            $pattern = '#<hr\s+id=("|\')system-readmore("|\')\s*\/*>#i';
            $tagPos = preg_match($pattern, $array['articletext']);

            if ($tagPos == 0)
                $this->introtext = $array['articletext'];
                $this->fulltext = '';
                list ($this->introtext, $this->fulltext) = preg_split($pattern, $array['articletext'], 2);

This code is run on save.

I assume your script is writing to the database, in which case you'd need to update it to populate the two fields instead of adding the readmore tag to the fulltext field.

  • It's worked. Great solution. Thanks for the help.
    – herr
    Mar 28, 2017 at 11:03
  • @RichardB Why is the Joomla core chasing preg_match() with preg_split()? Seems like completely unnecessary overhead to me. Why not just a single preg_match() call? 3v4l.org/Ndi2P Nov 30, 2018 at 2:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.