[Cartoweb-users] About Query

Pierre GIRAUD pierre.giraud at camptocamp.com
Thu Jun 16 11:53:19 EDT 2005


You should take care of 2 things.

First, please take advantage of the X library :

document.getElementById("result").innerhtml

should better be written :

var result = xGetElementById("result");
result = xInnerHtml(result);

Then, you'll have troubles using window.onload. You must note that it's 
not possible to have several window.onload in the same html.
To do that, an "onLoadString" is evaluated in a unique window.onload.
Then, you'll have to concatenate onLoadString, with your scripts (don't 
forget to use semi-colon ";").

For example :

onLoadString += 'alert "the HTML window is loaded";';


Regards

Pierre GIRAUD

>One possibility i see, before trying to modify the php, would be to set a
>javascript variable in the template via smarty and use a javascript function
>to launch a popup depending of the value.
>Leave the query result in your main page but in a hidden element, then copy
>the content of that hidden element in the popup via javascript.
>
>something like :
>-------------------------
>in your main page header:
>
><script language="JavaScript" type="text/javascript">
>    <!--
>  var result = "{if $tables_result|default:'0'}'1'{/if}";
>  {literal}
>    window.onload = function() {
>      if (result == "1") {
>        myContent =  document.getElementById("result").innerhtml;
>        window.open('', 'popuppage',
>'toolbar=no,location=no,status=no,menubar=no,resizable=yes,scrollbars=yes,co
>pyhistory=no,width=300,height=400');
>         popuppage.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
>4.01//EN""http://www.w3.org/TR/html4/strict.dtd">'+
>            '<html><head><title>My window</title></head><body>' + myContent
>+ '</body></html>')       }
>    }
>    {/literal}
>    //-->
>  </script>
>
>-----------
>in the body:
>
><div id="result" style="display:none;">
>              {$tables_result}
> </div>
>
>this is untested but it may work ^^
>
>Regards
>Oliver Christen
>
>  
>
>>Hello,
>>
>>I would like that the results of the requests appear in a new page, style
>>popup.
>>Should I modify a template?  Or is it necessary to modify the php code of
>>one of the plugins query, Mapquery or Tables?
>>
>>Thanks for your answers !
>>
>>Fred B
>>    
>>
>
>_______________________________________________
>Cartoweb-users mailing list
>Cartoweb-users at lists.maptools.org
>http://lists.maptools.org/mailman/listinfo/cartoweb-users
>  
>



More information about the Cartoweb-users mailing list