mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
update docs
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@320077 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
5dbf975065
commit
71293396eb
11 changed files with 175 additions and 31 deletions
|
@ -12,7 +12,17 @@
|
|||
<section xml:id="yaf-bootstrap-abstract.intro">
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
|
||||
Bootstrap is a mechanism used to do some intial config before a
|
||||
Application run.
|
||||
</para>
|
||||
<para>
|
||||
User may define their own Bootstrap class by inheriting
|
||||
<classname>Yaf_Bootstrap_Abstract</classname>
|
||||
</para>
|
||||
<para>
|
||||
Any method declared in Bootstrap class with leading "_init", will be
|
||||
called by <methodname>Yaf_Application::bootstrap</methodname> one by one
|
||||
according to their defined order.
|
||||
</para>
|
||||
</section>
|
||||
<!-- }}} -->
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
<section xml:id="yaf-view-simple.intro">
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
|
||||
<classname>Yaf_View_Simple</classname> is the built-in template engine in
|
||||
Yaf, it is a simple but fast template engine, and only support PHP script
|
||||
template.
|
||||
</para>
|
||||
</section>
|
||||
<!-- }}} -->
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
</methodsynopsis>
|
||||
<para>
|
||||
Run a Bootstrap, all the methods defined in the Bootstrap and named with
|
||||
prefix "_init" will be called in the declaration order, if the parameter bootstrap is not supplied, Yaf will look
|
||||
prefix "_init" will be called according to their declaration order, if the parameter bootstrap is not supplied, Yaf will look
|
||||
for a Bootstrap under application.directory.
|
||||
</para>
|
||||
&warn.undocumented.func;
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
<refentry xml:id="yaf-view-simple.assign" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Yaf_View_Simple::assign</refname>
|
||||
<refpurpose>The assign purpose</refpurpose>
|
||||
<refpurpose>Assign values</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>void</type><methodname>Yaf_View_Simple::assign</methodname>
|
||||
<modifier>public</modifier> <type>bool</type><methodname>Yaf_View_Simple::assign</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>value</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>mixed</type><parameter>value</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
|
||||
|
@ -29,7 +29,10 @@
|
|||
<term><parameter>name</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
|
||||
A string or an array.
|
||||
</para>
|
||||
<para>
|
||||
if is string, then the next argument $value is required.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -37,7 +40,7 @@
|
|||
<term><parameter>value</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
|
||||
mixed value
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -51,6 +54,51 @@
|
|||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><function>Yaf_View_Simple::assign</function>example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
class IndexController extends Yaf_Controller_Abstract {
|
||||
public function indexAction() {
|
||||
$this->getView()->assign("foo", "bar");
|
||||
$this->_view->assign( array( "key" => "value", "name" => "value"));
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title><function>template</function>example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo $foo; ?></title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
foreach ($this->_tpl_vars as $name => value) {
|
||||
echo $$name; // or echo $this->_tpl_vars[$name];
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><methodname>Yaf_View_Simple::assignRef</methodname></member>
|
||||
<member><methodname>Yaf_View_Interface::assign</methodname></member>
|
||||
<member><methodname>Yaf_View_Interface::__set</methodname></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -10,12 +10,13 @@
|
|||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>void</type><methodname>Yaf_View_Simple::assignRef</methodname>
|
||||
<modifier>public</modifier> <type>bool</type><methodname>Yaf_View_Simple::assignRef</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter role="reference">value</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter role="reference">value</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
|
||||
unlike <methodname>Yaf_View_Simple::assign</methodname>, this method
|
||||
assign a ref value to engine.
|
||||
</para>
|
||||
|
||||
&warn.undocumented.func;
|
||||
|
@ -29,7 +30,7 @@
|
|||
<term><parameter>name</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
|
||||
A string name which will be used to access the value in the tempalte.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -37,7 +38,7 @@
|
|||
<term><parameter>value</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
|
||||
mixed value
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -51,6 +52,62 @@
|
|||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><function>Yaf_View_Simple::assignRef</function>example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
class IndexController extends Yaf_Controller_Abstract {
|
||||
public function indexAction() {
|
||||
$value = "bar";
|
||||
$this->getView()->assign("foo", $value);
|
||||
|
||||
/* plz note that there was a bug before Yaf 2.1.4,
|
||||
* which make following output "bar";
|
||||
*/
|
||||
$dummy = $this->getView()->render("index/index.phtml");
|
||||
echo $value;
|
||||
|
||||
//prevent the auto-render
|
||||
Yaf_Dispatcher::getInstance()->autoRender(FALSE);
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title><function>template</function>example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo $foo; $foo = "changed"; ?></title>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
/* access the index controller will result: */
|
||||
changed
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><methodname>Yaf_View_Simple::assign</methodname></member>
|
||||
<member><methodname>Yaf_View_Interface::assign</methodname></member>
|
||||
<member><methodname>Yaf_View_Interface::__set</methodname></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
<term><parameter>tempalte_dir</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
|
||||
The base directory of the templates, by default,
|
||||
it is APPLICATOIN . "/views" for Yaf.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
|
|
@ -4,18 +4,18 @@
|
|||
<refentry xml:id="yaf-view-simple.display" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Yaf_View_Simple::display</refname>
|
||||
<refpurpose>The display purpose</refpurpose>
|
||||
<refpurpose>Render and dispaly</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>void</type><methodname>Yaf_View_Simple::display</methodname>
|
||||
<modifier>public</modifier> <type>bool</type><methodname>Yaf_View_Simple::display</methodname>
|
||||
<methodparam><type>string</type><parameter>tpl</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>tpl_vars</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>array</type><parameter>tpl_vars</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
|
||||
Render a template and dispaly the result instantly.
|
||||
</para>
|
||||
|
||||
&warn.undocumented.func;
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
<refentry xml:id="yaf-view-simple.getscriptpath" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Yaf_View_Simple::getScriptPath</refname>
|
||||
<refpurpose>The getScriptPath purpose</refpurpose>
|
||||
<refpurpose>Get template base directory</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>void</type><methodname>Yaf_View_Simple::getScriptPath</methodname>
|
||||
<modifier>public</modifier> <type>string</type><methodname>Yaf_View_Simple::getScriptPath</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
|
|
|
@ -4,18 +4,18 @@
|
|||
<refentry xml:id="yaf-view-simple.render" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Yaf_View_Simple::render</refname>
|
||||
<refpurpose>The render purpose</refpurpose>
|
||||
<refpurpose>Render template</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>void</type><methodname>Yaf_View_Simple::render</methodname>
|
||||
<modifier>public</modifier> <type>string</type><methodname>Yaf_View_Simple::render</methodname>
|
||||
<methodparam><type>string</type><parameter>tpl</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>tpl_vars</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>array</type><parameter>tpl_vars</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
|
||||
Render a tempalte and return the result.
|
||||
</para>
|
||||
|
||||
&warn.undocumented.func;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<refentry xml:id="yaf-view-simple.set" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Yaf_View_Simple::__set</refname>
|
||||
<refpurpose>The __set purpose</refpurpose>
|
||||
<refpurpose>Set value to engine</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
|
@ -12,10 +12,11 @@
|
|||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>void</type><methodname>Yaf_View_Simple::__set</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>value</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
|
||||
This is a easier way to instead of
|
||||
<methodname>Yaf_View_Simple::assign</methodname>.
|
||||
</para>
|
||||
|
||||
&warn.undocumented.func;
|
||||
|
@ -29,7 +30,7 @@
|
|||
<term><parameter>name</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
|
||||
A string value name.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -37,7 +38,7 @@
|
|||
<term><parameter>value</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
|
||||
Mixed value.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -51,6 +52,31 @@
|
|||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><function>Yaf_View_Simple::__set</function>example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
class IndexController extends Yaf_Controller_Abstract {
|
||||
public function indexAction() {
|
||||
$this->getView()->foo = "bar"; // same as assign("foo", "bar");
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><methodname>Yaf_View_Simple::assignRef</methodname></member>
|
||||
<member><methodname>Yaf_View_Interface::assign</methodname></member>
|
||||
<member><methodname>Yaf_View_Interface::__set</methodname></member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
<refentry xml:id="yaf-view-simple.setscriptpath" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Yaf_View_Simple::setScriptPath</refname>
|
||||
<refpurpose>The setScriptPath purpose</refpurpose>
|
||||
<refpurpose>Set tempalte base directory</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>void</type><methodname>Yaf_View_Simple::setScriptPath</methodname>
|
||||
<modifier>public</modifier> <type>bool</type><methodname>Yaf_View_Simple::setScriptPath</methodname>
|
||||
<methodparam><type>string</type><parameter>template_dir</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
|
|
Loading…
Reference in a new issue