Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed append/prepend examples order #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</para>
<para>
Optionally <varname>{block}</varname> areas of child and parent templates can be merged into each other. You can append or prepend the parent <varname>{block}</varname>
content by using the <literal>append</literal> or <literal>prepend</literal> option flag with the childs <varname>{block}</varname> definition. With the {$smarty.block.parent} the <varname>{block}</varname> content
of the parent template can be inserted at any location of the child <varname>{block}</varname> content. {$smarty.block.child} inserts the <varname>{block}</varname> content of
content by using the <literal>append</literal> or <literal>prepend</literal> option flag with the childs <varname>{block}</varname> definition. With the {$smarty.block.parent} the <varname>{block}</varname> content
of the parent template can be inserted at any location of the child <varname>{block}</varname> content. {$smarty.block.child} inserts the <varname>{block}</varname> content of
the child template at any location of the parent <varname>{block}</varname>.
</para>
<para><varname>{blocks}'s</varname> can be nested.
Expand Down Expand Up @@ -49,7 +49,7 @@
</tgroup>
</informaltable>


<para><emphasis role="bold">Option Flags (in child templates only):</emphasis></para>
<informaltable frame="all">
<tgroup cols="2">
Expand All @@ -65,23 +65,23 @@
<row>
<entry>append</entry>
<entry>The <varname>{block}</varname> content will be be appended to the content of the parent template <varname>{block}</varname></entry>
</row>
</row>
<row>
<entry>prepend</entry>
<entry>The <varname>{block}</varname> content will be prepended to the content of the parent template <varname>{block}</varname></entry>
</row>
</row>
<row>
<entry>hide</entry>
<entry>Ignore the block content if no child block of same name is existing.</entry>
</row>
</row>
<row>
<entry>nocache</entry>
<entry>Disables caching of the <varname>{block}</varname> content</entry>
</row>
</tbody>
</tgroup>
</informaltable>


<example>
<title>Simple <varname>{block}</varname> example</title>
Expand All @@ -99,7 +99,7 @@
<para>child.tpl</para>
<programlisting>
<![CDATA[
{extends file="parent.tpl"}
{extends file="parent.tpl"}
{block name="title"}
Page Title
{/block}
Expand All @@ -114,28 +114,26 @@ Page Title
</head>
</html>
]]>
</programlisting>
</programlisting>
</example>

<example>
<title>Prepend <varname>{block}</varname> example</title>
<title>Append <varname>{block}</varname> example</title>
<para>parent.tpl</para>
<programlisting>
<![CDATA[
<html>
<head>
<title>{block name="title"}Title - {/block}</title>
<title>{block name="title"}Title{/block}</title>
</head>
</html>
]]>
</programlisting>
<para>child.tpl</para>
<programlisting>
<![CDATA[
{extends file="parent.tpl"}
{block name="title" prepend}
Page Title
{/block}
{extends file="parent.tpl"}
{block name="title" append} - Page Title{/block}
]]>
</programlisting>
<para>The result would look like</para>
Expand All @@ -147,11 +145,11 @@ Page Title
</head>
</html>
]]>
</programlisting>
</programlisting>
</example>

<example>
<title>Append <varname>{block}</varname> example</title>
<title>Prepend <varname>{block}</varname> example</title>
<para>parent.tpl</para>
<programlisting>
<![CDATA[
Expand All @@ -165,8 +163,8 @@ Page Title
<para>child.tpl</para>
<programlisting>
<![CDATA[
{extends file="parent.tpl"}
{block name="title" append}
{extends file="parent.tpl"}
{block name="title" prepend}
Page Title
{/block}
]]>
Expand All @@ -180,9 +178,9 @@ Page Title
</head>
</html>
]]>
</programlisting>
</programlisting>
</example>

<example>
<title><varname>{$smarty.block.child}</varname> example</title>
<para>parent.tpl</para>
Expand All @@ -193,12 +191,22 @@ Page Title
<title>{block name="title"}The {$smarty.block.child} was inserted here{/block}</title>
</head>
</html>
]]>
</programlisting>
<para>or using <varname>{child}</varname> macro</para>
<programlisting>
<![CDATA[
<html>
<head>
<title>{block name="title"}The {child} was inserted here{/block}</title>
</head>
</html>
]]>
</programlisting>
<para>child.tpl</para>
<programlisting>
<![CDATA[
{extends file="parent.tpl"}
{extends file="parent.tpl"}
{block name="title"}
Child Title
{/block}
Expand All @@ -213,8 +221,9 @@ Child Title
</head>
</html>
]]>
</programlisting>
</programlisting>
</example>

<example>
<title><varname>{$smarty.block.parent}</varname> example</title>
<para>parent.tpl</para>
Expand All @@ -230,10 +239,19 @@ Child Title
<para>child.tpl</para>
<programlisting>
<![CDATA[
{extends file="parent.tpl"}
{extends file="parent.tpl"}
{block name="title"}
You will see now - {$smarty.block.parent} - here
{/block}
]]>
</programlisting>
<para>or using <varname>{parent}</varname> macro</para>
<programlisting>
<![CDATA[
{extends file="parent.tpl"}
{block name="title"}
You will see now - {parent} - here
{/block}
]]>
</programlisting>
<para>The result would look like</para>
Expand All @@ -245,9 +263,9 @@ You will see now - {$smarty.block.parent} - here
</head>
</html>
]]>
</programlisting>
</programlisting>
</example>

