简体   繁体   中英

get component output in joomla

i'm building a component in joomla 2.5 In this component i need to get the display of other components (for example the body of an article). I have the url of these components, with get parameters.

I'm thinking of getting the whole page using the url and cUrl, but is there a better way? Thanks.

You won't need to scrape data the way you suggest, this should never be done especially when the data you need already exists locally. You can use Joomla code, something like this:

$article = JTable::getInstance('content');
$article->load($article_id);
echo $article->get('fulltext');

Just replace $article_id with the ID of the article. And you can replace fulltext with the field that you want.

I found a useful tutorial on this. It's still pretty complicated (at least for me, as Joomla as no clear support for loading multiple components in a single page).

http://www.ducciogasparri.com/2012/04/15/joomla-loading-multiple-components-in-a-single-page/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM