hi all,
I just commited and will soon sync to sf cvs:
-The Page class can now do "static" module output. Ok, what the hell are
you talking about? :) static module output is an embedded call in markup
that loads and outputs the given modules. My intent is for users to be able
to define binarycloud pages in xml like this:
<page>
<init>
...
</init>
<templates>
...
</templates>
<markup>
<p align="right">
<bc:module name="HelloWorld" package="hello_world" id="module_id">
<param:any_api_param>value</param:any_api_param>
</bc:module>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td valign="top">
<bc:module name="Example" package="example_package" id="module_id">
<param:any_api_param>value</param:any_api_param>
</bc:module>
</td>
<td valign="top">
<bc:module name="OtherWorld" package="hello_world" id="module_id">
<param:any_api_param>value</param:any_api_param>
</bc:module>
</td>
</tr>
</table>
<hr>
</markup>
</page>
or like this:
<page>
<init>
<ini>true</ini>
<auth>false</auth>
<perm>false</perm>
<sess>true</sess>
<lang>true</lang>
<cache>true</cache>
</init>
<templates>
<default>
<name>exmaple_master</name>
<package>html.masters</package>
<type>html</type>
</default>
</templates>
<modules>
<content>
<layout>
<name>exmaple_layout</name>
<package>html.layouts</package>
</layout>
<load>
<module>
<id>product_list</id>
<name>ProductLister</name>
<package>user.mod.products</package>
<load_order>1</load_order>
<params>
<example>this is an option value</example>
<another>1</another>
</params>
</module>
<module>
<id>product_delete</id>
<name>DeleteProduct</name>
<package>user.mod.products</package>
<load_order>2</load_order>
</module>
</load>
</content>
</modules>
</page>
In the first example, you'll see there there is still a basic page
definition: core components, a master template, etc - but notice that there
is no modules array, and there is _markup_ in the page definition. Then,
have a look at <bc:module> tags - these will be interpreted (I say will,
because I haven't done that yet) at make-time into this:
<? $Page->BuildModule(array('name' => 'HelloWorld','package' =>
'hello_world','id' => 'first_one')); ?>
etc.
You can have a look at user/htdocs/static_module.php for an idea.
I like this syntax because it allows non-programmer users to define pages
and embed modules without worrying about php syntax - they use familiar tags
to call in modules that programmers provide.
Why is this worthwhile?
It means you can forego using layouts and module lists if you don't need the
advanced features page offers (load/init ordering, etc) - and it's obviously
convenient for embedding modules _anywhere_ (yes, you could embed one
module's output in another module's output!)
Oh yeah, I also made sure that these "new style pages" are cacheable
(user/htdocs/static_module.php is cached, for example)
I'm sure there will be questions on this, fire away!
:)
_alex
--
alex black, ceo
en...@tu...
the turing studio, inc.
http://www.turingstudio.com
vox+510.666.0074
fax+510.666.0093
|