Chris Kimpton wrote:
>
> Hi,
>
> I am still working on search portlet, which switches between a quick
> and an advanced version.
>
> In the advanced version I want to set the portlet title, so I have
> this code
>
> portlet.setTitle("Advanced Search");
>
> Where portlet is the VelocityPortlet parameter into the
> buildNormalContext method.
>
> This does not seem to work, I always get the title specified in the
> .xreg file...
>
It all depends on when do you try to set up the title:
- if it's during the the getContent() call, then it depends on the control
implementation
because if getContent is only called when needed, the portlet title is already
rendered...
If you're using on Velocity, you can modify the control template to do something like
this :
#if( ! $portlet.isClosed($data) )
#set ($content = $portlet.getContent($data))
<table border="0" bgcolor="$!{skin.BackgroundColor}" cellpadding="0" cellspacing="0"
width="100%">
<tr bgcolor="$!{skin.TitleBackgroundColor}">
<td align="left" bgcolor="$!{skin.TitleBackgroundColor}" nowrap="true"
valign="middle"
width="100%">
<b><font color="$!{skin.TitleTextColor}">$portlet.Title</font><b>
</td>
<td align="right" bgcolor="$!{skin.TitleBackgroundColor}" nowrap="true"
valign="middle">
#foreach ( $action in $actions )
<a href="${action.Link}"><img src="images/${action.Name}.gif" border="0"></a>
#end
</td>
</tr>
#if( ! $portlet.isMinimized($data) )
<tr>
<td colspan="2" align="center" valign="top" width="100%" >
<table border="0" cellpadding="2" cellspacing="0" width="100%" align="center">
<tr>
<td>
$content
</td>
</tr>
</table>
</td>
</tr>
#end
</table>
#end
Of course, this will never work for JSP portlets since they directly stream their
results...
It's a limitation of the current API which is fixed by the new Portlet API.
--
Raphael Luta - [EMAIL PROTECTED]
Vivendi Universal Networks - Paris
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]