Naoto Aguilar Morita
Naoto Aguilar Morita

Reputation: 13

Get the article to extract title, alias, content, etc. Joomla 3.X [PHP]

I'm new on this community, and I'll be very grateful if someone can help me with this.

Well, I'm trying to get the information from any article, by ID or by [object]. The idea is, "do some actions" for all of these data, extracting the "title", "content", etc. then manipulate this information.

Some code that I think it could be usefull:

$model = JModelLegacy::getInstance('Articles', 'ContentModel');
$articles = $model->getItems();

"$articles" saves an array, right? which contains all my articles indexed from 0->N.

Now when I use it in a foreach for example, like:

foreach($articles as $newArt){
echo $newArt->get("alias");
}

"echo" returns nothing. Actually I tested [echo $articles[0 or 1 ...]; ] same ... nothing.

Any ideas for what is the problem?

Upvotes: 0

Views: 1466

Answers (1)

Naoto Aguilar Morita
Naoto Aguilar Morita

Reputation: 13

EDIT:

I was wrong calling attributes using get("alias").

$newArt->alias;

Simple :').

Upvotes: 1

Related Questions