<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="/templates/default/atom.css" type="text/css" ?>

<feed 
   xmlns="http://www.w3.org/2005/Atom"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/">
    <link href="http://webconsults.eu/feeds/atom.xml" rel="self" title="Webconsults Europe Consulting in PHP  Databases AJAX SEO WEB 20 Webdevelopment" type="application/atom+xml" />
    <link href="http://webconsults.eu/"                        rel="alternate"    title="Webconsults Europe Consulting in PHP  Databases AJAX SEO WEB 20 Webdevelopment" type="text/html" />
    <link href="http://webconsults.eu/rss.php?version=2.0"     rel="alternate"    title="Webconsults Europe Consulting in PHP  Databases AJAX SEO WEB 20 Webdevelopment" type="application/rss+xml" />
    <title type="html">Webconsults Europe Consulting in PHP  Databases AJAX SEO WEB 20 Webdevelopment</title>
    <subtitle type="html">PHP AJAX OOP SEO Training MySQL WEB 2 0 JSON Security OOP</subtitle>
    <icon>http://webconsults.eu/templates/default/img/s9y_banner_small.png</icon>
    <id>http://webconsults.eu/</id>
    <updated>2010-02-08T13:50:38Z</updated>
    <generator uri="http://www.s9y.org/" version="1.5.1">Serendipity 1.5.1 - http://www.s9y.org/</generator>
    <dc:language>en</dc:language>

    <entry>
        <link href="http://webconsults.eu/archives/61-Remove-Duplicated-Entries-from-MySQL-Table.html" rel="alternate" title="Remove Duplicated Entries from MySQL Table" />
        <author>
            <name>John Behrens</name>
                    </author>
    
        <published>2010-02-08T13:13:38Z</published>
        <updated>2010-02-08T13:50:38Z</updated>
        <wfw:comment>http://webconsults.eu/wfwcomment.php?cid=61</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://webconsults.eu/rss.php?version=atom1.0&amp;type=comments&amp;cid=61</wfw:commentRss>
    
            <category scheme="http://webconsults.eu/categories/6-Database" label="Database" term="Database" />
    
        <id>http://webconsults.eu/archives/61-guid.html</id>
        <title type="html">Remove Duplicated Entries from MySQL Table</title>
        <content type="xhtml" xml:base="http://webconsults.eu/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                This is a short tutorial how to remove duplicated entries from MySQL DB Table

First idea was just to do a simple DELETE statement on a SubSelect 
<div class="sql" style="text-align: left"><br /><span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">FROM</span> user <span style="color: #993333; font-weight: bold;">WHERE</span> id <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> u2.id <br /><span style="color: #993333; font-weight: bold;">FROM</span> user <span style="color: #993333; font-weight: bold;">AS</span> u1<br /><span style="color: #993333; font-weight: bold;">JOIN</span> user <span style="color: #993333; font-weight: bold;">AS</span> u2 <span style="color: #993333; font-weight: bold;">ON</span> u1.name=u2.name<br /><span style="color: #993333; font-weight: bold;">WHERE</span>&#160; u1.id &lt; u2.id<span style="color: #66cc66;">&#41;</span><br />&#160;</div>
Unfortunatelly this gives back an error message.
<em>#1093 - You can't specify target table 'ex_user' for update in FROM clause </em>
MySQL Documentation says about that
<blockquote>
Error 1093 (ER_UPDATE_TABLE_USED)
SQLSTATE = HY000
Message = "You can't specify target table 'x'
for update in FROM clause"

This error occurs in cases such as the following:

UPDATE t1 SET column2 = (SELECT MAX(column1) FROM t1);

You can use a subquery for assignment within an UPDATE statement because subqueries are legal in UPDATE and DELETE statements as well as in SELECT statements. However, you cannot use the same table (in this case, table t1) for both the subquery's FROM clause and the update target. 
</blockquote>
I was searching for a solution without using temporary table but didn´t find one yet. 

<div class="sql" style="text-align: left"><br /><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TEMPORARY</span> <span style="color: #993333; font-weight: bold;">TABLE</span> duplicated_temp<span style="color: #66cc66;">&#40;</span>id INT<span style="color: #66cc66;">&#41;</span> TYPE=HEAP;<br /><br /><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> duplicated_temp <span style="color: #993333; font-weight: bold;">SELECT</span> u2.id&#160; <span style="color: #993333; font-weight: bold;">FROM</span> ex_user <span style="color: #993333; font-weight: bold;">AS</span> u1 <span style="color: #993333; font-weight: bold;">JOIN</span> user <span style="color: #993333; font-weight: bold;">AS</span> u2 <span style="color: #993333; font-weight: bold;">ON</span> u1.name=u2.name <span style="color: #993333; font-weight: bold;">WHERE</span> u1.id &lt; u2.id;<br /><br /><span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">FROM</span> user <span style="color: #993333; font-weight: bold;">WHERE</span> id <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> id <span style="color: #993333; font-weight: bold;">FROM</span> duplicated_temp <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;<br /><br /><span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">TABLE</span> duplicated_temp;<br />&#160;</div>
Well thats it. 
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://webconsults.eu/archives/60-Dynamic-Model-for-Zend-Framework.html" rel="alternate" title="Dynamic Model for Zend Framework" />
        <author>
            <name>John Behrens</name>
                    </author>
    
        <published>2010-02-07T23:27:19Z</published>
        <updated>2010-02-07T23:49:21Z</updated>
        <wfw:comment>http://webconsults.eu/wfwcomment.php?cid=60</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://webconsults.eu/rss.php?version=atom1.0&amp;type=comments&amp;cid=60</wfw:commentRss>
    
            <category scheme="http://webconsults.eu/categories/3-PHP" label="PHP" term="PHP" />
    
        <id>http://webconsults.eu/archives/60-guid.html</id>
        <title type="html">Dynamic Model for Zend Framework</title>
        <content type="xhtml" xml:base="http://webconsults.eu/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                I always liked some kind of auto generated model to access a database. 
I liked it the way Symfony does or the Zend Framework Tool.
But anytime using a generator is also a bit of mess.
The actual Zend Framework quickstart example has a 3 files way of implementing a Model, a Model Class, Model Mapper Class and Model DB Table ClassFew,
so for one DB Table you always have to create 3 classes which look almost similar, most times you just copy and paste those, and change a few things.

So i decided to create an very flexible model class, where you just need to define the properties and nothing more getter and sette methods will be called by magic functions. Even it has export function to an array.

You don´t have to create anything but you can create your own functions for getter and setter methods which would override the default ones.
In later state it could be possible to add a filter configurable in the model, but for first step i would like to keep it as slim as possible.


<div class="php" style="text-align: left"><br /><span style="color: #000000; font-weight: bold;">class</span> Dynmodel_Model<br /><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; protected <span style="color: #0000ff;">$_id</span>;<br />&#160; &#160; protected <span style="color: #0000ff;">$_created</span>;<br /><br />&#160; &#160; public <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/array"><span style="color: #000066;">array</span></a> <span style="color: #0000ff;">$options</span> = <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><br />&#160; &#160; <span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/is_array"><span style="color: #000066;">is_array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$options</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">setOptions</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$options</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; <span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">// Magic Call function</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">// @param &lt;type&gt; $name</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">// @param &lt;type&gt; $arguments</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">//@return &lt;type&gt; </span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160; public <span style="color: #000000; font-weight: bold;">function</span> __call<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$name</span>, <span style="color: #0000ff;">$arguments</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br /><br />&#160; &#160; &#160; &#160; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$name</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span>==<span style="color: #ff0000;">"set"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$this</span>-&gt;__set<span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$name</span>,<span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span>,<span style="color: #0000ff;">$arguments</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; &#160; &#160; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$name</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span>==<span style="color: #ff0000;">"get"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #b1b100;">return</span>&#160; <span style="color: #0000ff;">$this</span>-&gt;__get<span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$name</span>,<span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; &#160; &#160; throw <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Method '</span>.<span style="color: #0000ff;">$name</span>.<span style="color: #ff0000;">' not Supported'</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">// Magic Setter Class</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">// @param &lt;type&gt; $name</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">// @param &lt;type&gt; $value </span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160; public <span style="color: #000000; font-weight: bold;">function</span> __set<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$name</span>, <span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#41;</span><br />&#160; &#160; <span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$method</span> = <span style="color: #ff0000;">'set'</span> . <span style="color: #0000ff;">$name</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$propertyName</span>=<span style="color: #ff0000;">"_"</span>.lcfirst<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$name</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/method_exists"><span style="color: #000066;">method_exists</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>, <span style="color: #0000ff;">$method</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <a href="http://www.php.net/method_exists"><span style="color: #000066;">method_exists</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>, <span style="color: #0000ff;">$method</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">elseif</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'mapper'</span> == <span style="color: #0000ff;">$name</span><span style="color: #66cc66;">&#41;</span> || !property_exists<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>, <span style="color: #0000ff;">$propertyName</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; throw <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Invalid Property '</span>.<span style="color: #0000ff;">$propertyName</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">elseif</span><span style="color: #66cc66;">&#40;</span>property_exists<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>, <span style="color: #0000ff;">$propertyName</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #0000ff;">$propertyName</span>=<span style="color: #0000ff;">$value</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; &#160; &#160; <br />&#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; <span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160; <span style="color: #808080; font-style: italic;">// Magic getter class</span><br />&#160; &#160; <span style="color: #808080; font-style: italic;">// @param &lt;type&gt; $name</span><br />&#160; &#160; <span style="color: #808080; font-style: italic;">// @return &lt;type&gt; </span><br />&#160; &#160; <span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160; public <span style="color: #000000; font-weight: bold;">function</span> __get<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$name</span><span style="color: #66cc66;">&#41;</span><br />&#160; &#160; <span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$method</span> = <span style="color: #ff0000;">'get'</span> . <span style="color: #0000ff;">$name</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$propertyName</span>=<span style="color: #ff0000;">"_"</span>.lcfirst<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$name</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/method_exists"><span style="color: #000066;">method_exists</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>, <span style="color: #0000ff;">$method</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #0000ff;">$method</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">elseif</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'mapper'</span> == <span style="color: #0000ff;">$name</span><span style="color: #66cc66;">&#41;</span> || !property_exists<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>, <span style="color: #0000ff;">$propertyName</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; throw <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Invalid Property '</span>.<span style="color: #0000ff;">$propertyName</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">return</span>&#160; <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #0000ff;">$propertyName</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; &#160; &#160;<br />&#160; &#160; <span style="color: #66cc66;">&#125;</span><br /><br />&#160; &#160; public <span style="color: #000000; font-weight: bold;">function</span> setOptions<span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/array"><span style="color: #000066;">array</span></a> <span style="color: #0000ff;">$options</span><span style="color: #66cc66;">&#41;</span><br />&#160; &#160; <span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$methods</span> = <a href="http://www.php.net/get_class_methods"><span style="color: #000066;">get_class_methods</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$options</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$key</span> =&gt; <span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$method</span> = <span style="color: #ff0000;">'set'</span> . <a href="http://www.php.net/ucfirst"><span style="color: #000066;">ucfirst</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$key</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/in_array"><span style="color: #000066;">in_array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$method</span>, <span style="color: #0000ff;">$methods</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #0000ff;">$method</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; &#160; &#160; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$this</span>;<br />&#160; &#160; <span style="color: #66cc66;">&#125;</span><br /><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">// Returning the Objects as Array</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">// @return Array</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160; public <span style="color: #000000; font-weight: bold;">function</span> toArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$values</span>=<a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/get_object_vars"><span style="color: #000066;">get_object_vars</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$pkey</span> =&gt; <span style="color: #0000ff;">$pvalue</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pkey</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>==<span style="color: #ff0000;">"_"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$arrkey</span>=<a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pkey</span>,<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$call</span>=<span style="color: #ff0000;">"get"</span>.<a href="http://www.php.net/ucfirst"><span style="color: #000066;">ucfirst</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$arrkey</span>,<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #808080; font-style: italic;">//calling value through objects get function</span><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$values</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$arrkey</span><span style="color: #66cc66;">&#93;</span>=<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #0000ff;">$call</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; &#160; &#160; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$values</span>;<br />&#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160;<br /><span style="color: #66cc66;">&#125;</span><br /><br />&#160;</div>
The Danymic DBTable and DynamicMapper class are not tested yet, will post theme here later.
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://webconsults.eu/archives/58-Zend-Framework-PHP-based-SOAP-Server-with-Java-JAX-RPC-client.html" rel="alternate" title="Zend Framework PHP based SOAP Server with Java JAX-RPC client" />
        <author>
            <name>John Behrens</name>
                    </author>
    
        <published>2010-01-21T12:22:27Z</published>
        <updated>2010-01-21T13:31:57Z</updated>
        <wfw:comment>http://webconsults.eu/wfwcomment.php?cid=58</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://webconsults.eu/rss.php?version=atom1.0&amp;type=comments&amp;cid=58</wfw:commentRss>
    
            <category scheme="http://webconsults.eu/categories/3-PHP" label="PHP" term="PHP" />
    
        <id>http://webconsults.eu/archives/58-guid.html</id>
        <title type="html">Zend Framework PHP based SOAP Server with Java JAX-RPC client</title>
        <content type="xhtml" xml:base="http://webconsults.eu/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                This example shows how to create an Zend Framework based SOAP Server and connect to it by a Java Client. The process itself is really easy but some things ara a  bit tricky for example at the status were i created it there were some problems if using WS style for the SOAP Server so i decided to use RPC style. The Server basically allows a user to logon by credentials and gives back a userstatus, the Java Client is connecting through this service and requesting the userstatus. 


<strong>The Soap Server Class</strong>
<div class="php" style="text-align: left"><br /><span style="color: #000000; font-weight: bold;">&lt;?php</span><br /><span style="color: #808080; font-style: italic;">// orginal code has phpdoc compatible comments with slash star</span><br /><br />&#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160;<span style="color: #808080; font-style: italic;">// SoapUserServer Class</span><br />&#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160;<span style="color: #808080; font-style: italic;">// @author</span><br />&#160;<span style="color: #808080; font-style: italic;">//</span><br /><br />&#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160;<span style="color: #808080; font-style: italic;">// Description of SoapUserServer</span><br />&#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160;<span style="color: #808080; font-style: italic;">// @author johny</span><br />&#160;<span style="color: #808080; font-style: italic;">//</span><br /><span style="color: #000000; font-weight: bold;">class</span> Example_SoapUserServer <span style="color: #66cc66;">&#123;</span><br /><br />&#160; &#160; <span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">// Returns Api Version</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">// @return string getApiVersion</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160; public <span style="color: #000000; font-weight: bold;">function</span> getApiVersion<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />&#160; &#160; <span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$apiVersion</span>=<span style="color: #ff0000;">"0.9.3"</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$apiVersion</span>;<br />&#160; &#160; <span style="color: #66cc66;">&#125;</span><br /><br />&#160; &#160; <span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">// getUser</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">// Returns user Status for a given Username, Password combination</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">// @param string $username</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">// @param string $password</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">// @return string getUserResponse</span><br />&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160; public <span style="color: #000000; font-weight: bold;">function</span> getUser<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$username</span>, <span style="color: #0000ff;">$password</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br /><br />&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$adapter</span> = <span style="color: #000000; font-weight: bold;">new</span> Example_AuthAdapter<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$username</span>,<span style="color: #0000ff;">$password</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$userStatus</span>=<span style="color: #000000; font-weight: bold;">false</span>;<br /><br />&#160; &#160; &#160; &#160; <span style="color: #808080; font-style: italic;">//retrive login</span><br />&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$auth</span>&#160; &#160; = Zend_Auth::<span style="color: #006600;">getInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$auth</span>-&gt;<span style="color: #006600;">authenticate</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$adapter</span><span style="color: #66cc66;">&#41;</span>;<br /><br />&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$acl</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_Acl<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$auth</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!<span style="color: #0000ff;">$auth</span>-&gt;<span style="color: #006600;">hasIdentity</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #808080; font-style: italic;">//user not valid</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$userStatus</span>=<span style="color: #000000; font-weight: bold;">false</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #808080; font-style: italic;">//user okay</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #808080; font-style: italic;">//@todo dynamic membership types</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$membership</span>=<span style="color: #0000ff;">$auth</span>-&gt;<span style="color: #006600;">getIdentity</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>-&gt;<span style="color: #006600;">getMembership</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$membership</span> &amp;&amp;amp; <span style="color: #0000ff;">$membership</span>-&gt;<span style="color: #006600;">getMembershipTypeId</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>&gt;=<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$userStatus</span>=<span style="color: #ff0000;">"premiummember"</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$userStatus</span>=<span style="color: #ff0000;">"normalmember"</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #66cc66;">&#125;</span><br />&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; &#160; &#160; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$userStatus</span>!=<span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$userStatus</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">return</span> <span style="color: #ff0000;">"wrong credentials"</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; <span style="color: #66cc66;">&#125;</span><br /><br /><span style="color: #66cc66;">&#125;</span><br /><span style="color: #000000; font-weight: bold;">?&gt;</span><br />&#160;</div>

<strong>Zend Controller for the Soap Server</strong>

<div class="php" style="text-align: left"><br /><span style="color: #000000; font-weight: bold;">&lt;?php</span><br /><span style="color: #000000; font-weight: bold;">class</span> SoapController extends Zend_Controller_Action<br /><span style="color: #66cc66;">&#123;</span><br /><br />&#160; &#160; <span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160; <span style="color: #808080; font-style: italic;">// Zend Soap Server Action</span><br />&#160; &#160; <span style="color: #808080; font-style: italic;">// Representing the soap Server</span><br />&#160; &#160; <span style="color: #808080; font-style: italic;">///</span><br />&#160; &#160; public <span style="color: #000000; font-weight: bold;">function</span> serverAction<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #000066;">isset</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'wsdl'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$autodiscover</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_Soap_AutoDiscover<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$autodiscover</span>-&gt;<span style="color: #006600;">setBindingStyle</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'style'</span> =&gt; <span style="color: #ff0000;">'rpc'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$autodiscover</span>-&gt;<span style="color: #006600;">setClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Example_SoapUserServer'</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$autodiscover</span>-&gt;<span style="color: #006600;">handle</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; <a href="http://www.php.net/exit"><span style="color: #000066;">exit</span></a>;<br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #808080; font-style: italic;">// disabling WSDL cache cause we are still in Development</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <a href="http://www.php.net/ini_set"><span style="color: #000066;">ini_set</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"soap.wsdl_cache_enabled"</span>, <span style="color: #ff0000;">"0"</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$server</span> = <span style="color: #000000; font-weight: bold;">new</span> SoapServer<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'http://example.com/soap/server?wsdl'</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$server</span>-&gt;<span style="color: #006600;">setClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Example_SoapUserServer'</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$server</span>-&gt;<span style="color: #006600;">handle</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br /><br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$this</span>-&gt;_helper-&gt;<span style="color: #006600;">viewRenderer</span>-&gt;<span style="color: #006600;">setNoRender</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$this</span>-&gt;_helper-&gt;<span style="color: #006600;">layout</span>-&gt;<span style="color: #006600;">disableLayout</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; <span style="color: #66cc66;">&#125;</span><br /><br /><span style="color: #66cc66;">&#125;</span><br /><br /><span style="color: #000000; font-weight: bold;">?&gt;</span><br />&#160;</div>


Java Client Code

With Netbeans a webservice client is really easy to create, right click on the project create new "Web Service Client"
More Information:
<a href="http://netbeans.org/kb/docs/websvc/jax-ws.html">http://netbeans.org/kb/docs/websvc/jax-ws.html</a>
JAX RPC Style works better with Zend Framework and PHP.
The Stub and Port classes will be Auto generated by Netbeans, so you don´t need to worry about that.

<div class="java" style="text-align: left"><br />package eu.<span style="color: #006600;">webconsults</span>.<span style="color: #006600;">myapp</span>.<span style="color: #006600;">userauth</span>;<br /><br /><span style="color: #a1a100;">import java.rmi.RemoteException;</span><br /><span style="color: #a1a100;">import myapp.userauth.Example_SoapUserServerPort_Stub;</span><br /><span style="color: #a1a100;">import myapp.userauth.Example_SoapUserServerService_Impl;</span><br /><br /><span style="color: #808080; font-style: italic;">//</span><br /><span style="color: #808080; font-style: italic;">// User Authorization class using Soap Server</span><br /><span style="color: #808080; font-style: italic;">// @author johny</span><br /><span style="color: #808080; font-style: italic;">//</span><br /><br /><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> UserAuth <span style="color: #66cc66;">&#123;</span><br />&#160; &#160; <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> username = <span style="color: #000000; font-weight: bold;">null</span>;<br />&#160; &#160; <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> password = <span style="color: #000000; font-weight: bold;">null</span>;<br />&#160; &#160; <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> usertype = <span style="color: #000000; font-weight: bold;">null</span>;<br />&#160; &#160; <a href="http://www.google.com/search?q=allinurl%3ABoolean+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Boolean</span></a> isAuthorized = <span style="color: #000000; font-weight: bold;">false</span>;<br />&#160; &#160; Example_SoapUserServerPort_Stub stub;<br /><br />&#160; &#160; <span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160; <span style="color: #808080; font-style: italic;">// Authenticating remote</span><br />&#160; &#160; <span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160; <span style="color: #808080; font-style: italic;">// @param username</span><br />&#160; &#160; <span style="color: #808080; font-style: italic;">// @param password</span><br />&#160; &#160; <span style="color: #808080; font-style: italic;">///</span><br />&#160; &#160;<span style="color: #000000; font-weight: bold;">public</span> UserAuth<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> username, <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> password<span style="color: #66cc66;">&#41;</span><br />&#160; &#160;<span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160;<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">username</span> = username;<br />&#160; &#160; &#160; &#160;<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">password</span>=password;<br />&#160; &#160; &#160; &#160;<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">retrieveRemoteUserStatus</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br /><br />&#160; &#160;<span style="color: #66cc66;">&#125;</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">// Retriving remote User Status from Stub</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//&#160; @return</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">///</span><br />&#160; &#160;<span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> retrieveRemoteUserStatus<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">try</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">usertype</span> = <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">getStub</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getUser</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">username</span>, <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">password</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>!<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">usertype</span>.<span style="color: #006600;">equals</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"wrong credentials"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">isAuthorized</span>=<span style="color: #000000; font-weight: bold;">true</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">isAuthorized</span>=<span style="color: #000000; font-weight: bold;">false</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span><span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3ARemoteException+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">RemoteException</span></a> re<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160;<a href="http://www.google.com/search?q=allinurl%3ASystem+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Remote Exception"</span>+re.<span style="color: #006600;">getMessage</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160;<span style="color: #66cc66;">&#125;</span><br />&#160; &#160; &#160; &#160;<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">usertype</span>;<br />&#160; &#160;<span style="color: #66cc66;">&#125;</span><br /><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">// @return</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160;<span style="color: #000000; font-weight: bold;">private</span> Example_SoapUserServerPort_Stub getStub<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160;<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">stub</span> == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160;<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">stub</span>=<span style="color: #66cc66;">&#40;</span>Example_SoapUserServerPort_Stub<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Example_SoapUserServerService_Impl<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getExample_SoapUserServerPort</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160;<span style="color: #66cc66;">&#125;</span><br />&#160; &#160; &#160; &#160;<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">stub</span>;<br />&#160; &#160;<span style="color: #66cc66;">&#125;</span><br /><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">// Getting Username</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">// @return</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160;<span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> getUsername<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160;<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">username</span>;<br />&#160; &#160;<span style="color: #66cc66;">&#125;</span><br /><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">// Getting Password</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">// @return</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160;<span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> getPassword<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160;<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">password</span>;<br />&#160; &#160;<span style="color: #66cc66;">&#125;</span><br /><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">// Returning Usertype</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">// @return</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160;<span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> getUsertype<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160;<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">usertype</span>;<br />&#160; &#160;<span style="color: #66cc66;">&#125;</span><br /><span style="color: #66cc66;">&#125;</span><br />&#160;</div> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://webconsults.eu/archives/57-Osapi-Session-Storage.html" rel="alternate" title="Osapi Session Storage" />
        <author>
            <name>John Behrens</name>
                    </author>
    
        <published>2009-12-29T00:23:46Z</published>
        <updated>2010-01-12T15:23:51Z</updated>
        <wfw:comment>http://webconsults.eu/wfwcomment.php?cid=57</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://webconsults.eu/rss.php?version=atom1.0&amp;type=comments&amp;cid=57</wfw:commentRss>
    
    
        <id>http://webconsults.eu/archives/57-guid.html</id>
        <title type="html">Osapi Session Storage</title>
        <content type="xhtml" xml:base="http://webconsults.eu/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Using the OSAPI Open Social API, i noticed there is no session storage available by default,
so this is a very quick way to implement a PHP-Session Bages Storage
<div class="php" style="text-align: left"><br /><br />&#160;<span style="color: #808080; font-style: italic;">// Session Storage implements Openid Storage Inside PHP Session,</span><br />&#160;<span style="color: #808080; font-style: italic;">//for me the easiest way to handle openId data</span><br />&#160;<span style="color: #808080; font-style: italic;">//</span><br /><br /><br />&#160;<span style="color: #808080; font-style: italic;">// Description of osapiSessionStorage</span><br />&#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160;<span style="color: #808080; font-style: italic;">//@author John Behrens (john.behrens@webconsults.eu)</span><br />&#160;<span style="color: #808080; font-style: italic;">//</span><br /><span style="color: #000000; font-weight: bold;">class</span> osapiSessionStorage extends osapiStorage<span style="color: #66cc66;">&#123;</span><br /><br />&#160; <span style="color: #808080; font-style: italic;">//</span><br />&#160; <span style="color: #808080; font-style: italic;">// Retrieves the data for the given key, or false if they</span><br />&#160; <span style="color: #808080; font-style: italic;">// key is unknown or expired</span><br />&#160; <span style="color: #808080; font-style: italic;">//</span><br />&#160; <span style="color: #808080; font-style: italic;">// @param String $key The key who's data to retrieve</span><br />&#160; <span style="color: #808080; font-style: italic;">// @param int $expiration Experiration time in seconds</span><br />&#160; <span style="color: #808080; font-style: italic;">//</span><br />&#160; public <span style="color: #000000; font-weight: bold;">function</span> get<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$key</span>, <span style="color: #0000ff;">$expiration</span> = <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>!<a href="http://www.php.net/isset"><span style="color: #000066;">isset</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_SESSION</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'osapi'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;<br />&#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; &#160; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #000066;">isset</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_SESSION</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'osapi'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$key</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$_SESSION</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'osapi'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$key</span><span style="color: #66cc66;">&#93;</span>;<br />&#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;<br />&#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; <span style="color: #66cc66;">&#125;</span><br /><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//Store the key =&gt; $value set. The $value is serialized</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">// by this function so can be of any type</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//@param String $key Key of the data</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">// @param Any-type $value the data</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; public <span style="color: #000000; font-weight: bold;">function</span> set<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$key</span>, <span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; <span style="color: #0000ff;">$_SESSION</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'osapi'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$key</span><span style="color: #66cc66;">&#93;</span>=<span style="color: #0000ff;">$value</span>;<br />&#160; <span style="color: #66cc66;">&#125;</span><br /><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">// Removes the key/data pair for the given $key</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">// @param String $key</span><br />&#160; &#160;<span style="color: #808080; font-style: italic;">//</span><br />&#160; public <span style="color: #000000; font-weight: bold;">function</span> delete<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$key</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; <a href="http://www.php.net/unset"><span style="color: #000066;">unset</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_SESSION</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'osapi'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$key</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; <br /><span style="color: #66cc66;">&#125;</span><br /><br /><span style="color: #000000; font-weight: bold;">?&gt;</span><br />&#160;</div>
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://webconsults.eu/archives/56-One-more-reason-why-Symfony-cks.html" rel="alternate" title="One more reason why Symfony **cks" />
        <author>
            <name>John Behrens</name>
                    </author>
    
        <published>2009-10-22T14:43:41Z</published>
        <updated>2009-10-26T12:35:46Z</updated>
        <wfw:comment>http://webconsults.eu/wfwcomment.php?cid=56</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://webconsults.eu/rss.php?version=atom1.0&amp;type=comments&amp;cid=56</wfw:commentRss>
    
    
        <id>http://webconsults.eu/archives/56-guid.html</id>
        <title type="html">One more reason why Symfony **cks</title>
        <content type="xhtml" xml:base="http://webconsults.eu/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                I was working with <div class="php" style="text-align: left">form_remote_tag<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div> which is a usefull function if you create forms using AJAX request.
Simple usage is easy
<div class="php" style="text-align: left"><br /><span style="color: #000000; font-weight: bold;">&lt;?php</span> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> form_remote_tag<span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><br />&#160; &#160; <span style="color: #ff0000;">'update'</span>&#160; &#160;=&gt; <span style="color: #ff0000;">'item_list'</span>,<br />&#160; &#160; <span style="color: #ff0000;">'url'</span>&#160; &#160; &#160; =&gt; <span style="color: #ff0000;">'item/add'</span>,<br /><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />&#160;</div> 
Executes the URL Item Add and replaces content of the Element with item_list with it´s result.
Well what i would like to now is a Form which is permanent viewable and will reset itself if sended.

What i guessed 
<div class="php" style="text-align: left"><br /><span style="color: #000000; font-weight: bold;">&lt;?php</span> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> form_remote_tag<span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><br />&#160; &#160; &#160; &#160; <span style="color: #ff0000;">'update'</span>&#160; &#160;=&gt; <span style="color: #ff0000;">'list'</span>,<br />&#160; &#160; &#160; &#160; <span style="color: #ff0000;">'url'</span>&#160; &#160; &#160; =&gt; <span style="color: #ff0000;">'entrys/create'</span>,<br />&#160; &#160; &#160; &#160; <span style="color: #ff0000;">'complete'</span> =&gt; <span style="color: #ff0000;">"Form.reset('myForm')"</span>,<br />&#160; &#160; &#160; &#160; <span style="color: #ff0000;">'id'</span>=&gt;<span style="color: #ff0000;">'myForm'</span><br />&#160; &#160; <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span><br />&#160;</div>
Well who that doesn´t work,
form_remote_tag doesnt know an property called id, you have to hang it behind as html code
<div class="php" style="text-align: left"><br /><span style="color: #000000; font-weight: bold;">&lt;?php</span> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> form_remote_tag<span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><br />&#160; &#160; &#160; &#160; <span style="color: #ff0000;">'update'</span>&#160; &#160;=&gt; <span style="color: #ff0000;">'list'</span>,<br />&#160; &#160; &#160; &#160; <span style="color: #ff0000;">'url'</span>&#160; &#160; &#160; =&gt; <span style="color: #ff0000;">'rntrys/create'</span>,<br />&#160; &#160; &#160; &#160; <span style="color: #ff0000;">'complete'</span> =&gt; <span style="color: #ff0000;">"Form.reset('myForm')"</span><br />&#160; &#160; <span style="color: #66cc66;">&#41;</span>,<span style="color: #ff0000;">"id='myForm' "</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span><br />&#160;</div>
This way it works, too bad the documentation on it is that poor. But <a href="http://www.mellowmorning.com/2007/08/18/ten-reasons-why-symfony-rocks-part-1/">10 Reasons why Symfony **cks</a> helped me out finding the right solution.
However i still think updating a whole element with the list is the wrong way, i would like to use JSON and DOM Manipulation for that, to add exact one entry to the list, i gonna work that out now. 


 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://webconsults.eu/archives/53-Tooltip-Div-with-Jquery.html" rel="alternate" title="Tooltip Div with Jquery" />
        <author>
            <name>John Behrens</name>
                    </author>
    
        <published>2009-10-12T14:46:03Z</published>
        <updated>2009-10-13T22:58:50Z</updated>
        <wfw:comment>http://webconsults.eu/wfwcomment.php?cid=53</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://webconsults.eu/rss.php?version=atom1.0&amp;type=comments&amp;cid=53</wfw:commentRss>
    
    
        <id>http://webconsults.eu/archives/53-guid.html</id>
        <title type="html">Tooltip Div with Jquery</title>
        <content type="xhtml" xml:base="http://webconsults.eu/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Searching the web i found a lot of solutions and <a href="http://www.tagdocs.de/2009/07/17/3-jquery-plugins-von-mopstudio-lightbox-slider-und-tooltip/">ToolTip Plugins</a> wie z.b. <a href="http://webdemar.com/webdesign/tooltips-mit-simpletip-jquery-plugin/">Simpletip</a> oder<a href="http://blog.beatsundbytes.de/really-simple-tooltips-jquery-plugin"> really simple tooltop</a>, but after i had a short look at some i decided that they are all more or less usefull.
The most usuable entry i found was a short entry at <a href="http://stackoverflow.com/questions/158070/jquery-how-to-position-one-element-relative-to-another">Stackoverflow</a> telling me anything i need to know.

My basic requirement was, Javascript code has to be Seperated from the design and the Webpage content.
So my php template looks like this
<div class="php" style="text-align: left"><br /><span style="color: #000000; font-weight: bold;">&lt;?</span> <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$entrys</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$entry</span><span style="color: #66cc66;">&#41;</span>: <span style="color: #000000; font-weight: bold;">?&gt;</span><br />&lt;div id=<span style="color: #ff0000;">"entrylink_&lt;?=$entry-&gt;id?&gt;"</span>&gt;<br />&lt;a href=<span style="color: #ff0000;">"&amp;lt;?=$entry-&amp;gt;link?&amp;gt;"</span> onMouseOver=<span style="color: #ff0000;">"showEntryPreview('&lt;?=$entry-&gt;id?&gt;')"</span>&#160; onMouseOut=<span style="color: #ff0000;">"hideEntryPreview('&lt;?=$entry-&gt;id?&gt;')"</span>&gt;&lt;?=<span style="color: #0000ff;">$entry</span>-&gt;<span style="color: #006600;">name</span>?&gt;&lt;/a&gt;<br />&lt;/div&gt;<br />&lt;div id=<span style="color: #ff0000;">"entryinfo_&lt;?=$entry-&gt;id?&gt;"</span> <span style="color: #000000; font-weight: bold;">class</span>=<span style="color: #ff0000;">"entry_preview"</span>&gt;<br />... some more information ....<br />&lt;/div&gt;<br /><br />&lt;?enforeach;?&gt;<br />&#160;</div>
So this was set cause whoever willing to change the content or layer of the tool-tip or preview div, however you like to call it, should be able to change it without touching the JS functionallity. 
So what i need to added now was CSS definition to hide tool-tip layer.
<div class="css" style="text-align: left"><br />.entry_preview<span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">position</span>:<span style="color: #993333;">absolute</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">z-index</span>:<span style="color: #cc66cc;">999</span>;<br />&#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">left</span>:-9999px;<br />&#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">background-color</span>:#FF0000;<br />&#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">padding</span>:5px;<br />&#160; &#160; &#160; &#160; border<span style="color: #3333ff;">:1px </span>solid #fff;<br />&#160; &#160; &#160; &#160; <span style="color: #000000; font-weight: bold;">width</span>:250px;<br />&#160;</div>
So anybody could change layout later.
Now everything is needed is not an<a href="http://guidesigner.net/ajax/best-collection-of-useful-jquery-tooltip-plugins-and-tutorials/"> extra plugin</a> or <a href="http://guidesigner.net/ajax/best-collection-of-useful-jquery-tooltip-plugins-and-tutorials/">collection of plugins</a> it´s just a few lines of JS code using <a href="http://webstandard.kulando.de/post/2008/09/12/best-of-jquery-tutorials">jquery</a>

<div class="javascript" style="text-align: left"><br /><span style="color: #003366; font-weight: bold;">function</span> showUserInfo<span style="color: #66cc66;">&#40;</span>entryId<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; <span style="color: #003366; font-weight: bold;">var</span> divOverlay=$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#entrylink_'</span>+entryId<span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; <span style="color: #003366; font-weight: bold;">var</span> divParent=$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#entryinfo_'</span>+entryId<span style="color: #66cc66;">&#41;</span>;<br /><br />&#160; &#160; <span style="color: #003366; font-weight: bold;">var</span> parentPosition=divParent.<span style="color: #006600;">position</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; <span style="color: #003366; font-weight: bold;">var</span> parentWidth=divParent.<span style="color: #006600;">width</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; <span style="color: #003366; font-weight: bold;">var</span> parentHeight=divParent.<span style="color: #006600;">height</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; <br />&#160; &#160; <br />&#160; &#160; divOverlay.<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'left'</span>, parentPosition.<span style="color: #006600;">left</span>+parentWidth<span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; divOverlay.<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'top'</span>, parentPosition.<span style="color: #006600;">top</span>+parentHeight<span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; divOverlay.<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'visibility'</span>, <span style="color: #3366CC;">'visible'</span><span style="color: #66cc66;">&#41;</span>;<br /><span style="color: #66cc66;">&#125;</span><br /><span style="color: #003366; font-weight: bold;">function</span> hideUserInfo<span style="color: #66cc66;">&#40;</span>entryId<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#entryinfo_'</span>+userId<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'visibility'</span>, <span style="color: #3366CC;">'hidden'</span><span style="color: #66cc66;">&#41;</span>;<br /><br /><span style="color: #66cc66;">&#125;</span><br />&#160;</div>

