<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
Wow,<br>
<br>
Thank you for the fast response on a sunday evening! Seems I am not the
only addict here <span class="moz-smiley-s3"><span> ;-) </span></span><br>
<br>
I indeed meant the cartoclient.tpl, correct.<br>
I do not need an ini just yet, I just want to let cartoweb display this
plugin template content for me. I took over a project from a guy doing
an internship. He messed things up a bit by hacking into the highest
directories for cartoweb. I am trying to do it right this time.<br>
<br>
I have now changed my ClientprojectSelect.php (name of my plugin) to<br>
&lt;?php<br>
class ClientprojectSelect extends ClientPlugin<br>
{<br>
protected function drawprojectSelect() {<br>
&nbsp;&nbsp;&nbsp; $smarty = new Smarty_Plugin($this-&gt;getCartoclient(), $this);<br>
&nbsp;&nbsp;&nbsp; return $smarty-&gt;fetch('projectSelect.tpl');<br>
}<br>
<br>
public function renderForm(Smarty $template) {<br>
&nbsp;&nbsp;&nbsp;&nbsp; $projectSelect_active =
$this-&gt;getConfig()-&gt;projectSelectActive;<br>
&nbsp;&nbsp;&nbsp;&nbsp; $template-&gt;assign(array('prjectSelect_active' =&gt;
$projectSelect_active));<br>
&nbsp;&nbsp;&nbsp;&nbsp; if ($projectSelect_active)<br>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $template-&gt;assign('projectSelect',
$this-&gt;drawprojectSelect());<br>
&nbsp;&nbsp;&nbsp; }<br>
}<br>
<br>
?&gt;<br>
<br>
<br>
All I want it to do is display the content of the tpl, but now I am
getting headers not sent info..<br>
<br>
Please see the error messages I am getting now:<br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
 href="http://82.176.214.209/cartoweb/webGIS.php">http://82.176.214.209/cartoweb/webGIS.php</a><br>
<br>
What am I doing wrong?<br>
<br>
Yves Jacolin schreef:
<blockquote cite="mid:200708121857.38559.yjacolin@free.fr" type="cite">
  <pre wrap="">Le dimanche 12 ao&ucirc;t 2007 18:45, Milo van der Linden a &eacute;crit&nbsp;:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Hello list,

I am trying to write a simple, static plugin that displays a dropdownbox
on the cartoweb GUI, for now it doesn't have to do anything. I just want
to check if I am capable of taking the first steps in writing plugins.

I did the following:

I created the required directories:

&lt;myProject&gt;/plugins/myplugin
&lt;myProject&gt;/plugins/myplugin/client
&lt;myProject&gt;/plugins/myplugin/templates

in client I created a file Clientmyplugin.php
in templates I created a file myplugin.tpl

In the myplugin.tpl I have the following code:

&lt;div id="mypluginSelect"&gt;
&lt;SELECT NAME="myplugin_select"&gt;
&lt;OPTION VALUE=""&gt;
&lt;OPTION VALUE="1"&gt; Project 1
&lt;OPTION VALUE="2"&gt; Project 2
&lt;OPTION VALUE="3"&gt; Project 3
&lt;/SELECT&gt;
&lt;/div&gt;

As you can see, it is very static.

In Clientmyplugin.php I have the following code:

class Clientmyplugin extends ClientPlugin
implements Sessionable, GuiProvider
{

    /* here comes your plugin client class definition */

}


In the client.ini.in; I added myplugin to the loadplugins= line

In my customized cartoclient.php I added

{if $myplugin_active|default:''}
   {$myplugin}
   {/if}

As you can see, I just want cartoclient to load the dropdown when it
starts up.

Problems I run in to:

- Setting the activation parameter for a plugin in cartoclient.php is
not documented
- A simple method in the client to parse the template to cartoclient.php
is not documented

Is there anybody that can help me with these simple steps?
    </pre>
  </blockquote>
  <pre wrap=""><!---->Hi,

First of all, I think you mean cartoclient.tpl instead of cartoclient.php ;)