<para>
See also
<link linkend="advanced.features.template.inheritance">Template Inheritance</link>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</tgroup>
</informaltable>


<para><emphasis role="bold">オプションのフラグ (子テンプレートのみ)</emphasis></para>
<informaltable frame="all">
<tgroup cols="2">
Expand All @@ -74,23 +74,23 @@
<row>
<entry>append</entry>
<entry><varname>{block}</varname> のコンテンツを親テンプレートの <varname>{block}</varname> に追記する</entry>
</row>
</row>
<row>
<entry>prepend</entry>
<entry><varname>{block}</varname> のコンテンツを親テンプレートの <varname>{block}</varname> の前に置く</entry>
</row>
</row>
<row>
<entry>hide</entry>
<entry>同じ名前の子ブロックが存在しないときに、ブロックのコンテンツを無視する</entry>
</row>
</row>
<row>
<entry>nocache</entry>
<entry><varname>{block}</varname> のコンテンツのキャッシュを無効にする</entry>
</row>
</tbody>
</tgroup>
</informaltable>


<example>
<title>シンプルな <varname>{block}</varname> の例</title>
Expand All @@ -108,7 +108,7 @@
<para>child.tpl</para>
<programlisting>
<![CDATA[
{extends file="parent.tpl"}
{extends file="parent.tpl"}
{block name="title"}
Page Title
{/block}
Expand All @@ -123,28 +123,26 @@ Page Title
</head>
</html>
]]>
</programlisting>
</programlisting>
</example>

<example>
<title><varname>{block}</varname> を前に置く例</title>
<title><varname>{block}</varname> を後に置く例</title>
<para>parent.tpl</para>
<programlisting>
<![CDATA[
<html>
<head>
<title>{block name="title"}Title - {/block}</title>
<title>{block name="title"}Title{/block}</title>
</head>
</html>
]]>
</programlisting>
<para>child.tpl</para>
<programlisting>
<![CDATA[
{extends file="parent.tpl"}
{block name="title" prepend}
Page Title
{/block}
{extends file="parent.tpl"}
{block name="title" append} - Page Title{/block}
]]>
</programlisting>
<para>結果は、このようになります。</para>
Expand All @@ -156,11 +154,11 @@ Page Title
</head>
</html>
]]>
</programlisting>
</programlisting>
</example>

<example>
<title><varname>{block}</varname> を後に置く例</title>
<title><varname>{block}</varname> を前に置く例</title>
<para>parent.tpl</para>
<programlisting>
<![CDATA[
Expand All @@ -174,8 +172,8 @@ Page Title
<para>child.tpl</para>
<programlisting>
<![CDATA[
{extends file="parent.tpl"}
{block name="title" append}
{extends file="parent.tpl"}
{block name="title" prepend}
Page Title
{/block}
]]>
Expand All @@ -189,9 +187,9 @@ Page Title
</head>
</html>
]]>
</programlisting>
</programlisting>
</example>

<example>
<title><varname>{$smarty.block.child}</varname> の例</title>
<para>parent.tpl</para>
Expand All @@ -202,12 +200,22 @@ Page Title
<title>{block name="title"}The {$smarty.block.child} was inserted here{/block}</title>
</head>
</html>
]]>
</programlisting>
<para>or using <varname>{child}</varname> macro</para>
<programlisting>
<![CDATA[
<html>
<head>
<title>{block name="title"}The {child} was inserted here{/block}</title>
</head>
</html>
]]>
</programlisting>
<para>child.tpl</para>
<programlisting>
<![CDATA[
{extends file="parent.tpl"}
{extends file="parent.tpl"}
{block name="title"}
Child Title
{/block}
Expand All @@ -222,7 +230,7 @@ Child Title
</head>
</html>
]]>
</programlisting>
</programlisting>
</example>
<example>
<title><varname>{$smarty.block.parent}</varname> の例</title>
Expand All @@ -239,10 +247,19 @@ Child Title
<para>child.tpl</para>
<programlisting>
<![CDATA[
{extends file="parent.tpl"}
{extends file="parent.tpl"}
{block name="title"}
You will see now - {$smarty.block.parent} - here
{/block}
]]>
</programlisting>
<para>or using <varname>{parent}</varname> macro</para>
<programlisting>
<![CDATA[
{extends file="parent.tpl"}
{block name="title"}
You will see now - {parent} - here
{/block}
]]>
</programlisting>
<para>結果は、このようになります。</para>
Expand All @@ -254,9 +271,9 @@ You will see now - {$smarty.block.parent} - here
</head>
</html>
]]>
</programlisting>
</programlisting>
</example>

<para>
<link linkend="advanced.features.template.inheritance">テンプレートの継承</link>、
<link linkend="language.variables.smarty.block.parent"><parameter>$smarty.block.parent</parameter></link>、
Expand Down