Zend_View-Helpers-HtmlObject.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect3 id="zend.view.helpers.initial.object">
  4. <title>HTML Object Helpers</title>
  5. <para>
  6. The <acronym>HTML</acronym> <emphasis><![CDATA[
  7. <object>]]></emphasis> element is used for embedding
  8. media like Flash or QuickTime in web pages. The object view helpers take
  9. care of embedding media with minimum effort.
  10. </para>
  11. <para>
  12. There are four initial Object helpers:
  13. </para>
  14. <itemizedlist>
  15. <listitem>
  16. <para>
  17. <methodname>htmlFlash()</methodname>
  18. Generates markup for embedding Flash files.
  19. </para>
  20. </listitem>
  21. <listitem>
  22. <para>
  23. <methodname>htmlObject()</methodname>
  24. Generates markup for embedding a custom Object.
  25. </para>
  26. </listitem>
  27. <listitem>
  28. <para>
  29. <methodname>htmlPage()</methodname>
  30. Generates markup for embedding other (X)HTML pages.
  31. </para>
  32. </listitem>
  33. <listitem>
  34. <para>
  35. <methodname>htmlQuicktime()</methodname>
  36. Generates markup for embedding QuickTime files.
  37. </para>
  38. </listitem>
  39. </itemizedlist>
  40. <para>
  41. All of these helpers share a similar interface. For this reason, this
  42. documentation will only contain examples of two of these helpers.
  43. </para>
  44. <example id="zend.view.helpers.initial.object.flash">
  45. <title>Flash helper</title>
  46. <para>
  47. Embedding Flash in your page using the helper is pretty straight-forward.
  48. The only required argument is the resource <acronym>URI</acronym>.
  49. </para>
  50. <programlisting language="php"><![CDATA[
  51. <?php echo $this->htmlFlash('/path/to/flash.swf'); ?>
  52. ]]></programlisting>
  53. <para>
  54. This outputs the following <acronym>HTML</acronym>:
  55. </para>
  56. <programlisting language="html"><![CDATA[
  57. <object data="/path/to/flash.swf"
  58. type="application/x-shockwave-flash"
  59. classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
  60. codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">
  61. </object>
  62. ]]></programlisting>
  63. </example>
  64. <para>
  65. Additionally you can specify attributes, parameters and content that can
  66. be rendered along with the <emphasis><![CDATA[
  67. <object>]]></emphasis>. This will
  68. be demonstrated using the <methodname>htmlObject()</methodname> helper.
  69. </para>
  70. <example id="zend.view.helpers.initial.object.object">
  71. <title>Customizing the object by passing additional arguments</title>
  72. <para>
  73. The first argument in the object helpers is always required. It is
  74. the <acronym>URI</acronym> to the resource you want to embed. The second argument is
  75. only required in the <methodname>htmlObject()</methodname> helper. The other helpers
  76. already contain the correct value for this argument. The third
  77. argument is used for passing along attributes to the object element.
  78. It only accepts an array with key-value pairs. <property>classid</property>
  79. and <property>codebase</property> are examples of such attributes. The fourth
  80. argument also only takes a key-value array and uses them to create
  81. <emphasis><![CDATA[
  82. <param>]]></emphasis> elements. You will see an example
  83. of this shortly. Lastly, there is the option of providing additional
  84. content to the object. Now for an example which utilizes all arguments.
  85. </para>
  86. <programlisting language="php"><![CDATA[
  87. echo $this->htmlObject(
  88. '/path/to/file.ext',
  89. 'mime/type',
  90. array(
  91. 'attr1' => 'aval1',
  92. 'attr2' => 'aval2'
  93. ),
  94. array(
  95. 'param1' => 'pval1',
  96. 'param2' => 'pval2'
  97. ),
  98. 'some content'
  99. );
  100. /*
  101. This would output:
  102. <object data="/path/to/file.ext" type="mime/type"
  103. attr1="aval1" attr2="aval2">
  104. <param name="param1" value="pval1" />
  105. <param name="param2" value="pval2" />
  106. some content
  107. </object>
  108. */
  109. ]]></programlisting>
  110. </example>
  111. </sect3>
  112. <!--
  113. vim:se ts=4 sw=4 et:
  114. -->