<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>web/code - PHP</title>
    <link>http://webcode.lemme.at/</link>
    <description>Blog über das Web, PHP, Joomla, Ajax, Javascript, Patterns, ...</description>
    <dc:language>de</dc:language>
    <generator>Serendipity 1.5.2 - http://www.s9y.org/</generator>
    <pubDate>Mon, 22 Feb 2010 15:37:41 GMT</pubDate>

    <image>
        <url>http://webcode.lemme.at/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: web/code - PHP - Blog über das Web, PHP, Joomla, Ajax, Javascript, Patterns, ...</title>
        <link>http://webcode.lemme.at/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>PHP hates me wird 500!</title>
    <link>http://webcode.lemme.at/archives/45-PHP-hates-me-wird-500!.html</link>
            <category>PHP</category>
    
    <comments>http://webcode.lemme.at/archives/45-PHP-hates-me-wird-500!.html#comments</comments>
    <wfw:comment>http://webcode.lemme.at/wfwcomment.php?cid=45</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://webcode.lemme.at/rss.php?version=2.0&amp;type=comments&amp;cid=45</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Lemmé)</author>
    <content:encoded>
    &lt;p&gt;Heute hat DER deutschsprachige PHP Blog seinen &lt;a href=&quot;http://www.phphatesme.com/blog/allgemein/500-mal-phphatesme-wir-feiern/&quot;&gt;500sten&lt;/a&gt; (und inzwischen auch schon seinen &lt;a href=&quot;http://www.phphatesme.com/blog/allgemein/das-gewinnspiel-geht-los/&quot;&gt;501ten&lt;/a&gt;) Eintrag veröffentlicht. Und das nur ca. 1 1/2 Jahre nach dem ersten Artikel. Das ist fast ein Artikel pro Tag! Gratulieren möchte ich Nils Langner und seinen Mitautoren aber eigentlich nicht zum 500 Eintrag, sondern zu den wahnsinnig interessanten Inhalten.&lt;/p&gt; 
&lt;p&gt;PHP hates me unterscheidet sich nämlich nicht nur durch die Frequenz der Beiträge von anderen PHP Blogs. Vor allem die Gedanken, die sich die Autoren,allen voran Nils, über alltägliche Probleme eines (Web-)Entwicklers machen, machen den Blog für mich so lesenswert. Er formuliert viele Gedanken, über die man ab und zu mal drüberfällt aber nie zu Ende denkt aus, und die überaus eifrige Leserschaft gibt ausführlich und gesittet ihren Senf dazu. So soll es sein, danke! &lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 22 Feb 2010 15:21:35 +0100</pubDate>
    <guid isPermaLink="false">http://webcode.lemme.at/archives/45-guid.html</guid>
    
</item>
<item>
    <title>Bildbearbeitung mit PHP</title>
    <link>http://webcode.lemme.at/archives/41-Bildbearbeitung-mit-PHP.html</link>
            <category>PHP</category>
    
    <comments>http://webcode.lemme.at/archives/41-Bildbearbeitung-mit-PHP.html#comments</comments>
    <wfw:comment>http://webcode.lemme.at/wfwcomment.php?cid=41</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://webcode.lemme.at/rss.php?version=2.0&amp;type=comments&amp;cid=41</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Lemmé)</author>
    <content:encoded>
    &lt;h3&gt;Dateien hochladen&lt;/h3&gt; 
&lt;p&gt;Dieser erste Teil hat noch nicht unbedingt was mit Bildverarbeitung zu tun, aber meistens kommen die Bilder ja über die PHP-Applikation erst auf den Server. &lt;/p&gt; 
&lt;p&gt;Um eine Datei auf den Webserver zu laden benötigt man ein Formular, das in seiner einfachsten Form ungefähr so aussehen könnte:&lt;/p&gt; 
&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;&amp;lt;form name=&quot;uploadform&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot; action=&quot;&quot;&amp;gt;
	&amp;lt;input type=&quot;file&quot; name=&quot;thefile&quot; /&amp;gt;
	&amp;lt;input name=&quot;thesubmit&quot; type=&quot;submit&quot; value=&quot;Upload image&quot; /&amp;gt;
