Hi Stephan,

Manipulating the DOM is an interesting way of doing this since with xhtml we are moving closer to cleaner xml. However when I view the source of those pages it seems to be a bit of an invalid jumble, eg:

<html>
<head>
        <title>Form example</title>
<link rel="stylesheet" type="text/css" media="screen" href="/ portaltest/public/styles/default.css" />
</head>
<body>
        <div id="content">
        <table width="100%" bordercolor="#00F000" border="1" cellpadding="10">
<tr>
<td width="100%">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http:// www.w3.org/TR/REC-html40/loose.dtd">
<html><body><div id="content">

<table width="100%"><tr>
<td><a href="/portaltest/Index/formExample">Form example</a></td>
                <td><a href="/portaltest/Index/linkExample">Link 
example</a></td>
                <td><a href="/portaltest/Index/modifyExample">Portlet
                modification</a></td>
        </tr></table>
<table align="bottom" width="100%"><tr>
<td align="right">
<small><a href="?portletaction=/TopMenu/EnableDebugWindow">Enable DebugWindow Output</a></small><br><small><a href="?portletaction=/ TopMenu/EnableInplaceDebug">Enable Inplace Debug Output</a></small> </td>

        </tr></table>
</div></body></html>
</td>
</tr>
<tr colspan="1">
<td>
<table width="100%" bordercolor="#00F000" border="1" cellpadding="10">
<tr>
<td width="100%">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http:// www.w3.org/TR/REC-html40/loose.dtd">
<html><body><div id="content">
<form action="?portletaction=/FormExampleLeft/submit" method="post">
<fieldset>
<label for="::formExampleLeft::name1">Name1:</label> <input type="text" class="input" name="::formExampleLeft::name1"><label for="::formExampleLeft::name2">Name2:</label> <input type="text" class="input" name="::formExampleLeft::name2">

</fieldset>
<div id="formbutton"><input type="submit" name="::formExampleLeft::send" value="Absenden"></div>
</form>
        
</div></body></html>
</td>
<td width="100%">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http:// www.w3.org/TR/REC-html40/loose.dtd">
<html><body><div id="content">
...

I've just picked up on the tail end of this conversation so not sure if I'm missing something, but is that what you intended?

Cheers,

Nick

Hi Dinh,

It is excellent, Stephan. It is a really good Composite View implementation. Could you share something on how you design it?

yes, sure. That's why I posted it :)
I currently use a programmatic description for the layout, it is stored into so-called containers which are built of frames which in turn might contain further (sub) containers or portlets.

It basically looks like this:

$container = new ContainerModel(ContainerModel::VERTICAL);              
$container->addFrame("topmenu", "TopMenu", ContainerModel::MAXSIZE);            
 

$subcontainer = new ContainerModel(ContainerModel::HORIZONTAL, $container);
$subcontainer->addFrame("mainspace", null, ContainerModel::MAXSIZE);
$container->addChild("contentspace", $subcontainer, ContainerModel::MAXSIZE);

As mentioned before, containers might be presented horizontally or vertically. The addFrame() command is passed the frame identifier, the portlet controller name (might be null) and the sizing.

The rendering is done using the container controller:

$controller = new ContainerController($container);
$controller->setRequestResponse($this->_request, $this->_response);

which is passed to the view.
In the view.tpl.php file,

echo $this->containerController->render();

is called. Using the php DOM parser, I'm replacing all hyperlinks in the portlets' html output. That's about it :)

The implementation however is far from being complete. For example there is only a limited number of error checks implemented currently, also frame size is only supported in a limited why as I'm using tables for layouting. div sections are probably better but not yet have time for this :/

I'll send the code and the demo in a separate email to not overload the mailing list. If someone should also please interested, just drop me a message. I'd love other people using it, improving the code and sending the improvements back :)

Regards,

Stephan

Reply via email to