나는 페이지 제목이 클래스가 :동적 페이지 제목은
class UI {
private static $title;
public static function getTitle() { return self::$title; }
public static function setTitle($value) { self::$title = $value; }
}
그래서 간단한 선언 내 FrontPage를이에 :
UI::setTitle('Kiubbo.com :: Todas las Noticias, Fotos y Videos');
그리고 잘 작동합니다. 문제는 댓글 페이지 제목이 내용 (링크 제목)에 따라 변경되도록하는 것입니다. 나는이 변수와 동일 할 (즉 같은 이름을 가지고 있지만 그것에게 그것의 또 다른 기능은 동일하지 않습니다 인 getTitle에 대한) :
<?php echo $article->getTitle(); ?>
어떤의이 기능에 : 사람의 경우
function showAllComments($article_id, $param)
{
$article = Article::getById($article_id);
if(!empty($article))
{
?>
<div class="news_item">
<h2 class="news_item_title"><b><a href = "<?php echo $article->getUrl(); ?>"><?php echo $article->getTitle(); ?></a></b></h2>
</div>
나는 그것을 감사하게 도울 수있다.
Thx
나는 그것을 시도했지만 작동하지 않습니다이 할 수 있습니다. 아마 헤더는 showAllComments 함수보다 먼저 빌드됩니다. – jcslzr
예. 어쩌면 showAllComments()가 article_id가 아닌 Article의 인스턴스를 취할 수있는 경우 함수 외부에서 가져올 수 있으며 HTML을 출력하기 전에 –