[Chameleon] widget within a widget

Paul Spencer pspencer at dmsolutions.ca
Thu Feb 10 20:20:49 EST 2005


Jennifer ... sorry for the delay in responding ...

Jennifer Zeisloft wrote:
> Hello All-
> 
> I am attempting to place a widget within a widget, but am uncertain
> how to do this or whether this is even possible.

technically it is not.  From reading ahead, I think you are attempting 
to return the tag for a widget from another widget.  At the time that 
this code is run, all widgets have been parsed and no more will be 
created.  You'll end up with the text of the widget tag in your 
application, but it won't be visible (except for broken images for the 
<image ...> tags because the browser will suppress the output thinking 
they are invalid HTML tags.

> 
> Specifically, I am trying to place the Link widget within the Query
> widget.  Ideally, I would like to place a link button on the title bar
> of each layer appearing in the query window that is hotlinked to
> another resource.  I attempted to call the widget from within a second
> <td> tag for the formatting of the layer title row:
> 
> $szReturnValue .= "<td colspan=\"2\" class=\"titleArea\"><p
> class=\"text\"><u><b>$szTitle</b></u></p></td>\n";
> 
> $szReturnValue .= "<td><cwc2 type="Link" visible="true" imagetip="Link
> to additional resources" URL="http://www.google.com" PopupWidth="500"
> PopupHeight="600" image="icons/icon_link.png" toolset="Navigation"
> styleresource="NavButtons" popupstyleresource="TextButtons">
>              <image state="normal"/>
>              <image state="hover"/>
>              <image state="selected"/>
> </cwc2></td>\n";
> 
> $szReturnValue .= "</tr>\n";
> 
> But received an error:
> 
> Parse error: parse error, unexpected T_STRING in
> C:\ms4w\apps\chameleon\htdocs\widgets\Query\QueryResults.phtml on line
> 401
>

even though this won't work, the error is because of your use of quotes. 
  You have double quotes (") around your string, and also double quotes 
within your string.  To get around this, you can also use single quotes.

$szReturnValue .= "<td colspan=\"2\" class=\"titleArea\"><p
  class=\"text\"><u><b>$szTitle</b></u></p></td>\n";

  $szReturnValue .= '<td><cwc2 type="Link" visible="true" imagetip="Link
  to additional resources" URL="http://www.google.com" PopupWidth="500"
  PopupHeight="600" image="icons/icon_link.png" toolset="Navigation"
  styleresource="NavButtons" popupstyleresource="TextButtons">
               <image state="normal"/>
               <image state="hover"/>
               <image state="selected"/>
  </cwc2></td>'."\n";

note that I concatenated the \n in double quotes.  PHP treats 
single-quoted strings literally and won't honour your \n as a carriage 
return - nor would it replace $variables ...


> I have to admit (if it isn't already painfully obvious) that I have
> very minimal computer programming / php experience.  While I am fairly
> certain I can write the function to utilize URLs from a dbf file and
> the code to make the widget appear only when appropriate, I am lost as
> to where or how to place the code (and am I missing some other code
> that would be required to do this??) to call the Link widget in the
> first place.
> 
> I am extremely grateful for any advice you can offer.  Thank you in
> advance for your help!

um I'm not entirely certain what you are trying to accomplish.  Could 
you explain it in functional terms and perhaps I can point you in the 
right direction.

> 
> Jennifer Zeisloft
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
> 

Cheers

Paul
-- 
+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+


More information about the Chameleon mailing list