I have a component and module built by an external company, they have hardcoded content into the component - I want to change it so the content is called from the Joomla Article Manager.

The component uses individual codes (called by '+nugget.code+') that I want to match up to a Joomla article, with the same name.

For example, if the code (within the component) is AB1, I want it to load an article that has the title of 'AB1'.

What would I need to write to include Joomla content in an external component?

I have tried:

$article_id = +nugget.code +  ": " +nugget.name + ;
$article =& JTable::getInstance("content");

var $heading = $('<h5>'. $article->get("title").'</h5>');

But this isn't working.

The external component calls "+nugget.code +" - (which in this example, let's say the value is "REI1")

The external component also calls "+nugget.name +" - (which in this example, let's say the value is "Test Article")

So '+nugget.code +": "+nugget.name+' would be 'REI1: Test Article'

What I want, is if there is a Joomla article called 'REI1: Test Article', that then needs to be shown.

  • $article_id should represent the content id. In Joomla! it is in number format. Apr 14 '15 at 10:41
  • Can you please describe more about nugget.code and nugget.name? What type of values they hold in system? Apr 14 '15 at 10:42
  • I've just updated the question with details, thanks SD Apr 14 '15 at 11:24

I am not aware of any direct code that will help you to get article based on article title. But I can see one way to get this done is as follow:

Check com_content model for function getListQuery at this path: /administrator/components/com_content/models/articles.php This function is used to query articles from database, based on filters and search query passed at back-end.

You can use inherit this class to use this function or directly take logic form it. To get search result, you need to store article title as follow:

$this->setState('filter.search', "+nugget.code +": "+nugget.name+");


$this->setState('filter.search', $articleTitle);

Where $articleTitle holds title value of your article.

The better way is to use the logic from this function and remove unwanted filter queries & IF conditions from core logic.

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.