&amp;lt;/form&amp;gt;&lt;/pre&gt; 
&lt;p&gt;Wichtig ist, dass als Methode &lt;em&gt;POST&lt;/em&gt; angegeben wird und als &lt;a href=&quot;http://de.wikipedia.org/wiki/MIME&quot;&gt;MIME-Typ&lt;/a&gt; (enctype) &lt;em&gt;multipart/form-data&lt;/em&gt;, da der Dateiupload sonst nicht funktioniert.&lt;/p&gt; 
&lt;p&gt;Im Ziel-Script (das im &lt;em&gt;action&lt;/em&gt;-Attribut angegeben werden kann, wenn nichts angegeben wird, wird das selbe Script wieder geladen) kann man nun die hochgeladene Datei überprüfen und in ein Verzeichnis seiner Wahl kopieren:&lt;/p&gt; 
&lt;p&gt; &lt;/p&gt; 
&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;&amp;lt;?php
//überprüfen, ob das Formular gesendet wurde
if(isset($_POST[&#039;thesubmit&#039;])){
	//Metadaten, die uns PHP über die Datei liefert ausgeben
	echo $_FILES[&#039;thefile&#039;][&#039;name&#039;] . &quot;&amp;lt;br /&amp;gt;&quot;;
	echo $_FILES[&#039;thefile&#039;][&#039;type&#039;] . &quot;&amp;lt;br /&amp;gt;&quot;;
	echo $_FILES[&#039;thefile&#039;][&#039;tmp_name&#039;] . &quot;&amp;lt;br /&amp;gt;&quot;;
	echo $_FILES[&#039;thefile&#039;][&#039;error&#039;] . &quot;&amp;lt;br /&amp;gt;&quot;;
	echo $_FILES[&#039;thefile&#039;][&#039;size&#039;] . &quot;&amp;lt;br /&amp;gt;&quot;;

	//überprüfen des MIME-Typs
	$mime = $_FILES[&#039;thefile&#039;][&#039;type&#039;];
	if($mime == &#039;image/gif&#039; || $mime == &#039;image/jpeg&#039; || $mime == &#039;image/png&#039;){
		//aktueller Pfad und Dateiname des Bildes
		$oldfile = $_FILES[&#039;thefile&#039;][&#039;tmp_name&#039;];
		//vorgesehener Pfad und Dateiname des Bildes
		$newfile = &#039;uploads/&#039;.$_FILES[&#039;thefile&#039;][&#039;name&#039;];
		//datei kopieren
		move_uploaded_file($oldfile, $newfile);
	}
}
?&amp;gt;&lt;/pre&gt; 
&lt;p&gt; &lt;/p&gt; 
&lt;p&gt;Das Bild wird also hochgeladen, überprüft ob es sich um ein Bild handelt, dann wird es aus dem Temporären Verzeichnis in ein beliebiges neues kopiert, in unserem Fall &lt;em&gt;uploads/&lt;/em&gt;, mit dem Originalnamen dahinter.&lt;/p&gt; 
&lt;p class=&quot;attention&quot;&gt;&lt;strong&gt;Achtung!&lt;/strong&gt; Die Überprüfung des MIME-Typs (oder auch der Dateiendung) genügt noch nicht als sichere Überprüfung der Datei. Eine bessere Methode ist, mit den weiter unten vorgestellten Funktionen zu prüfen, ob das Bild tatsächlich eine Höhe und eine Breite hat. Ist auch keine 100% sichere Methode, aber schon mal besser als gar keine. &lt;br /&gt;Auch der Dateiname sollte geändert werden, der Originalname sollte niemals übernommen werden.&lt;/p&gt; 
&lt;h3&gt;Bild von Datei laden&lt;/h3&gt; 
&lt;p&gt;
Dafür gibts drei Funktionen für gif, jpeg und png:&lt;/p&gt; 
&lt;ul&gt; 
&lt;li&gt;resource imagecreatefromgif ( string $filename )&lt;/li&gt; 
&lt;li&gt;
resource imagecreatefromjpeg ( string $filename )&lt;/li&gt; 
&lt;li&gt;
resource imagecreatefrompng( string $filename )&lt;/li&gt; 
&lt;/ul&gt; 
&lt;p&gt;
Dadurch erhält man einen Zeiger auf die Grafik, z.B.:&lt;/p&gt; 
&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;$image = imagecreatefrompng( &#039;einbild.png&#039; ); 
&lt;/pre&gt; 
&lt;h3&gt;Daten eines Bildes - Metadaten&lt;/h3&gt; 
&lt;p&gt;Für viele Anwendungen in der Bildverarbeitung ist es wichtig, Daten über das Bild zu erhalten. Dazu gehören unter anderem Höhe, Breite, Typ, Farbtiefe usw. Die gängigste Funktion für diese Metadaten ist &lt;em&gt;getimagesize()&lt;/em&gt;. Diese Funktion liefert ein Array mit 7 Elementen, die verschiedene Metainformationen beinhalten.&lt;/p&gt; 
&lt;ul&gt; 
&lt;li&gt;Index &lt;em&gt;0&lt;/em&gt; Breite des Bildes&lt;/li&gt; 
&lt;li&gt;Index &lt;em&gt;1&lt;/em&gt; Höhe des Bildes&lt;br /&gt;&lt;/li&gt; 
&lt;li&gt;Index &lt;em&gt;2&lt;/em&gt; ist eine der IMAGETYPE-Konstanten (IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_SWF, IMAGETYPE_PSD, IMAGETYPE_BMP, IMAGETYPE_WBMP, IMAGETYPE_XBM, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM, IMAGETYPE_IFF, IMAGETYPE_JB2, IMAGETYPE_JPC, IMAGETYPE_JP2, IMAGETYPE_JPX, IMAGETYPE_SWC, IMAGETYPE_ICO)&lt;/li&gt; 
&lt;li&gt;Index &lt;em&gt;3&lt;/em&gt; Textstring im Format &#039;height=&amp;quot;yyy&amp;quot; width=&amp;quot;xxx&amp;quot;&#039;für ein IMG-Tag.&lt;/li&gt; 
&lt;li&gt;Index &lt;em&gt;mime&lt;/em&gt; Der MIME Typ des Bildes&lt;/li&gt; 
&lt;li&gt;Index &lt;em&gt;channels&lt;/em&gt; 3 für RGB und 4 für CMYK Bilder.&lt;/li&gt; 
&lt;li&gt;Index &lt;em&gt;bits&lt;/em&gt; Die Farbtiefe in Bit pro Farbe .&lt;/li&gt; 
&lt;/ul&gt; 
&lt;h3&gt;Größe eines Bildes ändern&lt;/h3&gt; 
&lt;p&gt;Um ein Bild zu skalieren, braucht man mehrere Funktionen, die man am besten in einer Funktion zusammenfasst: &lt;br /&gt;&lt;/p&gt; 
&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;public static function scaleImage($image, $maxwidth, $maxheight){
	list($image_width, $image_height) = getimagesize($file);
	if($image_width &amp;gt; $image_height){
		$new_image_width = $maxwidth;
		$new_image_height = $image_height*($maxheight/$image_height);
	}else{
		$new_image_height = $maxheight;
		$new_image_width = $image_width * ($maxwidth/$image_width);
	}
	$new_image = imagecreatetruecolor(round($new_image_width),
	round($new_image_height));
	imagecopyresized($new_image, $image, 0, 0, 0, 0, $new_image_width,
	$new_image_height, $image_width, $image_height);
	return $new_image;
}&lt;/pre&gt; 
&lt;p&gt;
Die Funktion nimmt als Parameter einen Zeiger und die gewünschte maximale Breite und maxiamle Höhe entgegen. Je nachdem, ob Höhe oder Breite größer ist, wird dann der andere Wert berechnet.&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;Danach wird ein neues Bild mit der berchneten Größe erstellt.&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;Schlußendlich kopiert die Funktion imagecopyresized() das alte Bild in das neue Bild.&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;Die verwendeten Funktionen:&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt; &lt;/p&gt; 
&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;resource imagecreatetruecolor ( int $width , int $height )
bool imagecopyresized ($to, $from, $to_x, $to_y, $from_x, $from_y, $to_w, $to_h, $from_w, $from_h)&lt;/pre&gt; 
&lt;p&gt; &lt;/p&gt; 
&lt;h3&gt;Bild speichern bzw. ausgeben&lt;/h3&gt; 
&lt;p&gt;Um ein Bild zu speichern oder im Dokument auszugeben gibt es wieder für jedes Format die entsprechenden Funktionen:&lt;br /&gt;&lt;/p&gt; 
&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;bool imagegif ( resource $image [, string $filename ] )
bool imagejpeg ( resource $image [, string $filename [, int $quality ]] )
bool imagepng ( resource $image [, string $filename [, int $quality [, int $filters ]]] )&lt;/pre&gt; 
&lt;p&gt;Das Bild wird einfach im Skript ausgegeben, wenn kein Dateiname angegeben ist.&lt;/p&gt; 
&lt;p&gt;Die Qualität wird für JPEGs von 0-100 und bei PNGs von 0-9 angegeben. &lt;/p&gt; 
&lt;p&gt;$filters kann eine der Konstanten PNG_NO_FILTER, PNG_FILTER_NONE, PNG_FILTER_SUB , PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH oder PNG_ALL_FILTERS sein.&lt;br /&gt;&lt;/p&gt; 
&lt;h3&gt;Neues, leeres Bild erstellen&lt;/h3&gt; 
&lt;p&gt;Das geschieht durch die Funktion&lt;br /&gt;&lt;/p&gt; 
&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;resource imagecreate ( int $width , int $height )&lt;/pre&gt; 
&lt;p&gt;Einfach Breite und Höhe angeben und den zurückgegebenen Zeiger in einer Variable speichern.&lt;br /&gt;&lt;/p&gt; 
&lt;h3&gt;Farben definieren&lt;/h3&gt; 
&lt;p&gt;Zu Beginn ist die Farbpalette des Bildes leer, das heißt man muss jede neue Farbe vor jeder Operation definieren:&lt;br /&gt;&lt;/p&gt; 
&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;int imagecolorallocate ( resource $image , int $red , int $green , int $blue )&lt;/pre&gt; 
&lt;p&gt;Also z.B.:&lt;/p&gt; 
&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;$white = imageColorAllocate($image, 255, 255, 255)&lt;/pre&gt; 
&lt;p&gt;Diese Farbe kann dann manchen Funktionen mitgegeben werden.&lt;/p&gt; 
&lt;p&gt;Außerdem legt der erste Aufruf der Funktion den Hintergrund der Grafik fest, außer sie wurde mittels imagecreatetruecolor() erstellt.&lt;br /&gt;&lt;/p&gt; 
&lt;h3&gt;Ausschnitt eines Bildes in ein anderes kopieren&lt;/h3&gt; 
&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;bool imagecopy ( resource $dst_im , resource $src_im , int $dst_x , int $dst_y , int $src_x , int $src_y , int $src_w , int $src_h )
&lt;/pre&gt; 
&lt;h3&gt;Text einfügen&lt;/h3&gt; 
&lt;p&gt;Zeichenketten kann man mithilfe der Funktion&lt;/p&gt; 
&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;bool imagestring ( resource $image , int $font , int $x , int $y , string $string , int $color )&lt;/pre&gt; 
&lt;p&gt;ausgeben, wobei die Parameter für das Bild, die Schriftart (1-5), die Position, die auszugebende Zeichenkette und die Farbe stehen.&lt;/p&gt; 
&lt;p&gt;Für weitere Schriftarten siehe die Funktion&lt;/p&gt; 
&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;int imageloadfont ( string $file )
&lt;/pre&gt; 
&lt;h3&gt;Zeichnen&lt;/h3&gt; 
&lt;p&gt;Man kann in ein Bild verschiedene Formen zeichnen, dafür gibt’s unter anderem die folgenden Funktionen:&lt;br /&gt;&lt;/p&gt; 
&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;bool imagesetpixel ( resource $image , int $x , int $y , int $color )
bool imageline ( resource $image , int $x1 , int $y1 , int $x2 , int $y2 , int $color )
bool imagerectangle ( resource $image , int $x1 , int $y1 , int $x2 , int $y2 , int $color )
bool imagefilledrectangle ( resource $image , int $x1 , int $y1 , int $x2 , int $y2 ,int $color )
bool imageellipse ( resource $image , int $cx , int $cy , int $width , int $height , int $color )
bool imagefilledellipse ( resource $image , int $cx , int $cy , int $width , int $height, int $color )
bool imagearc ( resource $image , int $cx , int $cy , int $width , int $height , int $start , int $end , int $color )
bool imagepolygon ( resource $image , array $points , int $num_points , int $color )&lt;/pre&gt; 
&lt;p&gt; &lt;/p&gt; 
&lt;p&gt; &lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 14 Oct 2009 00:03:30 +0200</pubDate>
    <guid isPermaLink="false">http://webcode.lemme.at/archives/41-guid.html</guid>
    <category>bildbearbeitung</category>
<category>copy</category>
<category>form</category>
<category>html</category>
<category>mime</category>
<category>php</category>
<category>upload</category>

</item>
<item>
    <title>Upload Problem mit dem Internet Explorer</title>
    <link>http://webcode.lemme.at/archives/36-Upload-Problem-mit-dem-Internet-Explorer.html</link>
            <category>Allgemein</category>
            <category>PHP</category>
    
    <comments>http://webcode.lemme.at/archives/36-Upload-Problem-mit-dem-Internet-Explorer.html#comments</comments>
    <wfw:comment>http://webcode.lemme.at/wfwcomment.php?cid=36</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://webcode.lemme.at/rss.php?version=2.0&amp;type=comments&amp;cid=36</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Lemmé)</author>
    <content:encoded>
    
&lt;p&gt;Schön, wieder mal eine Stunde mit dem IE verschi$$en...&lt;/p&gt;&lt;p&gt;Ich hab eine kleine PHP-Anwendung mit Bilderupload geschrieben, die auch ganz gut funktioniert hat - in allen Browsern ausser dem Liebling aller Webdesigner, dem Internet Explorer.&lt;/p&gt;&lt;p&gt;Das Problem war, dass der Internet Explorer beim Hochladen die MIME-Typen der Dateien verändert, siehe &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms775147.aspx&quot;&gt;hier&lt;/a&gt;. Und diese MIME Type Detection macht aus image/png ein image/x-png und aus image/jpg ein image/pjpg, was meiner Ansicht nach äusserst hirnrissig ist.&lt;/p&gt;&lt;p&gt;Also Lösung: Wenn im Uploadskript (z.B. wie bei mir PHP) auf MIME-Typen überprüft werden soll, dann auch die Typen &lt;b&gt;image/x-png&lt;/b&gt; und &lt;b&gt;image/pjpg&lt;/b&gt; beachten!&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Thu, 07 May 2009 15:46:58 +0200</pubDate>
    <guid isPermaLink="false">http://webcode.lemme.at/archives/36-guid.html</guid>
    
</item>
<item>
    <title>Interner Link im Joomla-Template</title>
    <link>http://webcode.lemme.at/archives/30-Interner-Link-im-Joomla-Template.html</link>
            <category>Joomla</category>
            <category>PHP</category>
    
    <comments>http://webcode.lemme.at/archives/30-Interner-Link-im-Joomla-Template.html#comments</comments>
    <wfw:comment>http://webcode.lemme.at/wfwcomment.php?cid=30</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://webcode.lemme.at/rss.php?version=2.0&amp;type=comments&amp;cid=30</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Lemmé)</author>
    <content:encoded>
    
&lt;p&gt;Manchmal kann es notwendig sein, einen internen Link direkt ins Joomla Template einzufügen. Die naheliegendste Möglichkeit ist wohl, auf die entsprechende Seite im Browser zu gehen, die URL zu kopieren und im Template einzufügen. Allerdings kann sich der Name der Seite (und damit unter Umständen der Alias) ändern und das ergibt dann ungültige Links auf der Seite. Diese gilt es zu vermeiden.&lt;/p&gt;&lt;p&gt;Nun, die Lösung ist eigentlich ganz einfach und heißt JHTML::link(). Das ist die Funktion, die aus einer URL mit GET-Parametern eine schöne Joomla-URL macht.&lt;/p&gt;&lt;p&gt;Also, zuerst müssen wir den Link zusammenbauen: &lt;/p&gt;&lt;h3&gt;Einen Artikel verlinken&lt;/h3&gt;&lt;p&gt;Im Joomla-Backend auf die Beitragsübersicht gehen um die ID des Artikels herauszufinden (in der ganz rechten Spalte):&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;!-- s9ymdb:25 --&gt;&lt;!-- s9ymdb:24 --&gt;&lt;img height=&quot;300&quot; width=&quot;450&quot; src=&quot;http://webcode.lemme.at/uploads/joomla_berichte_id.png&quot; style=&quot;border: 0px none ; padding-left: 5px; padding-right: 5px;&quot; class=&quot;serendipity_image_center&quot; /&gt;&lt;/p&gt;&lt;p&gt;Die ID wird dann an den folgenden Link statt xyz angehängt.&lt;/p&gt;&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;index.php?option=com_content&amp;amp;view=article&amp;amp;id=xyz&lt;/pre&gt;&lt;p&gt;Oft will man aber nicht auf den Beitrag, sondern auf einen bestimmten &lt;/p&gt;&lt;h3&gt;Menüpunkt verlinken&lt;/h3&gt;&lt;p&gt;Dazu geht man im Backend auf ein Menü, und wählt den entsprechenden Menüeintrag aus. In der Detailansicht sieht man dann die ID des Menüeintrags (Menü-Item), die man benötigt:&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;img height=&quot;251&quot; width=&quot;450&quot; src=&quot;http://webcode.lemme.at/uploads/joomla_menue_id.png&quot; style=&quot;border: 0px none ; padding-left: 5px; padding-right: 5px;&quot; class=&quot;serendipity_image_center&quot; /&gt;&lt;/p&gt;&lt;p&gt;Auch hier wird die ID (in diesem Fall 54) an den Link angehängt:&lt;/p&gt;&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;index.php?Itemid=xyz&lt;/pre&gt;&lt;h3&gt;Ins Template einfügen&lt;/h3&gt;&lt;p&gt;Nun muß der Link nur noch an der gewünschten Stelle ins Template eingefügt werden:&lt;/p&gt;&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;&amp;lt;?
echo JHTML::link(&#039;index.php?Itemid=xyz&#039;,&#039;Linktitel&#039;, $attribute);
?&amp;gt;&lt;/pre&gt;&lt;p&gt;Mögliche HTML Attribute des Link-Tags können über das assoziative Array $attribute übergeben werden, z.B.:&lt;/p&gt;&lt;p /&gt;&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;&amp;lt;?
$attribute = array(&#039;class&#039;=&amp;gt;&#039;menulink&#039;, &#039;title&#039;=&amp;gt;&#039;Zum Menü&#039;);
echo JHTML::link(&#039;index.php?Itemid=xyz&#039;,&#039;Linktitel&#039;, $attribute);
?&amp;gt;&lt;/pre&gt;
&lt;p /&gt;&lt;p /&gt;&lt;p /&gt;&lt;p /&gt; 
    </content:encoded>

    <pubDate>Mon, 19 Jan 2009 11:38:33 +0100</pubDate>
    <guid isPermaLink="false">http://webcode.lemme.at/archives/30-guid.html</guid>
    <category>joomla</category>
<category>php</category>
<category>tipps</category>
<category>tutorial</category>

</item>
<item>
    <title>Die Programmierer-Hierarchie</title>
    <link>http://webcode.lemme.at/archives/25-Die-Programmierer-Hierarchie.html</link>
            <category>Ajax</category>
            <category>Allgemein</category>
            <category>PHP</category>
            <category>Servlets und JSP</category>
    
    <comments>http://webcode.lemme.at/archives/25-Die-Programmierer-Hierarchie.html#comments</comments>
    <wfw:comment>http://webcode.lemme.at/wfwcomment.php?cid=25</wfw:comment>

    <slash:comments>9</slash:comments>
    <wfw:commentRss>http://webcode.lemme.at/rss.php?version=2.0&amp;type=comments&amp;cid=25</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Lemmé)</author>
    <content:encoded>
    
&lt;p align=&quot;baseline&quot;&gt;Eine Hierarchie, wie sich Programmierer bestimmter Sprachen selbst sehen, also wer sich wem überlegen fühlt.&lt;/p&gt;&lt;p align=&quot;baseline&quot;&gt;Bemerkenswert der Kommentar zu Ruby (frei übersetzt):&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Ruby Programmierer fühlen sich jedem überlegen, aber sie wissen nicht dass es auch Nicht-Web-Programmiersprachen gibt, darum sind sie in der Grafik über Perl.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Hm, hat was wahres...&lt;/p&gt;&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p align=&quot;baseline&quot; /&gt;&lt;p align=&quot;center&quot;&gt;&lt;img src=&quot;http://webcode.lemme.at/uploads/programmer_hierarchy.jpg&quot; /&gt;&lt;/p&gt;&lt;p&gt;Via &lt;a title=&quot;informatik forum&quot; href=&quot;http://www.informatik-forum.at/showthread.php?t=67775&quot;&gt;informatik-forum.at&lt;/a&gt;.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Tue, 04 Nov 2008 10:59:02 +0100</pubDate>
    <guid isPermaLink="false">http://webcode.lemme.at/archives/25-guid.html</guid>
    <category>ajax</category>
<category>allgemein</category>
<category>funny</category>
<category>java</category>
<category>javascript</category>
<category>jsp</category>
<category>php</category>
<category>servlets und jsp</category>

</item>
<item>
    <title>Gratis eBook &quot;MySQL mit PHP&quot;</title>
    <link>http://webcode.lemme.at/archives/24-Gratis-eBook-MySQL-mit-PHP.html</link>
            <category>Bücher</category>
            <category>PHP</category>
    
    <comments>http://webcode.lemme.at/archives/24-Gratis-eBook-MySQL-mit-PHP.html#comments</comments>
    <wfw:comment>http://webcode.lemme.at/wfwcomment.php?cid=24</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://webcode.lemme.at/rss.php?version=2.0&amp;type=comments&amp;cid=24</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Lemmé)</author>
    <content:encoded>
    
&lt;img hspace=&quot;0&quot; vspace=&quot;0&quot; border=&quot;0&quot; align=&quot;right&quot; src=&quot;http://webcode.lemme.at/uploads/einmysql2ger.s.gif&quot; /&gt;O&#039;Reilly hat in seiner Serie &lt;a href=&quot;http://www.oreilly.de/online-books/&quot; title=&quot;O&#039;Reilly OpenBooks&quot;&gt;OpenBooks&lt;/a&gt; ein neues eBook &lt;a href=&quot;http://www.oreilly.de/german/freebooks/einmysql2ger/&quot; title=&quot;Download von &quot;&gt;zum Download bereitgestellt&lt;/a&gt;. Heißen tut das gute Stück &amp;quot;MySQL mit PHP&amp;quot;.&lt;p&gt;Es beschreibt die Installation des &amp;quot;magischen Trios&amp;quot; Apache, PHP und MySQL, Grundlagen und Methoden des Datenbankentwurfs (Datentypen, Schlüssel, Entity-Relationship Diagramme, Normalisierung,..), und wie man per SQL mit der Datenbank kommuniziert. Auch erweiterte Funktionen wie Transaktionen, Views, Prepared Statements, Stored Procedures und Trigger werden durchgenommen.&lt;/p&gt;&lt;p&gt;Dann gibts eine kleine Einführung in PHP und eine Beschreibung der MySQL-Funktionen von PHP, garniert mit einem kleinem, ein bisschen deplazierten Ajax-Tutorial und einer umfangreichen Beispielanwendung.&lt;/p&gt;&lt;p&gt;Zum Schluß gibts auch noch eine Einführung in die Administration von MySQL.&lt;/p&gt;&lt;p&gt;Ich denke alles in allem ist es ein recht brauchbares Buch für Einsteiger oder auch zum Nachschlagen für erfahrenere Nutzer.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 24 Oct 2008 14:40:00 +0200</pubDate>
    <guid isPermaLink="false">http://webcode.lemme.at/archives/24-guid.html</guid>
    <category>buch</category>
<category>bücher</category>
<category>mysql</category>
<category>php</category>

</item>
<item>
    <title>PHP Feedreader-Libraries: Zend_Feed vs. SimplePie</title>
    <link>http://webcode.lemme.at/archives/21-PHP-Feedreader-Libraries-Zend_Feed-vs.-SimplePie.html</link>
            <category>PHP</category>
    
    <comments>http://webcode.lemme.at/archives/21-PHP-Feedreader-Libraries-Zend_Feed-vs.-SimplePie.html#comments</comments>
    <wfw:comment>http://webcode.lemme.at/wfwcomment.php?cid=21</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://webcode.lemme.at/rss.php?version=2.0&amp;type=comments&amp;cid=21</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Lemmé)</author>
    <content:encoded>
    
&lt;p&gt;Ich hab mich in letzter Zeit ein wenig mit dem &lt;a href=&quot;http://framework.zend.com/&quot; title=&quot;Homepage des Zend Framework&quot;&gt;Zend Framework&lt;/a&gt; beschäftigt und bin nach kurzer zeit auch auf die PHP-Feedreader Komponente &lt;a href=&quot;http://framework.zend.com/manual/de/zend.feed.html&quot; title=&quot;Zend_Feed PHP Feedreader Komponente des Zend Frameworks&quot;&gt;Zend_Feed&lt;/a&gt; gestoßen.Nach ein bisschen herumprobieren mit diversen Feeds, bin ich aber anscheinend schon an ihre Grenzen gestoßen. Das parsen von Atom-Feeds ist mir nicht gelungen, besser gesagt das extrahieren des link-Tags.Wobei ich jetzt nicht unbedingt die Schuld auf Zend_Feed schieben möchte, ich hab einfach nicht lange herumprobiert und Google hat nichts brauchbares zu dem Thema ausgespuckt.&lt;/p&gt;&lt;p&gt;Langer Rede kurzer Sinn, ich hab mich nach Alternativen umgesehen und bin auch sogleich fündig geworden: Eine oft empfohlene Library ist &lt;a href=&quot;http://simplepie.org/&quot; title=&quot;PHP Feedreader Komponente SimplePie&quot;&gt;SimplePie&lt;/a&gt;, ein Open Source PHP Feed Reader. Der Vorteil, der sofort ins Auge sticht, ist die Fehlertoleranz und die Unterstüzung für diverse Feed-Formate. Momentan sind das (laut &lt;a href=&quot;http://simplepie.org/wiki/faq/what_versions_of_rss_or_atom_do_you_support&quot; title=&quot;Support der Feed-Formate durch SimplePie&quot;&gt;Website&lt;/a&gt;):&lt;/p&gt;&lt;ul&gt;&lt;li&gt;RSS 0.90&lt;/li&gt;&lt;li&gt;RSS 0.91 (Netscape)&lt;/li&gt;&lt;li&gt;RSS 0.91 (Userland)&lt;/li&gt;&lt;li&gt;RSS 0.92&lt;/li&gt;&lt;li&gt;RSS 1.0&lt;/li&gt;&lt;li&gt;RSS 2.0&lt;/li&gt;&lt;li&gt;Atom 0.3&lt;/li&gt;&lt;li&gt;Atom 1.0&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Ein weiteres praktisches Feature ist das automatische Auffinden von Feeds einer Website. Man muss also nicht die genaue URL des Feeds eingeben, es reicht auch beispielsweise die Adresse eines Blogs. Das kann Zend_Feed &lt;a href=&quot;http://framework.zend.com/manual/de/zend.feed.findFeeds.html&quot; title=&quot;Feeds automatisch finden&quot;&gt;zwar auch&lt;/a&gt;, macht es aber nicht automatisch (Was vielleicht auch performancetechnisch intelligenter ist, whatever).&lt;/p&gt;&lt;p&gt;Auch Caching der geladenen Einträge wird unterstützt, was die etwas trägere Performance etwas besser macht.&lt;/p&gt;&lt;p&gt;Zu guter letzt möchte ich ein kleines Beispiel bringen, um zu zeigen, wie einfach SimplePie angewandt werden kann:&lt;/p&gt;
&lt;pre name=&quot;code&quot; class=&quot;php&quot;&gt;&amp;lt;?php
require_once(&#039;simplepie/simplepie.inc&#039;);
$feed = new SimplePie(&#039;webcode.lemme.at&#039;);
$feed-&amp;gt;handle_content_type();

if($feed-&amp;gt;error()){
	//handle Error
}else{
	echo&#039;&amp;lt;ul&amp;gt;&#039;;
	foreach ($feed-&amp;gt;get_items() as $item) {
		echo &#039;&amp;lt;li&amp;gt;&amp;lt;ul&amp;gt;&#039;;
		echo &#039;&amp;lt;li&amp;gt;&#039;.$item-&amp;gt;get_title().&#039;&amp;lt;/li&amp;gt;&#039;;
		echo &#039;&amp;lt;li&amp;gt;&#039;.$item-&amp;gt;get_permalink().&#039;&amp;lt;/li&amp;gt;&#039;;
		echo &#039;&amp;lt;/ul&amp;gt;&amp;lt;/li&amp;gt;&#039;;
	}
	echo &#039;&amp;lt;/ul&amp;gt;&#039;;
}
?&amp;gt;&lt;/pre&gt;
&lt;p&gt; Ich denke mal der Code ist halbwegs selbsterklärend, sollte er das nicht sein, darf natürlich in den Kommentaren gefragt werden ;)&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 16 Oct 2008 01:24:29 +0200</pubDate>
    <guid isPermaLink="false">http://webcode.lemme.at/archives/21-guid.html</guid>
    <category>feedreader</category>
<category>php</category>
<category>simplepie</category>
<category>zend framework</category>

</item>
<item>
    <title>Enterprise PHP Patterns</title>
    <link>http://webcode.lemme.at/archives/12-Enterprise-PHP-Patterns.html</link>
            <category>PHP</category>
    
    <comments>http://webcode.lemme.at/archives/12-Enterprise-PHP-Patterns.html#comments</comments>
    <wfw:comment>http://webcode.lemme.at/wfwcomment.php?cid=12</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://webcode.lemme.at/rss.php?version=2.0&amp;type=comments&amp;cid=12</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Lemmé)</author>
    <content:encoded>
    &lt;p&gt;Stefan Priebsch hat auf der &lt;a href=&quot;http://it-republik.de/conferences/dlw-europe/speaker.php?language=de&quot;&gt;DLW-Europe&lt;/a&gt; einen Vortrag zum Thema: &amp;quot;Beyond MVC: Enterprise PHP Patterns&amp;quot; gehalten. Die sehr interessanten Slides stellt er auf seinem &lt;a href=&quot;http://www.priebsch.de/archives/49-DLWIPC-2008-Patterns-Praesentation.html&quot;&gt;Blog&lt;/a&gt; mittels Slideshare zur Verf&amp;uuml;gung:&lt;/p&gt; &lt;br /&gt;&lt;a href=&quot;http://webcode.lemme.at/archives/12-Enterprise-PHP-Patterns.html#extended&quot;&gt;&quot;Enterprise PHP Patterns&quot; vollständig lesen&lt;/a&gt;
    </content:encoded>

    <pubDate>Fri, 30 May 2008 10:10:18 +0200</pubDate>
    <guid isPermaLink="false">http://webcode.lemme.at/archives/12-guid.html</guid>
    <category>mvc</category>
<category>patterns</category>
<category>php</category>

</item>
<item>
    <title>MVC mit PHP - Ein neues Tutorial</title>
    <link>http://webcode.lemme.at/archives/9-MVC-mit-PHP-Ein-neues-Tutorial.html</link>
            <category>PHP</category>
    
    <comments>http://webcode.lemme.at/archives/9-MVC-mit-PHP-Ein-neues-Tutorial.html#comments</comments>
    <wfw:comment>http://webcode.lemme.at/wfwcomment.php?cid=9</wfw:comment>

    <slash:comments>36</slash:comments>
    <wfw:commentRss>http://webcode.lemme.at/rss.php?version=2.0&amp;type=comments&amp;cid=9</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Lemmé)</author>
    <content:encoded>
    
&lt;p&gt;Weil mich die Arbeit mit dem MVC-Joomla-Framework so fasziniert hat, habe ich ein &lt;a href=&quot;http://tutorials.lemme.at/mvc-mit-php/index.html&quot;&gt;MVC mit PHP-Tutorial&lt;/a&gt; geschrieben, dass beschreibt, wie man das MVC-Pattern ganz einfach mit PHP implementieren kann.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Feedback&lt;/strong&gt;, &lt;strong&gt;Fragen&lt;/strong&gt; und &lt;strong&gt;Diskussion&lt;/strong&gt; zu dem Tutorial ist hier in den Kommentaren möglich und erwünscht ;)&lt;br /&gt; &lt;/p&gt;&lt;p&gt; Natürlich habe ich mich von anderen Inspirieren lassen, vor allem von folgenden Blogs und Artikeln:&lt;/p&gt; &lt;ul&gt;   &lt;li&gt;&lt;a href=&quot;http://www.onlamp.com/pub/a/php/2005/09/15/mvc_intro.html&quot;&gt;Understanding MVC in PHP&lt;/a&gt;, von  &lt;a href=&quot;http://www.joestump.net/&quot;&gt;Joe Stump&lt;/a&gt; &lt;/li&gt;   &lt;li&gt;&lt;a href=&quot;http://blog.brati-network.de/blog-eintrag/MVC-Pattern-in-PHP-Aktueller-Stand--164.html&quot;&gt;MVC-Pattern in PHP&lt;/a&gt; von &lt;a href=&quot;http://blog.brati-network.de/&quot;&gt;Brati&lt;/a&gt; &lt;/li&gt;   &lt;li&gt;     &lt;a href=&quot;http://www.phpit.net/article/simple-mvc-php5/&quot;&gt;Building a simple MVC system with PHP5&lt;/a&gt; von   			Dennis Pallett auf &lt;a href=&quot;http://www.phpit.net&quot;&gt;PHPit.net&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;a href=&quot;http://tutorials.lemme.at/mvc-mit-php/index.html&quot;&gt; Hier gehts zum Tutorial&lt;/a&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 14 May 2008 20:59:52 +0200</pubDate>
    <guid isPermaLink="false">http://webcode.lemme.at/archives/9-guid.html</guid>
    <category>mvc</category>
<category>patterns</category>
<category>php</category>
<category>tutorial</category>

</item>
<item>
    <title>Joomla-Tipps</title>
    <link>http://webcode.lemme.at/archives/8-Joomla-Tipps.html</link>
            <category>Joomla</category>
            <category>PHP</category>
    
    <comments>http://webcode.lemme.at/archives/8-Joomla-Tipps.html#comments</comments>
    <wfw:comment>http://webcode.lemme.at/wfwcomment.php?cid=8</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://webcode.lemme.at/rss.php?version=2.0&amp;type=comments&amp;cid=8</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Lemmé)</author>
    <content:encoded>
    &lt;h5&gt;Sprache Herausfinden&lt;/h5&gt;&lt;p&gt;Oft ist es interessant, die Sprache des aktuellen Users festzustellen, etwa wenn man aus mehreren Sprachen ausw&amp;auml;hlen kann. Das geht ganz einfach mittels:&lt;/p&gt;&lt;pre&gt;$language = JFactory::getLanguage();&lt;/pre&gt;&lt;p&gt;&amp;#160;Nun bekommt man ein &lt;a href=&quot;http://api.joomla.org/Joomla-Framework/Language/JLanguage.html&quot;&gt;JLanguage&lt;/a&gt;-Objekt, durch den Aufruf der Methode &#039;getTag()&#039; erh&amp;auml;lt man das Sprachk&amp;uuml;rzel in der Form &#039;de-DE&#039;:&lt;/p&gt;&lt;pre&gt;$tag = $language-&amp;gt;getTag();&lt;/pre&gt;&lt;h5&gt;&amp;#160;Layout im Men&amp;uuml;-Maager verstecken / Layout (um)benennen&lt;br /&gt;&lt;/h5&gt;&lt;p&gt;Bei der Entwicklung von Komponenten ist es oft wichtig, im Men&amp;uuml;manager des Backends ein Layout einer View zu verstecken, oder dem Layout einen ansprechenderen Namen zu geben. &lt;/p&gt;&lt;p&gt;Dazu legt man in dem &#039;tmpl&#039;-Ordner der View ein neues XML-File an. Den Namen der Datei bestimmt der Name des Layouts. Ist das Layout-File beispielsweise &#039;show_item.php&#039;, muss die XML-Datei &#039;show_item.xml&#039; hei&amp;szlig;en. Um das Layout zu verstecken muss die XML-Datei nun folgenden Aufbau haben:&lt;/p&gt;&lt;pre&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt; &amp;lt;metadata&amp;gt;&lt;br /&gt;    &amp;lt;layout hidden=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt; &amp;lt;/metadata&amp;gt;&lt;/pre&gt;&lt;p&gt;&amp;#160;Um dem Layout einen ansprechenden Namen zu geben, muss sie folgenden Inhalt haben:&lt;/p&gt;&lt;pre&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;&amp;lt;metadata&amp;gt;&lt;br /&gt;	&amp;lt;layout title=&amp;quot;Alle Items anzeigen&amp;quot;&amp;gt;&amp;lt;/layout&amp;gt;&lt;br /&gt;&amp;lt;/metadata&amp;gt;&lt;/pre&gt; 
    </content:encoded>

    <pubDate>Mon, 12 May 2008 21:05:31 +0200</pubDate>
    <guid isPermaLink="false">http://webcode.lemme.at/archives/8-guid.html</guid>
    <category>joomla</category>
<category>php</category>
<category>tipps</category>

</item>
<item>
    <title>Komponenten für Joomla entwickeln</title>
    <link>http://webcode.lemme.at/archives/2-Komponenten-fuer-Joomla-entwickeln.html</link>
            <category>Joomla</category>
            <category>PHP</category>
    
    <comments>http://webcode.lemme.at/archives/2-Komponenten-fuer-Joomla-entwickeln.html#comments</comments>
    <wfw:comment>http://webcode.lemme.at/wfwcomment.php?cid=2</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://webcode.lemme.at/rss.php?version=2.0&amp;type=comments&amp;cid=2</wfw:commentRss>
    

    <author>nospam@example.com (Thomas Lemmé)</author>
    <content:encoded>
    &lt;p&gt;Es gibt eigentlich 2 gute Quellen bzw. Tutorials f&amp;uuml;r die Entwicklung von Komponenten f&amp;uuml;r Joomla 1.5: Das &lt;a href=&quot;http://joomla.addison-wesley.de/de/joomla-15&quot; title=&quot;Online Joomla Buch&quot;&gt;Online-Buch&lt;/a&gt; von Hagen Graf und die &lt;a href=&quot;http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,tutorials:components/&quot; title=&quot;Joomla Tutorials&quot;&gt;Joomla Tutorials&lt;/a&gt; (Englisch).&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 25 Apr 2008 06:37:56 +0200</pubDate>
    <guid isPermaLink="false">http://webcode.lemme.at/archives/2-guid.html</guid>
    <category>joomla</category>
<category>php</category>
<category>tipps</category>

</item>

</channel>
</rss>