I always wonder wy people code so many plugins for just so simple things, keep anything more complicated. Okay maybe it´s easier reusable but through most of them will not be maintained in one year or maybe are already lying arround for month, it is easier to just do it yourself.
Even this solutions has some Advantages cause the Tooltip Div is already existing inside the site, Javascript doesnt need to pass through all links like for example <a href="http://www.exforsys.com/tutorials/jquery/jquery-tooltips.html">here</a>. And also a crawler would be able to read the content of the Tooltip Divs easiely.
But however in some cases it makes sense to read the content of the Tooltip-Layers later for example if they requery more data, big pictures, calculations etc,
it might be an option to read them later by Ajax Request.
 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://webconsults.eu/archives/49-Sending-and-Rendering-Emails-with-Zend-Framework.html" rel="alternate" title="Sending and Rendering Emails with Zend Framework" />
        <author>
            <name>John Behrens</name>
                    </author>
    
        <published>2009-08-02T00:18:32Z</published>
        <updated>2009-08-08T00:14:47Z</updated>
        <wfw:comment>http://webconsults.eu/wfwcomment.php?cid=49</wfw:comment>
    
        <slash:comments>2</slash:comments>
        <wfw:commentRss>http://webconsults.eu/rss.php?version=atom1.0&amp;type=comments&amp;cid=49</wfw:commentRss>
    
            <category scheme="http://webconsults.eu/categories/3-PHP" label="PHP" term="PHP" />
    
        <id>http://webconsults.eu/archives/49-guid.html</id>
        <title type="html">Sending and Rendering Emails with Zend Framework</title>
        <content type="xhtml" xml:base="http://webconsults.eu/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                It took me a little while to figure out to solve a standard problem like sending an template or view script as email, the main problem is the original documentation doesn´t show anything about it, just sending email with text from a string, and if you search on the web, you find mostly the same thing or solutions which were not satisfying me.


<div class="php" style="text-align: left"><br /><span style="color: #808080; font-style: italic;">//Rendering mail template to string</span><br /><span style="color: #0000ff;">$mail_view</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_View<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&#160; &#160;&#160; &#160;&#160; &#160;&#160; &#160;<br /><span style="color: #0000ff;">$mail_view</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_View<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />/&lt;strong&gt;<br />&#160;&lt;/strong&gt; This will only work inside the MVC vontroller and<br />&#160;&lt;strong&gt; handle over script path to the email view renderer<br />&#160;&lt;/strong&gt;/&#160; &#160; &#160;&#160; &#160; &#160;&#160; &#160; &#160;&#160; &#160; &#160; &#160;&#160; &#160; <br /><span style="color: #0000ff;">$mail_view</span>-&gt;<span style="color: #006600;">addScriptPath</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">view</span>-&gt;<span style="color: #006600;">getScriptPaths</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br /><span style="color: #0000ff;">$strMailBody</span>=<span style="color: #0000ff;">$mail_view</span>-&gt;<span style="color: #006600;">render</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'controllername/mail.phtml'</span><span style="color: #66cc66;">&#41;</span>;<br /><br /><span style="color: #808080; font-style: italic;">//configuring email</span><br /><span style="color: #0000ff;">$email_recipient_mail</span>=<span style="color: #ff0000;">"recipient@example.com"</span>;<br /><span style="color: #0000ff;">$email_recipient_name</span>=<span style="color: #ff0000;">"Recipient Name"</span>;<br /><span style="color: #0000ff;">$email_subject</span>=<span style="color: #ff0000;">"Subject for the Email"</span>;<br /><span style="color: #0000ff;">$email_sender_email</span>=<span style="color: #ff0000;">"sender@example.com"</span>;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br /><span style="color: #0000ff;">$email_sender_name</span>=<span style="color: #ff0000;">"Sender Name"</span>;&#160; <br />&#160; <br /><span style="color: #808080; font-style: italic;">//sending email with Zend_Mail()&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; </span><br /><span style="color: #0000ff;">$mail</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_Mail <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br /><span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">setFrom</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$email_sender_email</span>, <span style="color: #0000ff;">$email_sender_email</span><span style="color: #66cc66;">&#41;</span>;<br /><span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">addTo</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$email_recipient_mail</span>, <span style="color: #0000ff;">$email_recipient_name</span><span style="color: #66cc66;">&#41;</span>;<br /><span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">setSubject</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$email_subject</span><span style="color: #66cc66;">&#41;</span>;<br /><span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">setBodyText</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$strMailBody</span><span style="color: #66cc66;">&#41;</span>;<br /><span style="color: #0000ff;">$mail</span>-&gt;<span style="color: #006600;">send</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160;</div>
The mail Template "mail.phtml" could contain text or HTML.

Finally i choosed out this method as the best for sending email in Zend Framework Projects,
maybe there would be one more better way, if i could put the subject inside the template file, i gonna save that for later.

 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://webconsults.eu/archives/48-Internationalization-in-User-Generated-Enviorments.html" rel="alternate" title="Internationalization in User Generated Enviorments" />
        <author>
            <name>John Behrens</name>
                    </author>
    
        <published>2009-07-30T20:59:08Z</published>
        <updated>2010-01-21T11:56:49Z</updated>
        <wfw:comment>http://webconsults.eu/wfwcomment.php?cid=48</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://webconsults.eu/rss.php?version=atom1.0&amp;type=comments&amp;cid=48</wfw:commentRss>
    
            <category scheme="http://webconsults.eu/categories/11-View-on-Web" label="View on Web" term="View on Web" />
    
        <id>http://webconsults.eu/archives/48-guid.html</id>
        <title type="html">Internationalization in User Generated Enviorments</title>
        <content type="xhtml" xml:base="http://webconsults.eu/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                User generated content in multilingual enviorments brings up new internationalizations problems,
in a social network or other enviorment with a lot of User Generated content, I18N could  not be sticked strictly to the user, and even a content or discussion could be spreaden through different languages. 
On usual websites a language is assigned to the frontend user, also on <a href="http://www.Youtube.com">Youtube</a> where it causes some problems.
I always recieve Mails like
<blockquote>
Komentarze do filmu „>videoname<”
Comentario sobre ">videoname<" publicado
Reactie van >userwhopostedcomment< op  ,>videoname<'
Nouveau commentaire sur ">videoname<"
Kommentar zu ">videoname<" gepostet" gepostet
</blockquote>
Which all mean your video ... has been commented by ..., but it´s alsways in the default language to the commentor, no matter what my language is and no matter which language the comment is Written in. Comments itself are mostly written in english or the language the video is in.
A solution could be to send it just in the recipient´s default language instead the actual frontend language, it would just make it easier for the recipient.


<blockquote>
Jeroen
- Moie Video, echt Leuk
   Tommy
   - Why are all the Comments in Dutch
     Franz
     - Die Holländer finden ihre Sprache so Toll
       Antje
       - Ihre Sprache ist auch Supertoll
       Joost
       - Duits is alleen voor Moffen
          Tommy
          - In English Please
          Joost
          - German is for Kauts Only
       Franz
       - Geh doch Käse essen du Kaaskopp
</blockquote>
As you see users could communicate through different Languages, and maybe they even like it and switch Languages during a conversation,
if you wanna run your site with an international flavour this is acceptable.



Language Detection

Language Detection could be usefull, to translate auto detection for example, but you could also hide content with Language Detection

For Example: I got a Guestbook entry on my Dutch <a href="http://www.netlog.com">Netlog</a>, somebody commentet the guestbook in  German with something like "Hi ich habe ein bischen Deutsch gelernt, Wie geht es dir? viele grüsse". This entry were hidden cause it weren´t written in my actual frontend Language (Dutch),
but actually i had choosen German as native language in my profile.

So if you use something like Language Detection to hide content from foreign Languages, you must consider a user could be able to understand more than one language.
Hiding content from the user is mostly a bad decission, cause even if the user is not able to read information might be usefull.
The better way is always to sign the entry as an entry with different language and offer automated translation possibility.

