| 89 | == Portal Template == |
| 90 | |
| 91 | Portal templates are genshi templates, however, the portal system will register a new directive prior to rendering the template. This new directive is the <portlet.../> directive. |
| 92 | |
| 93 | === Sample Portal Template === |
| 94 | |
| 95 | {{{ |
| 96 | <html xmlns:p="http://trac.edgewall.org/portal" ...> |
| 97 | |
| 98 | <body> |
| 99 | |
| 100 | ... |
| 101 | |
| 102 | <p:portlet name="trac.portal.search.portlets.SearchFieldPortlet"/> |
| 103 | |
| 104 | ... |
| 105 | |
| 106 | <p:portlet name="trac.portal.timeline.TimelinePortlet"> |
| 107 | <param name="limit" value="10"/> |
| 108 | <param name="order" value="desc"/> |
| 109 | <param name="orderby" value="date"/> |
| 110 | <!-- no other content permitted here besides param elements --> |
| 111 | </p:portlet> |
| 112 | |
| 113 | ... |
| 114 | |
| 115 | </body> |
| 116 | |
| 117 | </html> |
| 118 | }}} |
| 119 | |
| 120 | |
| 121 | And, since portal templates are just Genshi templates, one can also use the dynamics of Genshi: |
| 122 | |
| 123 | {{{ |
| 124 | |
| 125 | ... |
| 126 | |
| 127 | <p:portlet py:if="foo" name="${bar}" class="myBar"/> |
| 128 | |
| 129 | ... |
| 130 | |
| 131 | <py:choose test="foo"> |
| 132 | <p:portlet py:when="bar" name="${baz}" class="myBaz"/> |
| 133 | <p:portlet py:when="car" name="${tar}" class="myTar"> |
| 134 | <param py:if="cat" name="..." value="..."/> |
| 135 | ... |
| 136 | </p:portlet> |
| 137 | </py:choose> |
| 138 | |
| 139 | ... |
| 140 | |
| 141 | }}} |
| 142 | |