A simple methode to parse the template could be something like : 
   /**
    * @see GuiProvider::renderForm()
    */
    public function renderForm(Smarty $template) {
        // authentification
        $editRoles = $this-&gt;getArrayFromIni('general.allowedRoles', true);
        $allowed = SecurityManager::getInstance()-&gt;hasRole($editRoles);
        $smarty = new Smarty_Plugin($this-&gt;getCartoclient(), $this);
        $smarty-&gt;assign(array('manager_allowed' =&gt; $allowed,
                        'layersManagerMessage' =&gt; $this-&gt;Message));
        $template-&gt;assign('layersManager', 
$smarty-&gt;fetch('layersManager.tpl'));
    }
/************************************
'layersManager' was the name of the plugin where I took this function.
'manager_allowed' and 'layersManagerMessage' are two variable you can send to 
the template file via smarty function  (assign function first define some 
variable you can use into the template file then it assign variable to the 
template file)

You will need this function :
    /**
     * Returns an array from a comma-separated list of a ini parameter.
     * @param string name of ini parameter
     * @param boolean (default: false) true: returns a simplified array
     * @return array
     */
    protected function getArrayFromIni($name, $simple = false) {
        $data = $this-&gt;getConfig()-&gt;$name;
        if (!$data) return array();

        return $this-&gt;getArrayFromList($data, $simple);
    }

Which allow you to get parameter from your myPlugin.ini file (don't seem you 
need it yet ;) 

Hope this will help you. You can drop an eye to the cw3 plugins to get some 
information. If you read the french, you can drop an eye as well to the 
cartoweb-community?net, documentation chapter, I begin to write something 
about developing a plugin ionto cw3.

Finally, I don't understand this :
  </pre>
  <blockquote type="cite">
    <pre wrap="">- Setting the activation parameter for a plugin in cartoclient.php is
not documented
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Regards,

Y.
  </pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<title>3DSite</title>
<meta http-equiv="Content-Type" content="text/html; ">
<style type="text/css">
<!--
body {
        background-color: #FFFFFF;
        margin-left: 5px;
        margin-top: 5px;
        margin-right: 5px;
        margin-bottom: 5px;
}
body,td,th {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 12px;
        color: #333333;
}
.style4 {font-size: 9px; }
.style5 {font-size: 9px; color: #CCCCCC; }
-->
</style>
<meta content="MSHTML 6.00.2900.2912" name="GENERATOR">
<br>
<table border="0" cellpadding="0" cellspacing="0" width="400">
  <tbody>
    <tr>
      <td rowspan="3" align="left" height="0" valign="bottom" width="15"><br>
      </td>
      <td colspan="2" align="left" height="78" valign="top" width="0">
      <p class="style4">Milo van der Linden
      <br>
      <a href="skype:milovanderlinden?add">skype: milovanderlinden</a><br>
      <a href="mailto:mlinden@zeelandnet.nl">mlinden@zeelandnet.nl</a><br>
      <a href="mailto:milovanderlinden@gmail.com">milovanderlinden@gmail.com</a><br>
      <a href="mailto:milo@3dsite.nl">milo@3dsite.nl</a><br>
      <a href="http://www.3dsite.nl">http://www.3dsite.nl</a><br>
      </p>
      </td>
      <td rowspan="3" align="left" height="0" valign="top" width="15">&nbsp;</td>
      <td valign="top" width="300">
      <p class="style5"><span lang="NL">De informatie in dit bericht
reflecteert mijn persoonlijke mening en niet die van een bedrijf of
instantie. Aan de informatie kunnen geen rechten worden ontleend.
Indien dit bericht onderdeel is van een forum, mailing-list of
community dan gelden automatisch de bij het betreffende medium
behorende voorwaarden.</span>
      <span lang="EN">The information in this message reflects my
personal opinion and not that of a company or public body. All rights
reserved.If this message is contained in a mailing-list or community,
the rights on the medium are automatically adapted.</span></p>
      </td>
    </tr>
  </tbody>
</table>
</div>
</body>
</html>