mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 11:24:27 +02:00
even more tweaks
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
group with provided data. It takes care of which item(s) are
|
||||
selected by default as well. Required attributes are values and
|
||||
output, unless you use options instead. All output is XHTML
|
||||
compatible.
|
||||
compliant.
|
||||
</para>
|
||||
|
||||
<informaltable frame="all">
|
||||
@@ -117,8 +117,8 @@ where template is
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{html_checkboxes name="id" values=$cust_ids output=$cust_names
|
||||
selected=$customer_id separator="<br />"}
|
||||
{html_checkboxes name='id' values=$cust_ids output=$cust_names
|
||||
selected=$customer_id separator='<br />'}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
@@ -144,7 +144,7 @@ $smarty->assign('customer_id', 1001);
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{html_checkboxes name="id" options=$cust_checkboxes selected=$customer_id separator="<br />"}
|
||||
{html_checkboxes name='id' options=$cust_checkboxes selected=$customer_id separator='<br />'}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
@@ -168,10 +168,11 @@ $smarty->assign('customer_id', 1001);
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$sql = 'select type_id, types from types order by type';
|
||||
$smarty->assign('types',$db->getAssoc($sql));
|
||||
$sql = 'select type_id, types from contact_types order by type';
|
||||
$smarty->assign('contact_types',$db->getAssoc($sql));
|
||||
|
||||
$sql = 'select * from contacts where contact_id=12';
|
||||
$sql = 'select contact_id, contact_type_id, contact '
|
||||
,'from contacts where contact_id=12';
|
||||
$smarty->assign('contact',$db->getRow($sql));
|
||||
|
||||
?>
|
||||
@@ -179,7 +180,8 @@ $smarty->assign('contact',$db->getRow($sql));
|
||||
</programlisting>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{html_checkboxes name="type" options=$types selected=$contact.type_id separator="<br />"}
|
||||
{html_checkboxes name='contact_type_id' options=$contact_types
|
||||
selected=$contact.contact_type_id separator='<br />'}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@@ -117,9 +117,9 @@
|
||||
<![CDATA[
|
||||
where index.tpl is:
|
||||
-------------------
|
||||
{html_image file="pumpkin.jpg"}
|
||||
{html_image file="/path/from/docroot/pumpkin.jpg"}
|
||||
{html_image file="../path/relative/to/currdir/pumpkin.jpg"}
|
||||
{html_image file='pumpkin.jpg'}
|
||||
{html_image file='/path/from/docroot/pumpkin.jpg'}
|
||||
{html_image file='../path/relative/to/currdir/pumpkin.jpg'}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
|
@@ -159,10 +159,10 @@ where template is:
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$sql = 'select type_id, types from types order by type';
|
||||
$smarty->assign('types',$db->getAssoc($sql));
|
||||
$sql = 'select type_id, types from contact_types order by type';
|
||||
$smarty->assign('contact_types',$db->getAssoc($sql));
|
||||
|
||||
$sql = 'select contact_id, name, email, type_id
|
||||
$sql = 'select contact_id, name, email, contact_type_id
|
||||
from contacts where contact_id='.$contact_id;
|
||||
$smarty->assign('contact',$db->getRow($sql));
|
||||
|
||||
@@ -176,7 +176,8 @@ where the template is:
|
||||
<![CDATA[
|
||||
<select name="type_id">
|
||||
<option value='null'>-- none --</option>
|
||||
{html_options name="type" options=$types selected=$contact.type_id}
|
||||
{html_options name='contact_type_type' options=$contact_types
|
||||
selected=$contact.type_id}
|
||||
</select>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
that creates html radio button
|
||||
group with provided data. It takes care of which item is selected
|
||||
by default as well. Required attributes are values and output,
|
||||
unless you use options instead. All output is XHTML compatible.
|
||||
unless you use options instead. All output is XHTML compliant.
|
||||
</para>
|
||||
|
||||
<informaltable frame="all">
|
||||
@@ -80,7 +80,7 @@
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>{html_radios} : Example 1</title>
|
||||
<title>{html_radios} example 1</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -102,13 +102,13 @@ $smarty->assign('customer_id', 1001);
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{html_radios name="id" values=$cust_ids output=$cust_names
|
||||
selected=$customer_id separator="<br />"}
|
||||
{html_radios name='id' values=$cust_ids output=$cust_names
|
||||
selected=$customer_id separator='<br />'}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>{html_radios} : Example 2</title>
|
||||
<title>{html_radios} example 2</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -128,7 +128,8 @@ $smarty->assign('customer_id', 1001);
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{html_radios name="id" options=$cust_radios selected=$customer_id separator="<br />"}
|
||||
{html_radios name='id' options=$cust_radios
|
||||
selected=$customer_id separator='<br />'}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
@@ -145,7 +146,7 @@ $smarty->assign('customer_id', 1001);
|
||||
</screen>
|
||||
</example>
|
||||
<example>
|
||||
<title>{html_radios}- Database example (eg PEAR or ADODB):</title>
|
||||
<title>{html_radios} - Database example (eg PEAR or ADODB):</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -153,7 +154,7 @@ $smarty->assign('customer_id', 1001);
|
||||
$sql = 'select type_id, types from types order by type';
|
||||
$smarty->assign('types',$db->getAssoc($sql));
|
||||
|
||||
$sql = 'select contact_id, name, email, type_id
|
||||
$sql = 'select contact_id, name, email, contact_type_id
|
||||
from contacts where contact_id='.$contact_id;
|
||||
$smarty->assign('contact',$db->getRow($sql));
|
||||
|
||||
@@ -165,7 +166,8 @@ $smarty->assign('contact',$db->getRow($sql));
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{html_radios name="type" options=$types selected=$contact.type_id separator="<br />"}
|
||||
{html_radios name='contact_type_type' options=$types
|
||||
selected=$contact.contact_type_id separator='<br />'}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@@ -105,38 +105,38 @@
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>{mailto}</title>
|
||||
<title>{mailto} example lines followed by the result</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{mailto address="me@example.com"}
|
||||
{mailto address="me@example.com"}
|
||||
<a href="mailto:me@example.com" >me@example.com</a>
|
||||
|
||||
{mailto address="me@example.com" text="send me some mail"}
|
||||
{mailto address="me@example.com" text="send me some mail"}
|
||||
<a href="mailto:me@example.com" >send me some mail</a>
|
||||
|
||||
{mailto address="me@example.com" encode="javascript"}
|
||||
{mailto address="me@example.com" encode="javascript"}
|
||||
<script type="text/javascript" language="javascript">
|
||||
eval(unescape('%64%6f% ... snipped ...%61%3e%27%29%3b'))
|
||||
</script>
|
||||
|
||||
{mailto address="me@example.com" encode="hex"}
|
||||
{mailto address="me@example.com" encode="hex"}
|
||||
<a href="mailto:%6d%65.. snipped..3%6f%6d">m&..snipped...#x6f;m</a>
|
||||
|
||||
{mailto address="me@example.com" subject="Hello to you!"}
|
||||
<a href="mailto:me@example.com?subject=Hello%20to%20you%21" >me@example.com</a>
|
||||
mailto address="me@example.com" subject="Hello to you!"}
|
||||
<a href="mailto:me@example.com?subject=Hello%20to%20you%21" >me@example.com</a>
|
||||
|
||||
{mailto address="me@example.com" cc="you@example.com,they@example.com"}
|
||||
<a href="mailto:me@example.com?cc=you@example.com%2Cthey@example.com" >me@example.com</a>
|
||||
<a href="mailto:me@example.com?cc=you@example.com%2Cthey@example.com" >me@example.com</a>
|
||||
|
||||
{mailto address="me@example.com" extra='class="email"'}
|
||||
<a href="mailto:me@example.com" class="email">me@example.com</a>
|
||||
<a href="mailto:me@example.com" class="email">me@example.com</a>
|
||||
|
||||
{mailto address="me@example.com" encode="javascript_charcode"}
|
||||
<script type="text/javascript" language="javascript">
|
||||
<!--
|
||||
<script type="text/javascript" language="javascript">
|
||||
<!--
|
||||
{document.write(String.fromCharCode(60,97, ... snipped ....60,47,97,62))}
|
||||
//-->
|
||||
</script>
|
||||
//-->
|
||||
</script>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@@ -23,7 +23,7 @@
|
||||
<![CDATA[
|
||||
<head>
|
||||
{* popup_init must be called once at the top of the page *}
|
||||
{popup_init src="javascripts/overlib.js"}
|
||||
{popup_init src='javascripts/overlib/overlib.js'}
|
||||
</head>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@@ -402,18 +402,20 @@
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* popup_init must be called once at the top of the page *}
|
||||
{popup_init src="/javascripts/overlib.js"}
|
||||
{popup_init src='/javascripts/overlib.js'}
|
||||
|
||||
{* create a link with a popup window when you move your mouse over *}
|
||||
<a href="mypage.html" {popup text="This link takes you to my page!"}>mypage</a>
|
||||
<a href="mypage.html" {popup text='This link takes you to my page!'}>mypage</a>
|
||||
|
||||
{* you can use html, links, etc in your popup text *}
|
||||
<a href="mypage.html" {popup sticky=true caption="mypage contents"
|
||||
<a href="mypage.html" {popup sticky=true caption='mypage contents'
|
||||
text="<ul><li>links</li><li>pages</li><li>images</li></ul>"
|
||||
snapx=10 snapy=10}>mypage</a>
|
||||
snapx=10 snapy=10 trigger='onClick'}>mypage</a>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>There is another good example on the
|
||||
<link linkend="language.function.capture">{capture}</link> page.</para>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="language.function.popup.init">{popup_init}</link>
|
||||
|
Reference in New Issue
Block a user