문제

joomla를 쓰고 있습니다!현재 기사 제목을 표시 해야하는 모듈.

이 코드가 stackoverflow에서 여기에서 발견 된이 코드를 가지고 있습니다.

<?php
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$ids = explode(':',JRequest::getString('id'));
$article_id = $ids[0];
$article =& JTable::getInstance("content");
$article->load($article_id);
echo $article->get("title");
?>
.

작동하지만 Joomla 1.7이므로 사용되지 않는 클래스 JREQuest를 사용하고 3.2.2를 사용합니다.누군가가 Joomla 3.2와 함께 유효하도록 재 작성하는 방법을 알려줄 수 있습니까?

도움이 되었습니까?

해결책

최대 데이즈 코딩 표준을 사용하는 다음 코드를 사용할 수 있습니다.

$input = JFactory::getApplication()->input;
$id = $input->getInt('id'); //get the article ID
$article = JTable::getInstance('content');
$article->load($id);

echo $article->get('title'); // display the article title
.

희망이 도움이

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top