Where it could make sense to hide content is if a user is doing a general search on contents, at least in order of the search results.









 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://webconsults.eu/archives/45-Zend-Debug-Logger.html" rel="alternate" title="Zend Debug Logger" />
        <author>
            <name>John Behrens</name>
                    </author>
    
        <published>2009-06-26T14:53:59Z</published>
        <updated>2009-06-26T14:53:59Z</updated>
        <wfw:comment>http://webconsults.eu/wfwcomment.php?cid=45</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://webconsults.eu/rss.php?version=atom1.0&amp;type=comments&amp;cid=45</wfw:commentRss>
    
    
        <id>http://webconsults.eu/archives/45-guid.html</id>
        <title type="html">Zend Debug Logger</title>
        <content type="xhtml" xml:base="http://webconsults.eu/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                http://extraordinaire.me/web-development/bootstrap-zend-framework/ 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://webconsults.eu/archives/43-Eclipse-Visual-Editor-vs-Netbeans-GUI-Designer.html" rel="alternate" title="Eclipse Visual Editor vs Netbeans GUI Designer" />
        <author>
            <name>John Behrens</name>
                    </author>
    
        <published>2009-05-06T01:22:50Z</published>
        <updated>2009-05-20T14:59:02Z</updated>
        <wfw:comment>http://webconsults.eu/wfwcomment.php?cid=43</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://webconsults.eu/rss.php?version=atom1.0&amp;type=comments&amp;cid=43</wfw:commentRss>
    
            <category scheme="http://webconsults.eu/categories/15-Java" label="Java" term="Java" />
    
        <id>http://webconsults.eu/archives/43-guid.html</id>
        <title type="html">Eclipse Visual Editor vs Netbeans GUI Designer</title>
        <content type="xhtml" xml:base="http://webconsults.eu/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Some days ago i started my first Java project including a GUI,
first i began with using eclipse and the beginning was fine, until i came to that point were i had to create the GUI Interface.
I didn´t had the intension to define my GUI in writing lines of code, i was mostly searching for something to design a GUI by moving arround some buttons and editor boxes like in Visual Studio or Delphi.
After a few tryouts with outdated tutorials i could finally install the Visial Editor for Eclipse by using <a href="http://wiki.eclipse.org/VE/Update" title="Visual Editor">this tutorial</a>, i noticed that comfortable solution i am searching for, searching arround how to work with it i just found out, the VE is propably not able to do what i tried.
So i decided to try out Netbeans, and i were completly satisfied, download and installation were quite easy and the GUI Designer does it´s work almost perfectly, you don´t have to waste your time in configurating layouts just move them arround with drag and drop, almost as good as in Delphi.
So what i decided was stop to use Eclipse for that Java stuff and start to use Netbeans and so far Netbeans hits all of my needs exactly, even seems to be more out of one piece than eclipse.
Maybe gonna try it out Netbeans for PHP aswell.

 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://webconsults.eu/archives/42-5-Things-that-suck-at-Symfony-Framework.html" rel="alternate" title="5 Things that suck at Symfony Framework" />
        <author>
            <name>John Behrens</name>
                    </author>
    
        <published>2009-03-26T06:34:12Z</published>
        <updated>2010-01-21T17:29:00Z</updated>
        <wfw:comment>http://webconsults.eu/wfwcomment.php?cid=42</wfw:comment>
    
        <slash:comments>2</slash:comments>
        <wfw:commentRss>http://webconsults.eu/rss.php?version=atom1.0&amp;type=comments&amp;cid=42</wfw:commentRss>
    
            <category scheme="http://webconsults.eu/categories/3-PHP" label="PHP" term="PHP" />
    
        <id>http://webconsults.eu/archives/42-guid.html</id>
        <title type="html">5 Things that suck at Symfony Framework</title>
        <content type="xhtml" xml:base="http://webconsults.eu/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                1. The .yml  YAML format is very vulnerable for type errors, just one space to much and it breaks <br />

2. Version incompatibility, well to upgrade your symfony framework always cause problems and is not to <br />

3. Too much configuration files. Symfony has too much points were you can configure it or overwrite other configuration, so you never can be sure if it works the way you expect. <br />

4. Documentation is hard to search, a bunch of tutorials but no real documentation even not all parts are up to date.
for example try to find documentation about "form_remote_tag"  a complete searchable function reference would be helpfull. <br />

4. view.yml files, why should i put logic, like that my ajax request has no Layout to a configuration file?, I prefer it where the request is handled. <br />

5. You Always have to clear the cache during develloping, and sometimes you just forget. <br />

Well there are very positives things of Symfony Framework but these made me most annoyed during Symfony Development. 


 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://webconsults.eu/archives/41-Most-used-Symfony-Commands.html" rel="alternate" title="Most used Symfony Commands" />
        <author>
            <name>John Behrens</name>
                    </author>
    
        <published>2009-03-24T15:35:22Z</published>
        <updated>2010-01-12T15:26:25Z</updated>
        <wfw:comment>http://webconsults.eu/wfwcomment.php?cid=41</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://webconsults.eu/rss.php?version=atom1.0&amp;type=comments&amp;cid=41</wfw:commentRss>
    
            <category scheme="http://webconsults.eu/categories/3-PHP" label="PHP" term="PHP" />
    
        <id>http://webconsults.eu/archives/41-guid.html</id>
        <title type="html">Most used Symfony Commands</title>
        <content type="xhtml" xml:base="http://webconsults.eu/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Here is a list of my most used Symfony command line rool commands

Generate a new module 
php symfony generate:module application modelname

Generate Schema from database

<div class="php" style="text-align: left"><br />php5 symfony propel:build-schema<br />&#160;</div>
<blockquote>I always build the Schema from the Database, cause it is easier to Maintain the Database than the Schema file, you can use yoru default Database tool e.q. PhpMyAdmin or MySql Workbench, even there is no chance that sombody implements Database changes wich could be overwritten.</blockquote>

Generate Model
<div class="php" style="text-align: left"><br />php5 symfony propel:build-model<br />&#160;</div>
Generating the Forms 
<div class="php" style="text-align: left"><br />php5 symfony propel:build-forms<br />&#160;</div>
Generate Module from Table
<div class="php" style="text-align: left"><br />php symfony propel:generate-module --non-verbose-templates --with-show frontend post TableCamelCase<br />&#160;</div>
<blockquote>Note: the TableNameCamelCase is using Uppercase letter before any underscore
e.q. TableNameExample for table_name_example
</blockquote>






 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://webconsults.eu/archives/40-Calculating-Age-in-Years-in-PHP.html" rel="alternate" title="Calculating Age in Years in PHP" />
        <author>
            <name>John Behrens</name>
                    </author>
    
        <published>2009-02-17T17:33:04Z</published>
        <updated>2009-02-17T22:05:53Z</updated>
        <wfw:comment>http://webconsults.eu/wfwcomment.php?cid=40</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://webconsults.eu/rss.php?version=atom1.0&amp;type=comments&amp;cid=40</wfw:commentRss>
    
            <category scheme="http://webconsults.eu/categories/3-PHP" label="PHP" term="PHP" />
    
        <id>http://webconsults.eu/archives/40-guid.html</id>
        <title type="html">Calculating Age in Years in PHP</title>
        <content type="xhtml" xml:base="http://webconsults.eu/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Well calculating age in PHP seems to be not that big thing 
Date calculation is something wich would be a good topic for Programming for Beginners Lesson 2

It is not that much used cause Databases give a lot of nice date calculating functions like <a href="http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_datediff">MySQL DateDiff</a> or similar function on other Database.

