PEAR_Info::getMembers (Previous) (Next) PEAR_Info::packageInstalled

View this page in Last updated: Sun, 05 Oct 2008
English | French | German | Japanese | Plain HTML

PEAR_Info::getStyleSheet()

PEAR_Info::getStyleSheet() -- 表示に使用する独自のスタイルシートを返す

説明

デフォルトでは、css の内容をを文字列で返します。 $contentFALSE に設定すると、css のファイル名を返します (これは setStyleSheet 関数で設定したものです)。 これは、<link rel="stylesheet" type="text/css" href="" /> タグに簡単に組み込むことができます (以下の例を参照ください)。

パラメータ

boolean $content

(オプション) css のファイル名を返すか、あるいはその内容を文字列で返すか。

例外・エラー

例外はスローされません。

利用可能なバージョン

バージョン 1.7.0RC1 (2007-07-01)

注意

この関数は、スタティックにコールする ことはできません。

返り値

string - css のファイル名あるいはその内容を返します。


<?php
// PEAR_Info のファイルが必要です
require_once 'PEAR/Info.php';

class PEAR_Info3 extends PEAR_Info
{
    function PEAR_Info3($pear_dir ''$user_file ''$system_file '')
    {
        $this->__construct($pear_dir$user_file$system_file);
    }

    function toHtml()
    {
        $styles basename($this->getStyleSheet(false));

        $body $this->info;

        $html = <<<HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" >
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="author" content="Laurent Laville" />
<title>PEAR_Info()</title>
<link rel="stylesheet" type="text/css" href="$styles" />
</head>
<body>

<div id="header">
<h1>Laurent-Laville.org</h1>
</div>

<div id="footer">
</div>

<div id="contents">
$body
</div>

</body>
</html>
HTML;
        return $html;
    }
}

// PEAR_Info オブジェクトを作成します
$info = new PEAR_Info3();

// スタイルを設定し、デフォルトのスタイルシートではなくこちらを使用します
$info->setStyleSheet(dirname(__FILE__) . DIRECTORY_SEPARATOR 'pearinfo3.css');

// PEAR_Info の出力を表示します
$info->display();
?>

PEAR_Info::getMembers (Previous) (Next) PEAR_Info::packageInstalled

Download Documentation Last updated: Sun, 05 Oct 2008
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.