<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hello Oliver!<br>
<br>
Phew, Finally I got it working. Indeed the variable name did not match
(lowercase). Now the biggest challenge is tackled. I will go on with
adding functionality to my plugin.<br>
<br>
Many thanks! Also to Yves<br>
<br>
<br>
Oliver Christen schreef:
<blockquote cite="mid:011b01c7df09$c9da11c0$0e0a1b0a@maunakea"
type="cite">
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<meta content="MSHTML 6.00.5730.11" name="GENERATOR">
<div><font color="#000000" size="2">Hi</font></div>
<div> </div>
<div><font color="#000000" size="2">smarty variables are case
sensitive, the result will be different if you write projectselect
instead of projectSelect in your cartoclient.tpl</font></div>
<div> </div>
<div><font color="#000000" size="2">regards</font></div>
<div><font color="#000000" size="2">Oliver</font></div>
<blockquote dir="ltr"
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div
style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">-</div>
Oliver Christen schreef:
<blockquote cite="mid:00e501c7de86$70922b80$0e0a1b0a@maunakea"
type="cite">
<meta content="MSHTML 6.00.5730.11" name="GENERATOR">
<div><font color="#000000" size="2">unless the 4th dimension
really exist, the problem is elsewhere.</font></div>
<div><font color="#000000" size="2">Clear your cache and be sure
you work in development mode</font></div>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div
style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">-----
Original Message ----- </div>
<div
style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><b>From:</b>
<a title="mlinden@zeelandnet.nl"
href="mailto:mlinden@zeelandnet.nl" moz-do-not-send="true">Milo van
der Linden</a> </div>
<div
style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b>
<a title="yjacolin@free.fr" href="mailto:yjacolin@free.fr"
moz-do-not-send="true">Jacolin Yves</a> </div>
<div
style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Cc:</b>
<a title="cartoweb-users@lists.maptools.org"
href="mailto:cartoweb-users@lists.maptools.org" moz-do-not-send="true">cartoweb-users@lists.maptools.org</a>
</div>
<div
style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b>
Tuesday, August 14, 2007 5:15 PM</div>
<div
style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Subject:</b>
Re: [Cartoweb-users] MyFirst Plugin]</div>
<div><br>
</div>
I corrected that, but still no tekst shows up in my resultpage.<br>
<pre wrap=""><?php
class ClientProjectSelect extends ClientPlugin {
public function renderForm(Smarty $template) {
$foo='My foo text comes here';
</pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<br>
<blockquote cite="mid:011b01c7df09$c9da11c0$0e0a1b0a@maunakea"
type="cite">
<blockquote dir="ltr"
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<blockquote cite="mid:00e501c7de86$70922b80$0e0a1b0a@maunakea"
type="cite">
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<pre wrap=""> $template->assign('projectSelect',$foo);
}
}</pre>
<br>
<br>
<br>
Jacolin Yves schreef:
<blockquote cite="mid:200708141648.15784.yjacolin@free.fr"
type="cite">
<pre wrap="">Milo,
It seems that you did not defined your foo variable and you use it in your
function :
<?php
class ClientProjectSelect extends ClientPlugin {
public function renderForm(Smarty $template) {
$some_variable = 'foo';
$foo='I forget to define my variable';<-----------------------------
$template->assign('projectSelect',$foo);
}
}
?>
Regard,
Y.
Le Tuesday 14 August 2007 16:35:43 Milo van der Linden, vous avez écrit :
</pre>
<blockquote type="cite">
<pre wrap="">Hello list!
Thanks again for the many helping hands. I managed to get one step further.
Right now I have implemented the renderForm function as described below.
It doesn't generate errors anymore, but foo doesn't show..
when you visit <a class="moz-txt-link-freetext"
href="http://82.176.214.209/cartoweb/webGIS.php" moz-do-not-send="true">http://82.176.214.209/cartoweb/webGIS.php</a>; foo should be
displayed just beneath the Cartoclient Title. In the source of the page
it says
"<!--this is where foo should be -->"
and
"<!-- end of foo -->"
Between these two lines of comment, my cartoclient.tpl contains
{$projectSelect}
My plugin code is now:
<?php
class ClientProjectSelect extends ClientPlugin {
public function renderForm(Smarty $template) {
$some_variable = 'foo';
$template->assign('projectSelect',$foo);
}
}
?>
In my client.ini, cases are as described: projectSelect
Where else can I look to get "foo" displayed?
Oliver Christen schreef:
</pre>
<blockquote type="cite">
<pre wrap="">an error occured in your plugin, line 19, and something was outputed
very early in the operation flow, with the result nothing is displayed.
be sure you dont have a blank space at the beginning of your plugin code
first of all, you should user proper naming for plugin filename and
classname, respectively, "ClientProjectSelect.php" and "class
ClientProjectSelect .." (notice the uppercase P), it stay
"projectSelect" in the client.ini
to simply output something in the main template, you can do:
public function renderForm(Smarty $template) {
$some_variable = 'foo';
$template->assign('target_name_in_cartoclient_tpl', $some_variable);
}
and it should display 'foo' where you have
{$target_name_in_cartoclient_tpl} in the cartoclient.tpl
to load a template from your plugin templates folder, you need to do
as Yves said:
public function renderForm(Smarty $template) {
$smarty = new Smarty_Plugin($this->getCartoclient(), $this);
$foo = 'foo';
$bar = 'bar';
$smarty->assign(array('var1' => $foo, 'var2' => $bar)); // if you
have {$foo} and {$bar} in your plugin template
$plugin_template = $smarty->fetch('your_plugin_template.tpl');
$template->assign('target_name_in_cartoclient_tpl',
$plugin_template); // finally pass the whole plugin template to the
main cartoclient.tpl
}
try the simply example above
regards
Oliver
----- Original Message -----
*From:* Milo van der Linden <a class="moz-txt-link-rfc2396E"
href="mailto:mlinden@zeelandnet.nl" moz-do-not-send="true"><mailto:mlinden@zeelandnet.nl></a>
*To:* <a class="moz-txt-link-abbreviated"
href="mailto:cartoweb-users@lists.maptools.org" moz-do-not-send="true">cartoweb-users@lists.maptools.org</a>
<a class="moz-txt-link-rfc2396E"
href="mailto:cartoweb-users@lists.maptools.org" moz-do-not-send="true"><mailto:cartoweb-users@lists.maptools.org></a>
*Sent:* Monday, August 13, 2007 12:43 AM
*Subject:* Re: [Cartoweb-users] MyFirst Plugin]
Wow,
Thank you for the fast response on a sunday evening! Seems I am
not the only addict here ;-)
I indeed meant the cartoclient.tpl, correct.
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.
I have now changed my ClientprojectSelect.php (name of my plugin) to
<?php
class ClientprojectSelect extends ClientPlugin
{
protected function drawprojectSelect() {
$smarty = new Smarty_Plugin($this->getCartoclient(), $this);
return $smarty->fetch('projectSelect.tpl');
}
public function renderForm(Smarty $template) {
$projectSelect_active = $this->getConfig()->projectSelectActive;
$template->assign(array('prjectSelect_active' =>
$projectSelect_active));
if ($projectSelect_active)
$template->assign('projectSelect',
$this->drawprojectSelect());
}
}
?>
All I want it to do is display the content of the tpl, but now I
am getting headers not sent info..
Please see the error messages I am getting now:
<a class="moz-txt-link-freetext"
href="http://82.176.214.209/cartoweb/webGIS.php" moz-do-not-send="true">http://82.176.214.209/cartoweb/webGIS.php</a>
What am I doing wrong?
Yves Jacolin schreef:
</pre>
<blockquote type="cite">
<pre wrap=""> Le dimanche 12 août 2007 18:45, Milo van der Linden a écrit :
</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:
<myProject>/plugins/myplugin
<myProject>/plugins/myplugin/client
<myProject>/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:
<div id="mypluginSelect">
<SELECT NAME="myplugin_select">
<OPTION VALUE="">
<OPTION VALUE="1"> Project 1
<OPTION VALUE="2"> Project 2
<OPTION VALUE="3"> Project 3
</SELECT>
</div>
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->getArrayFromIni('general.allowedRoles',
true); $allowed = SecurityManager::getInstance()->hasRole($editRoles);
$smarty = new Smarty_Plugin($this->getCartoclient(), $this);
$smarty->assign(array('manager_allowed' => $allowed,
'layersManagerMessage' => $this->Message));
$template->assign('layersManager',
$smarty->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->getConfig()->$name;
if (!$data) return array();
return $this->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>
<pre wrap=""> --
Milo van der Linden
skype: milovanderlinden <a class="moz-txt-link-rfc2396E"
href="skype:milovanderlinden?add" moz-do-not-send="true"><skype:milovanderlinden?add></a>
<a class="moz-txt-link-abbreviated"
href="mailto:mlinden@zeelandnet.nl" moz-do-not-send="true">mlinden@zeelandnet.nl</a> <a
class="moz-txt-link-rfc2396E" href="mailto:mlinden@zeelandnet.nl"
moz-do-not-send="true"><mailto:mlinden@zeelandnet.nl></a>
<a class="moz-txt-link-abbreviated"
href="mailto:milovanderlinden@gmail.com" moz-do-not-send="true">milovanderlinden@gmail.com</a> <a
class="moz-txt-link-rfc2396E" href="mailto:milovanderlinden@gmail.com"
moz-do-not-send="true"><mailto:milovanderlinden@gmail.com></a>
<a class="moz-txt-link-abbreviated" href="mailto:milo@3dsite.nl"
moz-do-not-send="true">milo@3dsite.nl</a> <a
class="moz-txt-link-rfc2396E" href="mailto:milo@3dsite.nl"
moz-do-not-send="true"><mailto:milo@3dsite.nl></a>
<a class="moz-txt-link-freetext" href="http://www.3dsite.nl"
moz-do-not-send="true">http://www.3dsite.nl</a>
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. 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.
------------------------------------------------------------------------
_______________________________________________
Cartoweb-users mailing list
<a class="moz-txt-link-abbreviated"
href="mailto:Cartoweb-users@lists.maptools.org" moz-do-not-send="true">Cartoweb-users@lists.maptools.org</a>
<a class="moz-txt-link-freetext"
href="http://lists.maptools.org/mailman/listinfo/cartoweb-users"
moz-do-not-send="true">http://lists.maptools.org/mailman/listinfo/cartoweb-users</a>
</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
<style type="text/css">BODY {
        MARGIN: 5px; BACKGROUND-COLOR: #ffffff
}
BODY {
        FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial, Helvetica, sans-serif
}
TD {
        FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial, Helvetica, sans-serif
}
TH {
        FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial, Helvetica, sans-serif
}
.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"
moz-do-not-send="true">skype: milovanderlinden</a><br>
<a href="mailto:mlinden@zeelandnet.nl"
moz-do-not-send="true">mlinden@zeelandnet.nl</a><br>
<a href="mailto:milovanderlinden@gmail.com"
moz-do-not-send="true">milovanderlinden@gmail.com</a><br>
<a href="mailto:milo@3dsite.nl" moz-do-not-send="true">milo@3dsite.nl</a><br>
<a href="http://www.3dsite.nl" moz-do-not-send="true">http://www.3dsite.nl</a><br>
</p>
</td>
<td rowspan="3" align="left" height="0" valign="top"
width="15"> </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>
<hr> _______________________________________________<br>
Cartoweb-users mailing list<br>
<a moz-do-not-send="true" class="moz-txt-link-abbreviated"
href="mailto:Cartoweb-users@lists.maptools.org">Cartoweb-users@lists.maptools.org</a><br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://lists.maptools.org/mailman/listinfo/cartoweb-users">http://lists.maptools.org/mailman/listinfo/cartoweb-users</a><br>
</blockquote>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
<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 moz-do-not-send="true" href="skype:milovanderlinden?add">skype:
milovanderlinden</a><br>
<a moz-do-not-send="true" href="mailto:mlinden@zeelandnet.nl">mlinden@zeelandnet.nl</a><br>
<a moz-do-not-send="true"
href="mailto:milovanderlinden@gmail.com">milovanderlinden@gmail.com</a><br>
<a moz-do-not-send="true" href="mailto:milo@3dsite.nl">milo@3dsite.nl</a><br>
<a moz-do-not-send="true" href="http://www.3dsite.nl">http://www.3dsite.nl</a><br>
</p>
</td>
<td rowspan="3" align="left" height="0" valign="top"
width="15"> </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>
</blockquote>
</blockquote>
<br>
<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"> </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>