<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CodeBlog.ch</title>
	<atom:link href="http://www.codeblog.ch/de/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codeblog.ch</link>
	<description>Coding and more - Concrete5, Flex, JavaScript</description>
	<lastBuildDate>Fri, 18 Jun 2010 08:05:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>de</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Linux Terminal im Web</title>
		<link>http://www.codeblog.ch/de/2010/02/linux-shell-in-a-browser/</link>
		<comments>http://www.codeblog.ch/de/2010/02/linux-shell-in-a-browser/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 12:37:43 +0000</pubDate>
		<dc:creator>Remo Laubacher</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.codeblog.ch/?p=440</guid>
		<description><![CDATA[Als *unix Administrator wird man SSH wohl kennen und lieben. Auch wenn man mit einem Windows Computer arbeiten muss, kann mit Tools wie Putty sehr einfach auf dem Linux Server gearbeitet werden. Es gibt allerdings Situationen wo auch das nicht funktioniert, weil das Netzwerk ausgehenden SSH Traffic nicht zulässt. Dies ist auch verständlich, könnte man [...]]]></description>
			<content:encoded><![CDATA[<p>Als *unix Administrator wird man SSH wohl kennen und lieben. Auch wenn man mit einem Windows Computer arbeiten muss, kann mit Tools wie <a href="http://putty.very.rulez.org/download.html">Putty</a> sehr einfach auf dem Linux Server gearbeitet werden. Es gibt allerdings Situationen wo auch das nicht funktioniert, weil das Netzwerk ausgehenden SSH Traffic nicht zulässt. Dies ist auch verständlich, könnte man mit SSH doch sehr einfach einen verschlüsselten Tunnel aufbauen und geheime Konten-Informationen klauen.</p>
<p>Es gibt jedoch einen Weg, mit dem man trotzdem auf den Linux Server zugreifen kann, ohne dabei die Möglichkeit zu haben, einen Tunnel zu erstellen. Das Tool das man dazu benötigt findet sich auf Google Code und nennt sich <a href="http://code.google.com/p/shellinabox/">shellinabox</a>.</p>
<p>Leute die wie ich mit Debian arbeiten, haben es besonders einfach:<br />
<code lang="bash">wget http://shellinabox.googlecode.com/files/shellinabox_2.10-1_i386.deb<br />
dpkg -i shellinabox_2.10-1_i386.deb</code></p>
<p>Damit wird automatisch eine Init Script erstellt welches man hier findet: /etc/init.d/shellinabox. Wurde dieses ausgeführt, lässt sich die Linux Shell via Browser hier erreichen: https://localhost:4200. Da allerdings auch der Port 4200 wohl meistens geblockt wird, wollen wir den Verkehr von HTTPS zu 4200 umleiten, indem wir mit Apache einen Reverse Proxy einrichten. Als erstes müssen wir sicherstellen, dass beim Apache die entsprechenden Module aktiv sind:</p>
<p><code lang="bash">/etc/apache2/mods-enabled<br />
ln -s ../mods-available/proxy.conf<br />
ln -s ../mods-available/proxy.load<br />
ln -s ../mods-available/proxy_http.load</code></p>
<p>Anschliessend die gewünschte Apache Seiten Konfiguration anpassen. In meinem Fall hab ich in /etc/apache2/sites-available/default-ssl die folgenden Zeilen eingefügt:<br />
<code lang="bash">&lt;Location /shell&gt;<br />
ProxyPass	http://localhost:4200/<br />
Order 	allow,deny<br />
Allow	from all<br />
&lt;/Location&gt;</code></p>
<p>Shellinabox arbeitet standardmässig mit HTTPS und kann von jeder IP Adresse angesprochen werden. Auch das ändern wir, indem wir in /etc/init.d/shellinabox SHELLINABOX_ARGS hinzufügen (nur die letzte Zeile in der folgenden Box):<br />
<code># Set some default values<br />
SHELLINABOX_DATADIR="${SHELLINABOX_DATADIR:-/var/lib/shellinabox}"<br />
SHELLINABOX_PORT="${SHELLINABOX_PORT:-4200}"<br />
SHELLINABOX_USER="${SHELLINABOX_USER:-shellinabox}"<br />
SHELLINABOX_GROUP="${SHELLINABOX_GROUP:-shellinabox}"<br />
SHELLINABOX_ARGS="--localhost-only --disable-ssl"</code></p>
<p>Nun alle Dienste neu starten: &#8220;/etc/init.d/shellinabox restart&#8221; und /etc/init.d/apache2 restart&#8221; &#8211; schon lässt sich die Shell via https://localhost/shell erreichen!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codeblog.ch/de/2010/02/linux-shell-in-a-browser/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Angepasste 404 Seite mit Concrete5</title>
		<link>http://www.codeblog.ch/de/2010/01/concrete5-custom-404-page/</link>
		<comments>http://www.codeblog.ch/de/2010/01/concrete5-custom-404-page/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 11:32:55 +0000</pubDate>
		<dc:creator>Remo Laubacher</dc:creator>
				<category><![CDATA[Concrete5]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.codeblog.ch/?p=425</guid>
		<description><![CDATA[Es sollte nicht oft vorkommen, aber manchmal landen Internetseiten Besucher auf einer nicht vorhandenen Seite. Oft wird dann eine simple Seite angezeigt mit dem Hinweis dass die Seite nicht verfügbar ist. Etwas mehr Informationen können da hilfreich sein. Besonders wenn eine Seite einem kompletten Redesign unterzogen wurde, kommt es vor, dass Google Besucher auf nicht [...]]]></description>
			<content:encoded><![CDATA[<p>Es sollte nicht oft vorkommen, aber manchmal landen Internetseiten Besucher auf einer nicht vorhandenen Seite. Oft wird dann eine simple Seite angezeigt mit dem Hinweis dass die Seite nicht verfügbar ist. Etwas mehr Informationen können da hilfreich sein. Besonders wenn eine Seite einem kompletten Redesign unterzogen wurde, kommt es vor, dass Google Besucher auf nicht vorhandene Seiten schickt. In diesem Tutorial geht es um die Anpassung der &#8220;Standard 404-Seite&#8221;. </p>
<p>Concrete5 erlaubt es, ohne grossen Aufwand die 404-Seite anzupassen. Allerdings gibt es ein paar Dinge die man kennen muss. Als Ausgangslage dient diese Seite &#8211; die Standard Concrete5 404-Seite:</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2010/01/pagenotfound.png"><img src="http://www.codeblog.ch/wp-content/uploads/2010/01/pagenotfound-300x194.png" alt="pagenotfound" title="pagenotfound" width="300" height="194" class="alignnone size-medium wp-image-426" /></a> </p>
<p><span id="more-425"></span></p>
<p>Wie man sieht, wird standardmässig das Concrete5 Dashboard Layout verwenden. Als erstes wollen wir unser eigenes Theme einsetzen. Dazu öffnen wir diese Datei: &#8220;config/site_theme_paths.php&#8221;. Es gibt bereits einige Beispiele welche auskommentiert sind, neu sollte die Datei jedoch folgendermassen aussehen:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>  
&nbsp;
<span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'C5_EXECUTE'</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span>_<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Access Denied.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$v</span> <span style="color: #339933;">=</span> View<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$v</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setThemeByPath</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/page_not_found'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;yourtheme&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* 
	you can override system layouts here  - but we're not going to by default 
&nbsp;
	For example: if you would like to theme your login page with the Green Salad theme,
	you would uncomment the lines below and change the second argument of setThemeByPath 
	to be the handle of the the Green Salad theme &quot;greensalad&quot; 
&nbsp;
$v = View::getInstance();
&nbsp;
$v-&gt;setThemeByPath('/login', &quot;yourtheme&quot;);
 // $v-&gt;setThemeByPath('/403', &quot;yourtheme&quot;);
 // $v-&gt;setThemeByPath('/register', &quot;yourtheme&quot;);
 // $v-&gt;setThemeByPath('/dashboard', &quot;yourtheme&quot;);
&nbsp;
*/</span></pre></td></tr></table></div>

<p>Zeile 5 und 6 definieren unser eigenes Theme. &#8220;yourtheme&#8221; muss natürlich mti dem Namen des eigenen Themes ersetzt werden. Der Name ist identisch mit dem Verzeichnisname des Themes welches sich im Ordner &#8220;themes&#8221; befindet.</p>
<p>Es ist wichtig, dass das Theme eine Datei mit dem Namen view.php für &#8220;Single Pages&#8221; hat. Sie kann ungewähr folgendermassen aussehen:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'C5_EXECUTE'</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span>_<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Access Denied.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">inc</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'elements/header.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;div id=&quot;content&quot;&gt;
&lt;div id=&quot;body&quot;&gt;
	   	&lt;!-- begin --&gt;
	   	<span style="color: #000000; font-weight: bold;">&lt;?php</span>
	   	<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$innerContent</span><span style="color: #339933;">;</span>
	   	<span style="color: #000000; font-weight: bold;">?&gt;</span>
	   	&lt;!-- end --&gt;&lt;/div&gt;
&lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">inc</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'elements/footer.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>$innerContent enthält alle Informationen und muss zwingend ausgegeben werden. </p>
<p>Nachdem site_theme_paths.php gespeichert wurde, sollte die 404-Seite unser Layout übernommen haben. In meinem Fall sieht das folgendermassen aus:</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2010/01/pagenotfound-custom.png"><img src="http://www.codeblog.ch/wp-content/uploads/2010/01/pagenotfound-custom-300x205.png" alt="pagenotfound-custom" title="pagenotfound-custom" width="300" height="205" class="alignnone size-medium wp-image-429" /></a></p>
<h2>Sitemap</h2>
<p>Machmal ist es hilfreich, wenn die 404-Seite die Seitenstruktur ausgibt. Auch das lässt sich relativ einfach umsetzen. Dazu muss von dieser Datei /concrete/single_pages/page_not_found.php hier eine Kopie erstellt werden /single_pages/page_not_found.php. Dadurch können wir den Inhalt der Datei anpassen, ohne im &#8220;Concrete5 Core&#8221; Änderungen vorzunehmen. Folgendes Beispiel zeigt den Code mit einer eingebauten Sitemap:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'C5_EXECUTE'</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span>_<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Access Denied.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;h1 class=&quot;error&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> t<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Page Not Found'</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h1&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> t<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No page could be found at this address.'</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_object</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Area<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Main&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$a</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$bt</span> <span style="color: #339933;">=</span> BlockType<span style="color: #339933;">::</span><span style="color: #004000;">getByHandle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'autonav'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$bt</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">controller</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">orderBy</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'display_asc'</span><span style="color: #339933;">;</span>                    
<span style="color: #000088;">$bt</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">controller</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">displayPages</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'top'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$bt</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">controller</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">displaySubPages</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'all'</span><span style="color: #339933;">;</span>     
<span style="color: #000088;">$bt</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">controller</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">displaySubPageLevels</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'all'</span><span style="color: #339933;">;</span>                    
<span style="color: #000088;">$bt</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'view'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>		
&nbsp;
&nbsp;
&nbsp;
&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> DIR_REL<span style="color: #000000; font-weight: bold;">?&gt;</span>/&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> t<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Back to Home'</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;.</pre></td></tr></table></div>

<p>Die Zeilen 13 bis 20 verwenden den Autonav Block um eine Sitemap auszugeben. Mehr braucht&#8217;s nicht! In meinem Fall sieht die Seite so aus:<br />
<a href="http://www.codeblog.ch/wp-content/uploads/2010/01/pagenotfound-sitemap.png"><img src="http://www.codeblog.ch/wp-content/uploads/2010/01/pagenotfound-sitemap-300x203.png" alt="pagenotfound-sitemap" title="pagenotfound-sitemap" width="300" height="203" class="alignnone size-medium wp-image-432" /></a></p>
<p>Etwas überflüssig in meinem Fall, je nach Struktur/Seite aber vielleicht ganz nützlich.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codeblog.ch/de/2010/01/concrete5-custom-404-page/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Bilder in der Navigation</title>
		<link>http://www.codeblog.ch/de/2009/12/image-navigation-items/</link>
		<comments>http://www.codeblog.ch/de/2009/12/image-navigation-items/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 09:01:59 +0000</pubDate>
		<dc:creator>Remo Laubacher</dc:creator>
				<category><![CDATA[Concrete5]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Autonav]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://www.codeblog.ch/?p=405</guid>
		<description><![CDATA[Concrete5 Navigation mit Bildern &#8211; der autonav Block erlaubt es sehr einfach und schnell eine hierarchische Seitenstruktur zur Navigation einzufügen. Sollen jedoch nicht Text-Links, sondern Bilder angeklickt werden, braucht es etwas mehr Arbeit.
In diesem Tutorial werde ich ein &#8220;Custom Template&#8221; für den autonav Block erstellen, welches ein Attribut von einer Seite ausliest um ein Bild [...]]]></description>
			<content:encoded><![CDATA[<p>Concrete5 Navigation mit Bildern &#8211; der autonav Block erlaubt es sehr einfach und schnell eine hierarchische Seitenstruktur zur Navigation einzufügen. Sollen jedoch nicht Text-Links, sondern Bilder angeklickt werden, braucht es etwas mehr Arbeit.</p>
<p>In diesem Tutorial werde ich ein &#8220;Custom Template&#8221; für den autonav Block erstellen, welches ein Attribut von einer Seite ausliest um ein Bild anstelle des Textes anzuzeigen.</p>
<p><span id="more-405"></span></p>
<h2>Seiten Attribute</h2>
<p>Mit Concrete5 können verschiedene Attribute einer Seite hinzugefügt werden. Damit kann man Meta-Tags, Notizen, Tags, Thumbnails oder eben auch Bilder für die Navigation verwalten. Als erstes müssen wir zwei neue Attribute erstellen. Eines wo wir das Bild auswählen können, wenn die Seite inaktiv ist und eines wenn die Seite aktiv ist.</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2009/12/1_page_attribute.png"><img src="http://www.codeblog.ch/wp-content/uploads/2009/12/1_page_attribute-300x174.png" alt="1_page_attribute" title="1_page_attribute" width="300" height="174" class="alignnone size-medium wp-image-406" /></a></p>
<p>Die roten Stellen sind entscheidend:</p>
<ul>
<li>Typ muss &#8220;Image/File&#8221; sein</li>
<li>Das &#8220;Handle&#8221; ist wichtig, wir benötigen es später im Template</li>
<li>Der Name ist nur informativ</li>
</ul>
<h2>Bilder zuweisen</h2>
<p>Wir haben nun zwei neue Attribute. Wie auf diesem Screenshot gezeigt, können wir dort Bilder zuweisen:</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2009/12/2_set_pictures.png"><img src="http://www.codeblog.ch/wp-content/uploads/2009/12/2_set_pictures-300x186.png" alt="2_set_pictures" title="2_set_pictures" width="300" height="186" class="alignnone size-medium wp-image-407" /></a></p>
<ul>
<li>In der &#8220;Sitemap&#8221; die gewünschte Seite suchen und &#8220;Properties&#8221; auswählen</li>
<li>Unter &#8220;Custom Fields&#8221; können wir nun die beiden Felder für diese Seite aktivieren</li>
<li>Nun die beiden Bilder für die Navigation auswählen</li>
</ul>
<p>Das Gleiche bitte nun für alle Seiten machen wo kein Text sondern ein Bild in der Navigation erscheinen soll. Dies ist übrigens etwas das auch ein End-User machen kann. Dank den Seiten-Attributen kann ein End-User sogar Navigationselemente mit grafischem Text selber hinzufügen.</p>
<h2>Custom Template für den Autonav Block</h2>
<p>Wer mit dem Stichwort &#8220;Custom Template&#8221; nichts anfangen kann, sollte vermutlich zuerst dieses Tutorial durchlesen: <a href="http://www.codeblog.ch/de/2009/03/concrete5-templates/">http://www.codeblog.ch/de/2009/03/concrete5-templates/</a>.</p>
<p>Um ein neues Custom Template für den Autonav Block anzulegen, können wir ganz einfach von dieser Datei /concrete/blocks/autonav/view.php eine Kopie hier ablegen: /blocks/autonav/templates/image_navigation.php. Die Verzeichnisse autonav und templates müssen vermutlich zuerst erstellt werden.</p>
<p>In Zeile 55 sollte dieser Code zu finden sein. Je nach Concrete5 Version kann sich das natürlich ändern.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCollectionID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$_c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCollectionID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
	<span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'
	&lt;li class=&quot;nav-selected nav-path-selected&quot;&gt;&lt;a class=&quot;nav-selected nav-path-selected&quot; href=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$pageLink</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$ni</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCollectionID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #000088;">$selectedPathCIDs</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
	<span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'
	&lt;li class=&quot;nav-path-selected&quot;&gt;&lt;a class=&quot;nav-path-selected&quot; href=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$pageLink</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$ni</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'
	&lt;li&gt;&lt;a href=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$pageLink</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$ni</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Mit etwas HTML und PHP Kenntnissen erkennen wir bereits wo der Link-Text ausgegeben wird. $ni->getName(). Dies ist auch die Stelle wo wir nun ein Bild, falls vorhanden, ausgeben wollen.</p>
<p>Wir ersetzen $ni->getName() also mit Variablen und prüfen vorgängig ob das Seiten-Attribut einen Wert hat und weisen anschliessend ein img-Tag zu.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$linkTextActive</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$ni</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$linkTextInactive</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$ni</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$picOn</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'pic_on'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$picOff</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'pic_off'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$picOn</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$linkTextActive</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;img src=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$picOn</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getURL</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; alt=&quot;'</span> <span style="color: #339933;">.</span> linkTextActive <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;/&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$picOff</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$linkTextInactive</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;img src=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$picOff</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getURL</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; alt=&quot;'</span> <span style="color: #339933;">.</span> linkTextInactive <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;/&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCollectionID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$_c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCollectionID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
	<span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'
	&lt;li class=&quot;nav-selected nav-path-selected&quot;&gt;&lt;a class=&quot;nav-selected nav-path-selected&quot; href=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$pageLink</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$linkTextActive</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCollectionID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #000088;">$selectedPathCIDs</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
	<span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'
	&lt;li class=&quot;nav-path-selected&quot;&gt;&lt;a class=&quot;nav-path-selected&quot; href=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$pageLink</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$linkTextActive</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'
	&lt;li&gt;&lt;a href=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$pageLink</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$linkTextInactive</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<ul>
<li>Line 1,2: Die neuen Variablen</li>
<li>Line 4,5: Attribut-Wert auslesen</li>
<li>Line 7-12: Prüft ob das Attribut einen Wert hat und generiert das img-Tag</li>
</ul>
<p>Jetzt kann ein autonav Block eingefügt werden, alle Einstellungen vornehmen und nachdem der Block hinzugefügt wurde, erneut anklicken und &#8220;Set Custom Template&#8221; wählen. Hier sollte nun unser neues Custom Template erscheinen.</p>
<p>Wenn alles funktioniert hat, sollte nun eine Navigation mit Bildern erscheinen:</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2009/12/example.png"><img src="http://www.codeblog.ch/wp-content/uploads/2009/12/example-300x165.png" alt="example" title="example" width="300" height="165" class="alignnone size-medium wp-image-417" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.codeblog.ch/de/2009/12/image-navigation-items/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Inhalt ein- und ausblenden &#8211; Block</title>
		<link>http://www.codeblog.ch/de/2009/10/expandcollapse-block/</link>
		<comments>http://www.codeblog.ch/de/2009/10/expandcollapse-block/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 20:40:11 +0000</pubDate>
		<dc:creator>Remo Laubacher</dc:creator>
				<category><![CDATA[Concrete5]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[collapse]]></category>
		<category><![CDATA[expand]]></category>
		<category><![CDATA[free]]></category>

		<guid isPermaLink="false">http://www.codeblog.ch/?p=383</guid>
		<description><![CDATA[Aufgrund von zeitlichen Einschränkungen ist es nun eine Weile her als ich etwas auf codeblog publiziert habe. Heute ist es kein Artikel, für Erklärungen hat&#8217;s leider nicht gerreicht. Dafür aber ein gratis Block für eure Internetseite.
Ein simpler Block im Inhalt anzuzeigen den man bei Bedarf aus- und wieder einblenden kann:


Dialog
Der folgende Screenshot zeigt den Dialog [...]]]></description>
			<content:encoded><![CDATA[<p>Aufgrund von zeitlichen Einschränkungen ist es nun eine Weile her als ich etwas auf codeblog publiziert habe. Heute ist es kein Artikel, für Erklärungen hat&#8217;s leider nicht gerreicht. Dafür aber ein gratis Block für eure Internetseite.</p>
<p>Ein simpler Block im Inhalt anzuzeigen den man bei Bedarf aus- und wieder einblenden kann:</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2009/10/expand.png"><img src="http://www.codeblog.ch/wp-content/uploads/2009/10/expand-300x159.png" alt="expand" title="expand" width="300" height="159" class="alignnone size-medium wp-image-395" /></a></p>
<p><span id="more-383"></span></p>
<h2>Dialog</h2>
<p>Der folgende Screenshot zeigt den Dialog wo sämtliche Informationen eingegeben werden können. Speziell ist, dass man bei diesem Block das Layout gleich in der Eingabemaske definieren kann.</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2009/10/dialog.png"><img src="http://www.codeblog.ch/wp-content/uploads/2009/10/dialog-300x274.png" alt="dialog" title="dialog" width="300" height="274" class="alignnone size-medium wp-image-384" /></a></p>
<h2>Erweiterungen</h2>
<p>Sollte jemand ein paar Pfeile/Layouts haben, bitte kontaktiert mich. Ich würde gerne ein paar Templates einbinden so dass der Block später im Concrete5 Marktplatz veröffentlich werden kann.</p>
<h2>Installation</h2>
<p><a href='http://www.codeblog.ch/wp-content/uploads/2009/10/remo_expand2.zip'>Block hier herunterladen</a>.</p>
<p>Die ZIP Datei in /blocks/ extrahieren. Sicherstellen dass der Ordner &#8220;remo_expand&#8221; vorhanden ist. Viel Spass!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codeblog.ch/de/2009/10/expandcollapse-block/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Concrete5 &#8211; Form styling</title>
		<link>http://www.codeblog.ch/de/2009/07/concrete5-form-layout/</link>
		<comments>http://www.codeblog.ch/de/2009/07/concrete5-form-layout/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 11:12:51 +0000</pubDate>
		<dc:creator>Remo Laubacher</dc:creator>
				<category><![CDATA[Concrete5]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://www.codeblog.ch/?p=368</guid>
		<description><![CDATA[Concrete5 bietet einen netten Form Block, mit dem man Formulare in wenigen Sekunden erstellen. Dies ohne HTML oder PHP Kenntnisse. Unglücklicherweise lässt sich der HTML Code davon, nur schlecht mit CSS anpassen. In diesem Tutorial zeige ich, wie man ein Formular in diesem Stil erstellen kann:


Custom Templates
Das Stichwort &#8220;Custom Templates&#8221; sollte bekannt sein, ansonsten bitte [...]]]></description>
			<content:encoded><![CDATA[<p>Concrete5 bietet einen netten Form Block, mit dem man Formulare in wenigen Sekunden erstellen. Dies ohne HTML oder PHP Kenntnisse. Unglücklicherweise lässt sich der HTML Code davon, nur schlecht mit CSS anpassen. In diesem Tutorial zeige ich, wie man ein Formular in diesem Stil erstellen kann:</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2009/07/pic2.png"><img src="http://www.codeblog.ch/wp-content/uploads/2009/07/pic2-300x257.png" alt="Styles Form" title="Styles Form" width="300" height="257" class="alignnone size-medium wp-image-370" /></a></p>
<p><span id="more-368"></span></p>
<h2>Custom Templates</h2>
<p>Das Stichwort &#8220;Custom Templates&#8221; sollte bekannt sein, ansonsten bitte zuerst diesen Artikel durchlesen: <a href="http://www.codeblog.ch/2009/03/concrete5-templates/">http://www.codeblog.ch/2009/03/concrete5-templates/</a>. Kurz zusammengefasst: Concrete5 erlaubt es, mittels &#8220;Custom Templates&#8221; sämtliche Blöcke in ihrem Erscheinungsbild anzupassen, falls mit CSS nicht genügend Möglichkeiten zur Verfügung stehen sollten.</p>
<h2>Core Änderungen</h2>
<p>Der Controller des Form Blocks hat eine kleine Unschönheit, welche das &#8220;stylen&#8221; mit CSS etwas erschwert. Da keine Funktionalität daran hängt, hab ich in diesem Fall den Code im &#8220;Core&#8221; direkt modifiziert. Ev. wird das in einer zukünftigen Version geändert. Es betrifft die Datei &#8220;concrete/blocks/form/controller.php&#8221; in der Zeile 667:</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2009/07/pic1.png"><img src="http://www.codeblog.ch/wp-content/uploads/2009/07/pic1-300x46.png" alt="pic1" title="pic1" width="300" height="46" class="alignnone size-medium wp-image-369" /></a></p>
<p>Die Anweisung &#8217;style=&#8221;width:95%&#8221;&#8216; ist zu entfernen.</p>
<h2>Das Standard Layout</h2>
<p>Wird ein Formular mit Concrete5 erstellt, sieht es standardmässig so aus:</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2009/07/pic3.png"><img src="http://www.codeblog.ch/wp-content/uploads/2009/07/pic3-300x167.png" alt="pic3" title="pic3" width="300" height="167" class="alignnone size-medium wp-image-371" /></a></p>
<p>Es funktioniert, sieht aber nicht wirklich hübsch aus.</p>
<h2>Das neue Layout</h2>
<p>In diesem Tutorial zeige ich, wie man ein Formular erstellen kann, bei dem die Labels nicht neben den Eingabefeldern stehen, sondern gleich im Feld. Dies kann besonders nützlich sein, wenn wenig Platz vorhanden ist, und ein grosses Formular einzufügen ist. Das PHP Template view.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>    
<span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'C5_EXECUTE'</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span>_<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Access Denied.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$survey</span><span style="color: #339933;">=</span><span style="color: #000088;">$controller</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$miniSurvey</span><span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> MiniSurvey<span style="color: #009900;">&#40;</span><span style="color: #000088;">$b</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$miniSurvey</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">frontEndMode</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;div class=&quot;ccm-form&quot; id=&quot;ccm-form-id-<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bID</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$invalidIP</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;div class=&quot;ccm-error&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$invalidIP</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;form enctype=&quot;multipart/form-data&quot; id=&quot;miniSurveyView<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bID</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; class=&quot;miniSurveyView&quot; method=&quot;post&quot; action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">action</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'submit_form'</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span>   <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'surveySuccess'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'qsid'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$survey</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">questionSetId</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;div id=&quot;msg&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$survey</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">thankyouMsg</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>   <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$formResponse</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;div id=&quot;msg&quot;&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$formResponse</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;?php</span>  
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$error</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'
&lt;div class=&quot;error&quot;&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$error</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/div&gt;
'</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;input name=&quot;qsID&quot; type=&quot;hidden&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span>  <span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$survey</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">questionSetId</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
	&lt;input name=&quot;pURI&quot; type=&quot;hidden&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span>  <span style="color: #000088;">$pURI</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span>   	
	<span style="color: #000088;">$questionsRS</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$miniSurvey</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadQuestions</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$survey</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">questionSetId</span><span style="color: #339933;">,</span> <span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$surveyBlockInfo</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$miniSurvey</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getMiniSurveyBlockInfoByQuestionId</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$survey</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">questionSetId</span><span style="color: #339933;">,</span><span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bID</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$showEdit</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$hideQIDs</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$questionRow</span><span style="color: #339933;">=</span><span style="color: #000088;">$questionsRS</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetchRow</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>	
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$questionRow</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'qID'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$hideQIDs</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$msqID</span><span style="color: #339933;">=</span><span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$questionRow</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'msqID'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$requiredClass</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$questionRow</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'required'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #0000ff;">' required '</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$requiredSymbol</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$questionRow</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'required'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #0000ff;">' *'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'
&lt;div class=&quot;ccm-form-element'</span><span style="color: #339933;">.</span><span style="color: #000088;">$requiredClass</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Question'</span><span style="color: #339933;">.</span><span style="color: #000088;">$msqID</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$questionRow</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'question'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$requiredSymbol</span><span style="color: #339933;">;</span>				
&nbsp;
		<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$miniSurvey</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadInputType</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$questionRow</span><span style="color: #339933;">,</span>showEdit<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/div&gt;
&quot;</span><span style="color: #339933;">;</span>	
	<span style="color: #009900;">&#125;</span>	
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$surveyBlockInfo</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'displayCaptcha'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>		
		<span style="color: #000088;">$captcha</span> <span style="color: #339933;">=</span> Loader<span style="color: #339933;">::</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'validation/captcha'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>				
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;
&lt;div class=<span style="color: #000099; font-weight: bold;">\&quot;</span>ccm-form-captcha<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'
&lt;div class=&quot;required&quot;&gt;'</span><span style="color: #339933;">;</span>		
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;input type=&quot;text&quot; value=&quot;Sicherheitscode hier eingeben&quot; name=&quot;ccmCaptchaCode&quot; class=&quot;ccm-input-captcha&quot;/&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// Please note that we need to style our captcha, we therefore create it manually!</span>
		<span style="color: #666666; font-style: italic;">//$captcha-&gt;showInput();</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/div&gt;
&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;
&lt;div&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$captcha</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/div&gt;
&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/div&gt;
&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'
&lt;div style=&quot;clear:both&quot;&gt;&lt;/div&gt;
'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;input class=&quot;formBlockSubmitButton button&quot; name=&quot;Submit&quot; type=&quot;submit&quot; value=&quot;senden&quot; /&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">?&gt;</span> 
&lt;/form&gt;&lt;/div&gt;</pre></td></tr></table></div>

<p>Ich werde nicht jede Zeile erklären, da dies etwas umfangreich wäre. Ich geh davon aus, dass PHP Kenntnisse vorhanden sind.<br />
Kurz aufgelistet, was geändert wurde:</p>
<ul>
<li>Einige Methoden vom Controller werden neu aus der View aufgerufen</li>
<li>Das Tabellen Layout durch DIV&#8217;s ersetzt</li>
<li>CSS Klassen eingefügt, welche für die JavaScript Checks verwendet werden</li>
<li>$_REQUEST angepasst, damit die Labels im &#8220;value&#8221; Attribute ausgegeben werden</li>
</ul>
<p>Nun haben wir ein Formular, bei dem die Labels in den Eingabefeldern ausgegeben werden. Wir müssen nun aber auch sicherstellen, dass diese vordefinierten Werte ersettz werden können, ansonsten kann es passieren, dass Formulare mit diesen Werten abgeschickt werden können.<br />
Dazu werden verschiedene Events geprüft:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">   $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.miniSurveyView input[type=text], textarea'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span>onEnterField<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.miniSurveyView input[type=text], textarea'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span>onEnterField<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.miniSurveyView input[type=text], textarea'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">blur</span><span style="color: #009900;">&#40;</span>onLeaveField<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Sobald ein Benutzer ein Feld aktiviert oder verlässt, werden diese Funktionen aufgerufen. Dort wird geprüft, ob der Wert zu ersetzen ist oder nicht:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> onEnterField<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">origLabel</span> <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
      <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">origLabel</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span><span style="color: #339933;">;</span>
   <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">origLabel</span> <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span> <span style="color: #339933;">||</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">origLabel</span> <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span><span style="color: #009900;">&#41;</span>
      <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
&nbsp;
	$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">prev</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.formError&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideUp</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">function</span> onLeaveField<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>	
   <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">origLabel</span> <span style="color: #339933;">!=</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
      <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">origLabel</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Zusätzlich kommen ein paar clientseitige Checks dazu, um dem Benutzer sofort einen Hinweis betreffend nicht ausgefüllten Feldern ausgeben zu können.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.miniSurveyView input[type=text], textarea'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span>onEnterField<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.miniSurveyView input[type=text], textarea'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span>onEnterField<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.miniSurveyView input[type=text], textarea'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">blur</span><span style="color: #009900;">&#40;</span>onLeaveField<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.miniSurveyView'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">submit</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> formErrors <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.formError'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">remove</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[type=text], textarea'</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'origLabel'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> undefined <span style="color: #339933;">||</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'origLabel'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hasClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;required&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				formErrors<span style="color: #339933;">++;</span>
				$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">before</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'
&lt;div class=&quot;formError&quot; id=&quot;formError'</span><span style="color: #339933;">+</span>formErrors<span style="color: #339933;">+</span><span style="color: #3366CC;">'&quot; style=&quot;height:18px;color:red;font-size:10px;display:none;&quot;&gt;Bitte Wert eingeben:&lt;/div&gt;
'</span><span style="color: #009900;">&#41;</span>
				$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#formError&quot;</span> <span style="color: #339933;">+</span> formErrors<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideDown</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">200</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>					
				<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>formErrors <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span>
			<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">else</span>
			<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Wir in einem Feld kein Wert eingegeben, wird ganz einfach oberhalb davon eine entsprechende Meldung ausgegeben.</p>
<p>Das Template enthält einige CSS Anweisungen, welche ich hier nicht weiter erkläre. Mit grundlegenden CSS Kenntnissen sind diese problemlos zu verstehen und können auch entsprechend angepasst/erweitert werden. Sämtliche Dateien finden sich in folgendem ZIP:</p>
<p><a href='http://www.codeblog.ch/wp-content/uploads/2009/07/codeblog.zip'>Template herunterladen</a></p>
<p>Den Inhalt der ZIP Datei ins Verzeichnis &#8220;blocks/form/templates&#8221; entpacken. Die Verzeichnisse &#8220;form&#8221; und &#8220;templates&#8221; müssen ev. vorgängig erstellt werden!<br />
Viel Spass!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codeblog.ch/de/2009/07/concrete5-form-layout/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Vorschau Text mit PHP</title>
		<link>http://www.codeblog.ch/de/2009/06/smart-text-trimming-with-php/</link>
		<comments>http://www.codeblog.ch/de/2009/06/smart-text-trimming-with-php/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 12:56:46 +0000</pubDate>
		<dc:creator>Remo Laubacher</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gd]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[trim]]></category>

		<guid isPermaLink="false">http://www.codeblog.ch/?p=353</guid>
		<description><![CDATA[Möchte man einen kurzen Vorschautext in PHP erstellen, der einen Anriss des effektiven Textes zeigt, so wird man wohl oft die einfachste Variante gewählt haben, und einfach nach einer Anzahl definierten Zeichen abgeschnitten haben. Dies generiert jedoch ein unschönes Ergebnis, wenn man eine proportionale Schrift verwendet. Sämtliche Text haben markant unterschiedliche Längen wie auf diesem [...]]]></description>
			<content:encoded><![CDATA[<p>Möchte man einen kurzen Vorschautext in PHP erstellen, der einen Anriss des effektiven Textes zeigt, so wird man wohl oft die einfachste Variante gewählt haben, und einfach nach einer Anzahl definierten Zeichen abgeschnitten haben. Dies generiert jedoch ein unschönes Ergebnis, wenn man eine proportionale Schrift verwendet. Sämtliche Text haben markant unterschiedliche Längen wie auf diesem Bild gezeigt wird:</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2009/06/text-trimming.png"><img src="http://www.codeblog.ch/wp-content/uploads/2009/06/text-trimming-300x255.png" alt="text-trimming" title="text-trimming" width="300" height="255" class="alignnone size-medium wp-image-354" /></a></p>
<p>Dieser Artikel zeigt einen einfachen Ansatz, diese Problematik etwas eleganter zu lösen!</p>
<p><span id="more-353"></span></p>
<h2>Textlänge messen</h2>
<p>PHP bietet verschiedene Methoden um die Länge eines Textes zu messen. Zum Beispiel die Methode <a target="_blank" href="http://ch2.php.net/manual/en/function.imagefontwidth.php">ImageFontWidth</a> welche die Länge der PHP internen Schriften einfach und gut messen kann. Möchte man ein einfaches Captcha erstellen, das die internen Schriften verwendet, ist diese Methode sicherlich eine gute Wahl.</p>
<p>Allerdings gibt&#8217;s noch eine andere Methode, welche die komplette &#8220;Bounding Box&#8221; errechnet. Sie lautet <a href="http://ch2.php.net/manual/en/function.imagettfbbox.php">imagettfbbox</a>. Der Rückgabe-Wert ist eine Array welches sämtliche Werte für die &#8220;Bounding Box&#8221; enthält.</h2>
<p>Die Methode</h2>
<p>Wie zu Beginn des Artikels gezeigt, wollte ich eine Methode die den Text kürzt und am Ende einen weiteren Text (in diesem Fall &#8220;&#8230;&#8221;) anhängt um zu zeigen, dass der Text nicht vollständig ist.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> trim_by_width<span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span><span style="color: #000088;">$width</span><span style="color: #339933;">,</span><span style="color: #000088;">$font_file</span><span style="color: #339933;">,</span><span style="color: #000088;">$font_size</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">7</span><span style="color: #339933;">,</span><span style="color: #000088;">$append_string</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'...'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$append_string_box</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagettfbbox</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$font_size</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #000088;">$font_file</span><span style="color: #339933;">,</span><span style="color: #000088;">$append_string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$append_string_width</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$append_string_box</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$str_len</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;=</span><span style="color: #000088;">$str_len</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$trimmed_text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$bounding_box</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagettfbbox</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$font_size</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #000088;">$font_file</span><span style="color: #339933;">,</span><span style="color: #000088;">$trimmed_text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$trimmed_text_width</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$bounding_box</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$trimmed_text_width</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$append_string_width</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$width</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$str_to_return</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$trimmed_text</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$trimmed_text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$trimmed_text_width</span> <span style="color: #339933;">!=</span> <span style="color: #000088;">$str_len</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$str_to_return</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$append_string</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000088;">$str_to_return</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$text</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$trimmed_text</span> <span style="color: #339933;">=</span> trim_by_width<span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #000088;">$width</span><span style="color: #339933;">,</span> <span style="color: #000088;">$font_file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$font_size</span><span style="color: #339933;">,</span> <span style="color: #000088;">$append_string</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'...'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>$text:<br />
<code>Der Text der zu kürzen </code></p>
<p>$width:<br />
<code>Die maximale Länge des Textes in Pixel!</code></p>
<p>$font_file:<br />
<code>Die True Type Schriftendatei</code></p>
<p>$font_size:<br />
<code>Die Schriftgrösse. Bitte beachten Sie, dass die Einheiten je nach GD Version anders sind. GD1 verwendet Pixel, GD2 hingegen Punkte./code></p>
<p>$append_string:<br />
<code>Ein optionaler String welcher bei gekürzten Texten angehängt wird. Standardmässig "..."</code></p>
<h2>Beispiel</h2>
<p>Sie können die Methode nach folgendem Schema aufrufen:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> trim_by_width<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'this is a long text'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">55</span><span style="color: #339933;">,</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/verdana.ttf'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Das Script geht davon aus, dass sich die Datei verdana.ttf im gleichen Verzeichnis wie das PHP Script befindet. Anschliessend wird der Text nach 55 Pixel gekürzt und ausgegeben.</p>
<p>Fertig!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codeblog.ch/de/2009/06/smart-text-trimming-with-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Concrete5 &#8211; mehr Speed mit eAccelerator</title>
		<link>http://www.codeblog.ch/de/2009/06/concrete5-speed-eaccelerator/</link>
		<comments>http://www.codeblog.ch/de/2009/06/concrete5-speed-eaccelerator/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 10:38:30 +0000</pubDate>
		<dc:creator>Remo Laubacher</dc:creator>
				<category><![CDATA[Concrete5]]></category>
		<category><![CDATA[eAccelerator]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.codeblog.ch/?p=342</guid>
		<description><![CDATA[UPDATE: Die aktuelle eAccelerator Version enthält kein PHP API mehr! Ich eAccelerator deshalb im Zusammenhang mit Concrete5 nicht mehr empfehlen. Die kommende Version 5.4 wird jedoch Unterstützung für APC und memcache haben!
Mehr Geschwindigkeit bei Concrete5? Stellen Sie sicher, dass eAccelerator läuft!
In diesem Tutorial erkläre ich, wie man eAccelerator auf einem Debian Server installiert um bei [...]]]></description>
			<content:encoded><![CDATA[<p>UPDATE: Die aktuelle eAccelerator Version enthält kein PHP API mehr! Ich eAccelerator deshalb im Zusammenhang mit Concrete5 nicht mehr empfehlen. Die kommende Version 5.4 wird jedoch Unterstützung für APC und memcache haben!</p>
<p>Mehr Geschwindigkeit bei Concrete5? Stellen Sie sicher, dass <a href="http://eaccelerator.net/" target="_blank">eAccelerator</a> läuft!</p>
<p>In diesem Tutorial erkläre ich, wie man eAccelerator auf einem Debian Server installiert um bei Concrete5 mehr Geschwindigkeit zu bekommen.</p>
<p><a href="http://eaccelerator.net"><img src="http://www.codeblog.ch/wp-content/uploads/2009/06/eaccelerator1.png" alt="eaccelerator1" title="eaccelerator1" width="247" height="33" class="alignnone size-full wp-image-344" /></a></p>
<p><span id="more-342"></span></p>
<h2>Bereits installiert?</h2>
<p>Eine Datei mit dem Namen info.php in einem per http zugänglichen Verzeichnis erstellen:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
   <span style="color: #990000;">phpinfo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Existiert das Wort &#8220;eAccelerator&#8221; in der Ausgabe, ist eAccelerator bereits aktiviert. Wenn nicht &#8211; weiterfahren..</p>
<h2>eAccelerator installieren</h2>
<p>Eine Konsole bzw. SSH Verbindung zum Server herstellen und folgende Befehle eingeben<br />
Open a console/ssh connection to your server and enter these commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>bart.eaccelerator.net<span style="color: #000000; font-weight: bold;">/</span>source<span style="color: #000000; font-weight: bold;">/</span>0.9.5.3<span style="color: #000000; font-weight: bold;">/</span>eaccelerator-0.9.5.3.tar.bz2
<span style="color: #c20cb9; font-weight: bold;">tar</span> xvfj eaccelerator-0.9.5.3.tar.bz2
<span style="color: #7a0874; font-weight: bold;">cd</span> eaccelerator-0.9.5.3
phpize
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--with-eaccelerator-shared-memory</span> <span style="color: #660033;">--with-php-config</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>php-config <span style="color: #660033;">--with-eaccelerator-userid</span>=www-data <span style="color: #660033;">--with-eaccelerator-content-caching</span> 
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>Eventuell prüfen ob 0.9.5.3 noch immer die aktuelle Version ist.</p>
<p>Prüfen Sie nach dem Ausführen der Befehle, ob irgendwelche Fehlermeldungen angezeigt wurden.</p>
<p>Wenn alles ohne Probleme ausgeführt wurde, ein Verzeichnis erstellen, wo eAccelerator die temporären Dateien ablegen kann:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>eaccelerator
<span style="color: #c20cb9; font-weight: bold;">chmod</span> 0777 <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>eaccelerator</pre></div></div>

<p>Nun erstellen wir die Konfigurations-Datei für eAccelerator. Mit vi oder einem beliebigen Editor die Datei erstellen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php5<span style="color: #000000; font-weight: bold;">/</span>conf.d<span style="color: #000000; font-weight: bold;">/</span>eaccelerator.ini</pre></div></div>

<p>Diesen Inhalt eingeben:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">extension</span> <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;eaccelerator.so&quot;</span>
eaccelerator.shm_size <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;16&quot;</span>
eaccelerator.cache_dir <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;/var/cache/eaccelerator&quot;</span>
eaccelerator.enable <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;1&quot;</span>
eaccelerator.optimizer <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;1&quot;</span>
eaccelerator.check_mtime <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;1&quot;</span>
eaccelerator.debug <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;0&quot;</span>
eaccelerator.filter <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;&quot;</span>
eaccelerator.shm_ttl <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;0&quot;</span>
eaccelerator.shm_max <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;0&quot;</span>
eaccelerator.shm_prune_period <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;0&quot;</span>
eaccelerator.shm_only <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;0&quot;</span>
eaccelerator.compress <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;1&quot;</span>
eaccelerator.compress_level <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;9&quot;</span></pre></div></div>

<p>Jetzt kann Apache neu gestartet werden:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

<p>Die info.php Seite nochmals öffnen und sicherstellen, dass das Wort eAccelerator nun gefunden wird. Ist dies der Fall, ins Verzeichnis &#8220;config&#8221; der Concrete5 Seite wechseln und in der Datei site.php diese Zeile einfügen:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'CACHE_LIBRARY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'eaccelerator'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Concrete5 öffnen!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codeblog.ch/de/2009/06/concrete5-speed-eaccelerator/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Concrete5 &#8211; Team Datenbank in Tabelle</title>
		<link>http://www.codeblog.ch/de/2009/06/concrete5-staff-table/</link>
		<comments>http://www.codeblog.ch/de/2009/06/concrete5-staff-table/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 10:53:30 +0000</pubDate>
		<dc:creator>Remo Laubacher</dc:creator>
				<category><![CDATA[Concrete5]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[columns]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[person]]></category>
		<category><![CDATA[staff]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://www.codeblog.ch/?p=334</guid>
		<description><![CDATA[In vielen Fällen soll eine Internetseite Elemente enthalten, die in zwei Spalten dargestellt werden sollen. In diesem Tutorial beschreibe ich einen sehr einfachen Block, um ein Bild einer Person anzuzeigen, so dass die Beschreibung rechts vom Bild dargestellt wird. 
Das Ergebnis schaut folgendermassen aus:


Tabellenlayouts
Ich werde hier nicht in die Details über Tabellen-Layouts eingehen. Nur ganz [...]]]></description>
			<content:encoded><![CDATA[<p>In vielen Fällen soll eine Internetseite Elemente enthalten, die in zwei Spalten dargestellt werden sollen. In diesem Tutorial beschreibe ich einen sehr einfachen Block, um ein Bild einer Person anzuzeigen, so dass die Beschreibung rechts vom Bild dargestellt wird. </p>
<p>Das Ergebnis schaut folgendermassen aus:</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2009/06/staff1.jpg"><img src="http://www.codeblog.ch/wp-content/uploads/2009/06/staff1-300x212.jpg" alt="staff1" title="staff1" width="300" height="212" class="alignnone size-medium wp-image-335" /></a></p>
<p><span id="more-334"></span></p>
<h2>Tabellenlayouts</h2>
<p>Ich werde hier nicht in die Details über Tabellen-Layouts eingehen. Nur ganz grundlegend &#8211; das Tag &#8220;table&#8221; sollte nicht für Layouts verwendet werden. Inzwischen ist div &#038; css der korrekte Weg.<br />
Concrete5 erlaubt es uns zwei editierbare Bereiche zu erstellen, womit wir quasi ein 2-spaltiges Layout hätten. Allerdings ergibt sich in unserem Fall das Problem, dass das Bild in der linken Spalte wäre, der Text in der rechten. Damit beide Elemente immer auf der gleichen Höhe beginnen, müssten wir eine fixe Höhe mitgeben, was in den meisten Fällen wohl nicht optimal ist.</p>
<p>Ich werde also eine Lösung beschreiben, die in einem einspaltigen Layout verwendet werden kann, und dabei keine html Tabellen verwendet.</p>
<h2>Der Personen Block</h2>
<p>Der Block enthält lediglich zwei Elemente. Ein Bild und ein Textfeld um eine Beschreibung einzugeben.</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2009/06/staff2.jpg"><img src="http://www.codeblog.ch/wp-content/uploads/2009/06/staff2-294x300.jpg" alt="staff2" title="staff2" width="294" height="300" class="alignnone size-medium wp-image-336" /></a></p>
<p>Die HTML Ausgabe sieht folgendermassen aus:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;ccm-person&quot;&gt;
   &lt;div class=&quot;ccm-person-image&quot;&gt;&lt;img src=&quot;http://myserver/remo.jpg&quot; alt=&quot;&quot;&gt;&lt;/div&gt;
   &lt;div class=&quot;ccm-person-description&quot;&gt;Lorem ipsum dolor sit ame.&lt;/div&gt;
   &lt;div style=&quot;clear:both&quot;&gt;&lt;/div&gt;
&lt;/div&gt;</pre></td></tr></table></div>

<p>Bitte beachten, dass ich am Ende eine &#8220;inline CSs-Anweisung&#8221; eingebaut habe. Dies wenn möglich durch eine Klasse aus dem gewählten Theme ersetzen. Ich hab hier lediglich zu Demonstrationszwecken kein ganzes Theme veröffentlicht, damit der Code kurz und lesbar bleibt.</p>
<p>Ohne weitere CSS-Anweisungen wird der Text unterhalb des Bildes dargestellt. Da wir aber ein zweispaltiges Layout haben wollen, fügen wir unsere CSS Datei aus dem Theme ein paar Zeilen hinzu:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.ccm-person-image</span> <span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">80px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.ccm-person-description</span> <span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">385px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>Dies muss unter Umständen dem Theme angepasst werden.<br />
Am besten einfach den Block herunterladen und loslegen!</p>
<p><a href='http://www.codeblog.ch/wp-content/uploads/2009/06/person.zip'>Block herunterladen</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.codeblog.ch/de/2009/06/concrete5-staff-table/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Concrete5 &#8211; CSS Funktionen [typography.css, anpassbare Themes]</title>
		<link>http://www.codeblog.ch/de/2009/05/concrete5-css-features/</link>
		<comments>http://www.codeblog.ch/de/2009/05/concrete5-css-features/#comments</comments>
		<pubDate>Sun, 03 May 2009 11:45:00 +0000</pubDate>
		<dc:creator>Remo Laubacher</dc:creator>
				<category><![CDATA[Concrete5]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[tinymce]]></category>

		<guid isPermaLink="false">http://www.codeblog.ch/?p=314</guid>
		<description><![CDATA[Wer ein Theme für Concrete5 erstellt hat, wird sich eventuell gefragt haben, wofür die zwei CSS Dateien main.css and typography.css. In diesem Tutorial zeige ich ein paar Möglichkeiten, die Concrete5 im Zusammenhang mit CSS bietet. Grundlegende Kenntnisse über das Erstellen von Themes sollten vorhanden sein, ansonsten wäre es hilfreich dieses Tutorial vorgängig zu lesen: http://www.codeblog.ch/2009/01/concrete5-theme-erstellen/


Voraussetzungen
In [...]]]></description>
			<content:encoded><![CDATA[<p>Wer ein Theme für Concrete5 erstellt hat, wird sich eventuell gefragt haben, wofür die zwei CSS Dateien main.css and typography.css. In diesem Tutorial zeige ich ein paar Möglichkeiten, die Concrete5 im Zusammenhang mit CSS bietet. Grundlegende Kenntnisse über das Erstellen von Themes sollten vorhanden sein, ansonsten wäre es hilfreich dieses Tutorial vorgängig zu lesen: <a href="http://www.codeblog.ch/de/2009/01/concrete5-theme-erstellen/">http://www.codeblog.ch/2009/01/concrete5-theme-erstellen/</a></p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2009/05/typo1.png"><img src="http://www.codeblog.ch/wp-content/uploads/2009/05/typo1-292x300.png" alt="typo1" title="typo1" width="292" height="300" class="alignnone size-medium wp-image-315" /></a></p>
<p><span id="more-314"></span></p>
<h2>Voraussetzungen</h2>
<p>In diesem Tutorial verwende ich ein Theme welches im Concrete5 <a href="http://www.concrete5.org/marketplace/">Marktplatz</a> zu finden ist, es heisst <a href="http://www.concrete5.org/marketplace/themes/dreamy">Dreamy</a> und wurde von <a href="http://www.kilohanadesign.com/">Scott</a> erstellt.</p>
<p>Ich habe aus Gründen der Übersichtlichkeit ein paar Elements entfernt!</p>
<h2>Das Seiten-Layout</h2>
<p>Die Testseite mit dem leicht modifizierten Theme sieht folgendermassen aus:</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2009/05/typo1.png"><img src="http://www.codeblog.ch/wp-content/uploads/2009/05/typo1-292x300.png" alt="typo1" title="typo1" width="292" height="300" class="alignnone size-medium wp-image-315" /></a></p>
<p>Die Farben der beiden Überschriften wurden von mir angepasst, sie sind nicht Teil des Standard-Themes.</p>
<p>Wird diese Seite nun bearbeitet, so sieht man folgendes:</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2009/05/typo2.png"><img src="http://www.codeblog.ch/wp-content/uploads/2009/05/typo2-300x240.png" alt="typo2" title="typo2" width="300" height="240" class="alignnone size-medium wp-image-316" /></a></p>
<p>Die Überschriften H1 und H2 sind schwarz. Wäre es nicht praktisch, wenn die Schrift-Elemente gleich formatiert wären? Dazu gibt es typography.css. Wir fügen ein paar Zeilen ein:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">h1 <span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#54bed4</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
h2 <span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#adc42c</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>Der WYSIWYG Editor sucht standardmässig eine Datei mit dem namen typography.css and integriert sie ebenfalls. Damit kann man dem Benutzer bereits beim Eingeben einen erste Eindruck vermitteln, wie der Text später aussehen wird.</p>
<p>Nachdem die zusätzlichen Angaben eingefügt wurden, sieht unser Editor folgendermassen aus:</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2009/05/typo3.png"><img src="http://www.codeblog.ch/wp-content/uploads/2009/05/typo3-300x237.png" alt="typo3" title="typo3" width="300" height="237" class="alignnone size-medium wp-image-317" /></a></p>
<p>Sollten die Änderungen nicht sofort sichtbar sein, muss ev. der Cache zuerst gelöscht werden!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codeblog.ch/de/2009/05/concrete5-css-features/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Concrete5 &#8211; Blöcke im Template</title>
		<link>http://www.codeblog.ch/de/2009/04/concrete5-blocks-within-templates/</link>
		<comments>http://www.codeblog.ch/de/2009/04/concrete5-blocks-within-templates/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 08:59:39 +0000</pubDate>
		<dc:creator>Remo Laubacher</dc:creator>
				<category><![CDATA[Concrete5]]></category>
		<category><![CDATA[Blocks]]></category>
		<category><![CDATA[Page Defaults]]></category>
		<category><![CDATA[Templates]]></category>

		<guid isPermaLink="false">http://www.codeblog.ch/?p=298</guid>
		<description><![CDATA[Concrete5 wird standardmässig mit verschiedenen &#8220;Blöcken&#8221; ausgeliefert, welche man auf seiner Seite mit wenigen Klicks einbauen kann. Manchmal möchte man aber einen Block auf sämtlichen Seiten anzeigen. Zum Beispiel eine Navigation. Wie macht man das?

Zwei Möglichkeiten! Mehr auf der nächsten Seite..

Page Defaults
Concrete5 kennt die sogenannten &#8220;Page Defaults&#8221;. Man findet sie im Dashboard:

Mit einem Klick auf [...]]]></description>
			<content:encoded><![CDATA[<p>Concrete5 wird standardmässig mit verschiedenen &#8220;Blöcken&#8221; ausgeliefert, welche man auf seiner Seite mit wenigen Klicks einbauen kann. Manchmal möchte man aber einen Block auf sämtlichen Seiten anzeigen. Zum Beispiel eine Navigation. Wie macht man das?</p>
<p><img src="http://www.codeblog.ch/wp-content/uploads/2009/04/block-in-template-300x206.png" alt="block-in-template" title="block-in-template" width="300" height="206" class="alignnone size-medium wp-image-301" /></p>
<p>Zwei Möglichkeiten! Mehr auf der nächsten Seite..</p>
<p><span id="more-298"></span></p>
<h2>Page Defaults</h2>
<p>Concrete5 kennt die sogenannten &#8220;Page Defaults&#8221;. Man findet sie im Dashboard:</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2009/04/page-defaults.png"><img src="http://www.codeblog.ch/wp-content/uploads/2009/04/page-defaults-300x190.png" alt="page-defaults" title="page-defaults" width="300" height="190" class="alignnone size-medium wp-image-299" /></a></p>
<p>Mit einem Klick auf &#8220;Defaults&#8221; wird der Seiten-Typ und nicht eine Seite bearbeitet. Jegliche Inhalt (Blöcke) der dort hinzugefügt wird, erscheint später auf jeder Seite die neu angelegt wird. Klick man im während dem Bearbeiten eines Seiten-Typs auf einen Block, erscheint folgendens Menü:</p>
<p><a href="http://www.codeblog.ch/wp-content/uploads/2009/04/setup-child-pages.png"><img src="http://www.codeblog.ch/wp-content/uploads/2009/04/setup-child-pages-300x197.png" alt="setup-child-pages" title="setup-child-pages" width="300" height="197" class="alignnone size-medium wp-image-300" /></a></p>
<p>Diese Funktion ist ganz praktisch, da sie es ermöglicht, die neuen Blöcke in der Seiten-Vorlage auf bereits vorhandenen Seiten zu verteilen. Es ist vermutlich einfacher, wenn die Blöcke in der Vorlage bereits vorhanden sind, bevor man die Seiten anlegt. Die Wahl steht einem aber frei!</p>
<p>Blöcke die per &#8220;Page Defaults&#8221; hinzugefügt werden, können später vom Benutzer auf jeder Seite bearbeitet werden, wenn man das erweiterte Berechtigungs Modell (advanced permission model) nicht aktiviert. Die erweiterten Berechtigungen sind gut, aber für manch kleine Seite zu komplex. Es gibt noch eine Alternative! Mehr auf dern nächsten Seite..</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codeblog.ch/de/2009/04/concrete5-blocks-within-templates/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
