How to get article text by article ID in Joomla?

前端 未结 4 1500
长发绾君心
长发绾君心 2021-01-12 04:02

I want to get article text by passing article ID from the joomla template.

4条回答
  •  滥情空心
    2021-01-12 04:50

    Joomla has the default script for getting content from sql table.

    Here article (#__content)

    To Get Article Id:

    $articleId = (JRequest::getVar('option')==='com_content' && JRequest::getVar('view')==='article')? JRequest::getInt('id') : 0;
    

    To get Article content:

    $table_plan         = & JTable::getInstance('Content', 'JTable');
    $table_plan_return  = $table_plan->load(array('id'=>$articleId));
    echo "
    ";print_r($table_plan->introtext);echo "
    ";

提交回复
热议问题