| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- Reviewed: no -->
- <sect3 id="zend.view.helpers.initial.object">
- <title>HTML Object Helpers</title>
- <para>
- The <acronym>HTML</acronym> <emphasis><![CDATA[
- <object>]]></emphasis> element is used for embedding
- media like Flash or QuickTime in web pages. The object view helpers take
- care of embedding media with minimum effort.
- </para>
- <para>
- There are four initial Object helpers:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <methodname>htmlFlash()</methodname>
- Generates markup for embedding Flash files.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>htmlObject()</methodname>
- Generates markup for embedding a custom Object.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>htmlPage()</methodname>
- Generates markup for embedding other (X)HTML pages.
- </para>
- </listitem>
- <listitem>
- <para>
- <methodname>htmlQuicktime()</methodname>
- Generates markup for embedding QuickTime files.
- </para>
- </listitem>
- </itemizedlist>
- <para>
- All of these helpers share a similar interface. For this reason, this
- documentation will only contain examples of two of these helpers.
- </para>
- <example id="zend.view.helpers.initial.object.flash">
- <title>Flash helper</title>
- <para>
- Embedding Flash in your page using the helper is pretty straight-forward.
- The only required argument is the resource <acronym>URI</acronym>.
- </para>
- <programlisting language="php"><![CDATA[
- <?php echo $this->htmlFlash('/path/to/flash.swf'); ?>
- ]]></programlisting>
- <para>
- This outputs the following <acronym>HTML</acronym>:
- </para>
- <programlisting language="html"><![CDATA[
- <object data="/path/to/flash.swf"
- type="application/x-shockwave-flash"
- classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
- codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">
- </object>
- ]]></programlisting>
- </example>
- <para>
- Additionally you can specify attributes, parameters and content that can
- be rendered along with the <emphasis><![CDATA[
- <object>]]></emphasis>. This will
- be demonstrated using the <methodname>htmlObject()</methodname> helper.
- </para>
- <example id="zend.view.helpers.initial.object.object">
- <title>Customizing the object by passing additional arguments</title>
- <para>
- The first argument in the object helpers is always required. It is
- the <acronym>URI</acronym> to the resource you want to embed. The second argument is
- only required in the <methodname>htmlObject()</methodname> helper. The other helpers
- already contain the correct value for this argument. The third
- argument is used for passing along attributes to the object element.
- It only accepts an array with key-value pairs. <property>classid</property>
- and <property>codebase</property> are examples of such attributes. The fourth
- argument also only takes a key-value array and uses them to create
- <emphasis><![CDATA[
- <param>]]></emphasis> elements. You will see an example
- of this shortly. Lastly, there is the option of providing additional
- content to the object. Now for an example which utilizes all arguments.
- </para>
- <programlisting language="php"><![CDATA[
- echo $this->htmlObject(
- '/path/to/file.ext',
- 'mime/type',
- array(
- 'attr1' => 'aval1',
- 'attr2' => 'aval2'
- ),
- array(
- 'param1' => 'pval1',
- 'param2' => 'pval2'
- ),
- 'some content'
- );
- /*
- This would output:
- <object data="/path/to/file.ext" type="mime/type"
- attr1="aval1" attr2="aval2">
- <param name="param1" value="pval1" />
- <param name="param2" value="pval2" />
- some content
- </object>
- */
- ]]></programlisting>
- </example>
- </sect3>
- <!--
- vim:se ts=4 sw=4 et:
- -->
|