PHP has not had a DateDiff function from home until PHP 5.3, unfortunatelle the PHP Version on server was 5.2.4 so i could not use the PHP <a href="http://php.net/manual/en/function.date-diff.php">DateDiff</a> Function from the new DateTime Functions.

Cause i was a bit lazy i thought it might be easy to find a usefull function to calculate Age in PHP but anything i found was a bunch of useless forum discussions and not 100% correct working answers so i wrote an own one.

<div class="php" style="text-align: left"><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #808080; font-style: italic;">//my save method to get age</span><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$strBirthdate</span> = <span style="color: #ff0000;">"1939-03-01"</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$intYearBirth</span> = <a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$strBirthdate</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$intMonthBirth</span> = <a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$strBirthdate</span>,<span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$intDayBirth</span> = <a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$strBirthdate</span>,<span style="color: #cc66cc;">8</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>;<br /><br /><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$intMonthBirth</span> &gt;= <a href="http://www.php.net/date"><span style="color: #000066;">date</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"m"</span><span style="color: #66cc66;">&#41;</span> &amp;&amp;amp; <span style="color: #0000ff;">$intDayBirth</span> &gt;= <a href="http://www.php.net/date"><span style="color: #000066;">date</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"d"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#160; <span style="color: #808080; font-style: italic;">//last birthday has been this year</span><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">$intAge</span>=<a href="http://www.php.net/date"><span style="color: #000066;">date</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Y"</span><span style="color: #66cc66;">&#41;</span> - <span style="color: #0000ff;">$intYearBirth</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #808080; font-style: italic;">//last birthday this year</span><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$intAge</span>=<span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/date"><span style="color: #000066;">date</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Y"</span><span style="color: #66cc66;">&#41;</span> - <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>&#160; <span style="color: #0000ff;">$intYearBirth</span> ;<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #808080; font-style: italic;">//most popular method found on the web</span><br />&#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$jetzt</span> = <a href="http://www.php.net/mktime"><span style="color: #000066;">mktime</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<a href="http://www.php.net/date"><span style="color: #000066;">date</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"m"</span><span style="color: #66cc66;">&#41;</span>,<a href="http://www.php.net/date"><span style="color: #000066;">date</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"d"</span><span style="color: #66cc66;">&#41;</span>,<a href="http://www.php.net/date"><span style="color: #000066;">date</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Y"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$geburtstag</span> = <a href="http://www.php.net/mktime"><span style="color: #000066;">mktime</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #0000ff;">$intMonthBirth</span>,<span style="color: #0000ff;">$intDayBirth</span>,<span style="color: #0000ff;">$intYearBirth</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$alter</span>&#160; &#160;= <a href="http://www.php.net/intval"><span style="color: #000066;">intval</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$jetzt</span> - <span style="color: #0000ff;">$geburtstag</span><span style="color: #66cc66;">&#41;</span> / <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3600</span> &lt;strong&gt; <span style="color: #cc66cc;">24</span> &lt;/strong&gt; <span style="color: #cc66cc;">365</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #b1b100;">return</span> <span style="color: #ff0000;">"method 1 $intAge&#160; method 2 $alter"</span>;<br />&#160;</div>

The problem is 365 days is not the correct number of days for a year.
Every 4 years there are 366 cause of the leap year
But  every 100 years there is no leap year. Like 1900
But  every 400 years there is. Like 2000

So for every 4 years  of age, this method gets wrong one more day.

A more correct calculation would be 
<div class="php" style="text-align: left"><br /><span style="color: #808080; font-style: italic;">//get days have been before this year.</span><br />&#160;<span style="color: #0000ff;">$intSecontsFromYearZero</span> = <span style="color: #cc66cc;">3600</span> &lt;strong&gt; <span style="color: #cc66cc;">24</span> &lt;/strong&gt; <a href="http://www.php.net/floor"><span style="color: #000066;">floor</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/date"><span style="color: #000066;">date</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Y"</span>, <span style="color: #cc66cc;">365</span>.<span style="color: #cc66cc;">2425</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />&#160;</div>
Could still have some combinations were it returns a wrong result, so the first example is still better.

Maybe i gonna past a full datediff function later once, otherwise upgrade to PHP 5.3, so as i will do soon.









 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://webconsults.eu/archives/37-The-Differents-between-SEO-and-HTML-Coder.html" rel="alternate" title="The Differents between SEO and HTML Coder" />
        <author>
            <name>John Behrens</name>
                    </author>
    
        <published>2008-10-27T15:45:17Z</published>
        <updated>2008-10-27T15:45:17Z</updated>
        <wfw:comment>http://webconsults.eu/wfwcomment.php?cid=37</wfw:comment>
    
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://webconsults.eu/rss.php?version=atom1.0&amp;type=comments&amp;cid=37</wfw:commentRss>
    
            <category scheme="http://webconsults.eu/categories/9-SEO" label="SEO" term="SEO" />
    
        <id>http://webconsults.eu/archives/37-guid.html</id>
        <title type="html">The Differents between SEO and HTML Coder</title>
        <content type="xhtml" xml:base="http://webconsults.eu/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Well i was at some agency in Munich for a job interview who dress theirselves to be very strong in SEO like having big industrial customers,  to determine my SEO knowledge they asked me a question like "How long do you need to put a Photoshop design into SEO HTML" well i just said SEO is more than building clean HTML and i don´t know what their photoshop templates look like. However at the moment i got some job but sometimes people searching for webdevelopers even do not know that somebody who is doing web and software development for more than 8 years might nog be satisfied with only coding HTML pages or configurating a stupid  properitary undocumented CMS system. 





 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://webconsults.eu/archives/34-Senior-PHP-Developer-free-for-hire.html" rel="alternate" title="Senior PHP Developer free for hire" />
        <author>
            <name>John Behrens</name>
                    </author>
    
        <published>2008-10-01T06:25:36Z</published>
        <updated>2008-10-01T06:25:36Z</updated>
        <wfw:comment>http://webconsults.eu/wfwcomment.php?cid=34</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://webconsults.eu/rss.php?version=atom1.0&amp;type=comments&amp;cid=34</wfw:commentRss>
    
            <category scheme="http://webconsults.eu/categories/1-Development" label="Development" term="Development" />
    
        <id>http://webconsults.eu/archives/34-guid.html</id>
        <title type="html">Senior PHP Developer free for hire</title>
        <content type="xhtml" xml:base="http://webconsults.eu/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Yesterday i just completed my last job at a Bank in Munich (München) by introducing a new freelance PHP developer, well this Senior Consultant position had been nice but i am even watching to get back to something more web related than developing financial applications based on PHP and Oracle and a lot of AJAX stuff working together with Sophis Risque. I had an already signed contract with a big recruitment agency for working at a nice online Portal in München but unfortunately they canceled it without giving me a notice on  time, so from today i am free to hire again.
The job market is not that bad in the moments a lot of people are searching for Webdevelopment Consultants, but i haven have to decide where to go.
I worked in Hamburg, München, Amsterdam and London before, and i still would like to go to Rotterdam, den Haag, Utrecht, Stockholm, Copenhagen or maybe somewhere else in the Netherlands, Denmark or Sweden.
I think it should be a Position in Webdevelopment again either a nice online project or an interesting web application, cause SEO (Search Engine Optimization) positions are not that well paid.
Maybe i could find something with a bit more focus on Symfony Framework or Zend Framework at a nice company, the other option is to just start working on some own web 2.0 projects which i would like to finish.

If you know somebody who is searching for a Senior PHP Developer or Consultant in Germany, Netherlands or Skandinavia feel free to contact me.
 
            </div>
        </content>
        
    </entry>

</feed>