<?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>Wanderwort by Roman Ernst &#187; Gemachtes</title>
	<atom:link href="http://wanderwort.de/category/gemachtes/feed/" rel="self" type="application/rss+xml" />
	<link>http://wanderwort.de</link>
	<description>Interkulturelle Wortkolletionen in Ruby, PHP, XHTML, CSS nah am Strom der Gesellschaft</description>
	<lastBuildDate>Mon, 14 Mar 2011 15:10:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Dynamic model based styles for Paperclip</title>
		<link>http://wanderwort.de/2010/10/29/dynamic-model-based-styles-for-paperclip-attachments/</link>
		<comments>http://wanderwort.de/2010/10/29/dynamic-model-based-styles-for-paperclip-attachments/#comments</comments>
		<pubDate>Fri, 29 Oct 2010 12:40:04 +0000</pubDate>
		<dc:creator>pex</dc:creator>
				<category><![CDATA[Gemachtes]]></category>

		<guid isPermaLink="false">http://wanderwort.de/?p=321</guid>
		<description><![CDATA[One might want to set up dynamic attachment dimensions (or other styles) when generating images with thoughtbot&#8217;s paperclip. Styles in paperclip are basically represented in the :styles hash of has_attached_file: class File has_attached_file&#40; :attachment, :styles =&#62; &#123; :thumb =&#62; &#34;100x100&#34; &#125; &#41; end Building a related size model in rails might look the following: class [...]]]></description>
			<content:encoded><![CDATA[<p>One might want to set up dynamic attachment dimensions (or other styles) when generating images with <a href="http://github.com/thoughtbot/paperclip">thoughtbot&#8217;s paperclip</a>. Styles in paperclip are basically represented in the <code>:styles</code> hash of <code>has_attached_file</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC00FF; font-weight:bold;">File</span>
  has_attached_file<span style="color:#006600; font-weight:bold;">&#40;</span>
    <span style="color:#ff3333; font-weight:bold;">:attachment</span>,
    <span style="color:#ff3333; font-weight:bold;">:styles</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:thumb</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;100x100&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Building a related size model in rails might look the following:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC00FF; font-weight:bold;">File</span> <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  has_many <span style="color:#ff3333; font-weight:bold;">:sizes</span>, <span style="color:#ff3333; font-weight:bold;">:class_name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;FileSize&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:dependent</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:destroy</span>
&nbsp;
  has_attached_file<span style="color:#006600; font-weight:bold;">&#40;</span>
    <span style="color:#ff3333; font-weight:bold;">:attachment</span>,
    <span style="color:#ff3333; font-weight:bold;">:styles</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#008000; font-style:italic;"># styles through FileSize model</span>
  <span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> styles
   <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">sizes</span>.<span style="color:#9900CC;">inject</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:thumb</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;100x100&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>sizes, size<span style="color:#006600; font-weight:bold;">|</span>
      sizes<span style="color:#006600; font-weight:bold;">&#91;</span>:<span style="color:#996600;">&quot;#{size.id}&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">&quot;#{size.width}x#{size.height}&quot;</span>; sizes
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> FileSize <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  belongs_to <span style="color:#ff3333; font-weight:bold;">:file</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Using a <strong>Proc</strong> we can fetch sizes from our <code>FileSize</code> model:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  has_attached_file<span style="color:#006600; font-weight:bold;">&#40;</span>
    <span style="color:#ff3333; font-weight:bold;">:attachment</span>,
    <span style="color:#ff3333; font-weight:bold;">:styles</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#CC0066; font-weight:bold;">Proc</span>.<span style="color:#9900CC;">new</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>clip<span style="color:#006600; font-weight:bold;">|</span> clip.<span style="color:#9900CC;">instance</span>.<span style="color:#9900CC;">styles</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p><code>Clip</code> is the Paperclip instance which holds an <code>instance</code>-method to get back to the calling Class.</p>
<p>As a last issue one might want to reprocess / regenerated images after creating or destroying sizes:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> FileSize <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  belongs_to <span style="color:#ff3333; font-weight:bold;">:file</span>
&nbsp;
  after_create  <span style="color:#ff3333; font-weight:bold;">:reprocess</span>
  after_destroy <span style="color:#ff3333; font-weight:bold;">:reprocess</span>
&nbsp;
  private
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> reprocess
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">file</span>.<span style="color:#9900CC;">attachment</span>.<span style="color:#9900CC;">reprocess</span>!
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://wanderwort.de/2010/10/29/dynamic-model-based-styles-for-paperclip-attachments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Iterate over Associative Arrays in Bash</title>
		<link>http://wanderwort.de/2010/06/24/iterate-over-assoziative-arrays-in-bash/</link>
		<comments>http://wanderwort.de/2010/06/24/iterate-over-assoziative-arrays-in-bash/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 19:59:23 +0000</pubDate>
		<dc:creator>pex</dc:creator>
				<category><![CDATA[Gemachtes]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Mac OS]]></category>

		<guid isPermaLink="false">http://wanderwort.de/?p=299</guid>
		<description><![CDATA[Probably because many people think Bash is outdated it&#8217;s that hard to find proper resources digging into this Shell. Now we&#8217;ll have a look at an associative array and use each key to rename a file defined in value one got via wget. Beware: Take a look at the OS X issues at the end [...]]]></description>
			<content:encoded><![CDATA[<p>Probably because many people think Bash is outdated it&#8217;s that hard to find proper resources digging into this Shell. Now we&#8217;ll have a look at an <a href="http://en.wikipedia.org/wiki/Associative_array">associative array</a> and use each <em>key</em> to rename a file defined in <em>value</em> one got via <a href="http://en.wikipedia.org/wiki/Wget">wget</a>.</p>
<p><b style="color: red">Beware</b>: Take a look at the OS X issues at the end of this article if working on a Mac!</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #7a0874; font-weight: bold;">unset</span> array; <span style="color: #7a0874; font-weight: bold;">declare</span> <span style="color: #660033;">-A</span> array <span style="color: #666666; font-style: italic;"># the -A attributes stands for associative</span>
&nbsp;
array<span style="color: #7a0874; font-weight: bold;">&#91;</span>foo<span style="color: #7a0874; font-weight: bold;">&#93;</span>=bar
array<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">&quot;spaced string&quot;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #ff0000;">&quot;foo bar&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #800000;">${!array[@]}</span>
<span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #666666; font-style: italic;"># do something</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>This is how an iteration could look like. Have a look at <a href="http://wiki.bash-hackers.org/syntax/arrays">bash-hackers.org</a> to get more information. Thanks to <a href="http://blog.denniswilliamson.us/">Dennis Williamson</a> solving <a href="http://stackoverflow.com/questions/3112687/how-to-iterate-over-assoziative-array-in-bash">this topic</a>.</p>
<p>To get a file from the given URL perform the following command in the loop:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${array[$i]}</span>&quot;</span> <span style="color: #660033;">-O</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${i}</span>.jpg&quot;</span></pre></div></div>

<p>The attribute <em>-O</em> renames the file.</p>
<p>Using variables outside Strings obviate the need for curly brackets so that $i would work as well.<br />
<b>Go on reading if you&#8217;re using a Mac:</b><br />
<span id="more-299"></span><br />
<b>Mac OS X Issues</b><br />
The given example and associative arrays in bash require a Bash version greater than 4.0. OS X (Leopard) gets shipped with version 3.2.48(1). So we either have to install a newer Bash Version manually <a href="http://concisionandconcinnity.blogspot.com/2009/03/upgrade-bash-to-40-in-mac-os-x.html">as described by Ian McCracken</a> or use a package installer like <a href="http://www.finkproject.org/">Fink</a>, <a href="http://www.macports.org/">MacPorts</a> or <a href="http://mxcl.github.com/homebrew/">Homebrew</a>. As I am a Homebrew fanboy, here&#8217;s how to brew it:</p>
<p><b>Installing Bash > 4.0 with Homebrew</b></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ brew <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #666666; font-style: italic;"># definitely gets a newer version than 4.0:</span>
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">&quot;echo /usr/local/Cellar/bash/%INSTALLED_VERSION%/bin/bash &gt;&gt; /private/etc/shells&quot;</span> <span style="color: #666666; font-style: italic;"># register the new Bash as a valid Shell</span>
$ <span style="color: #c20cb9; font-weight: bold;">chsh</span> <span style="color: #666666; font-style: italic;"># use the new Shell for your user</span></pre></div></div>

<p>In the chsh file you simply enter the path you&#8217;ve installed and registered the shell to.</p>
<p>You might also have to install wget because Mac OS comes without this handy tool as well:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ brew <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">wget</span></pre></div></div>

<p><b style="color: red">IMPORTANT:</b><br />
In your scripts you also have to define the new path of Bash! E.g:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/local/Cellar/bash/%INSTALLED_VERSION%/bin/bash</span>
&nbsp;
some_bash_code</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://wanderwort.de/2010/06/24/iterate-over-assoziative-arrays-in-bash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cross-Domain with Sinatra / Rack and JSONP</title>
		<link>http://wanderwort.de/2010/03/25/sinatra-rack-with-jsonp/</link>
		<comments>http://wanderwort.de/2010/03/25/sinatra-rack-with-jsonp/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 00:45:35 +0000</pubDate>
		<dc:creator>pex</dc:creator>
				<category><![CDATA[Gemachtes]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Rack]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Sinatra]]></category>

		<guid isPermaLink="false">http://wanderwort.de/?p=284</guid>
		<description><![CDATA[There are several situations one might want to do cross-domain (/cross-site) AJAX-requests. Probably you experience the security borders of modern browsers very fast. JSONP is a hack for JSON that provides a great workaround. It means sending a callback with the URL (eg. ?callback=sampleFunction). Server-sided we setup our application to respond with a JSON body [...]]]></description>
			<content:encoded><![CDATA[<p>There are several situations one might want to do cross-domain (/cross-site) <a href="http://de.wikipedia.org/wiki/Ajax_(Programmierung)">AJAX</a>-requests. Probably you experience the security borders of modern browsers very fast.<br />
<a href="http://en.wikipedia.org/wiki/JSONP#JSONP">JSONP</a> is a hack for <a href="http://www.json.org/">JSON</a> that provides a great workaround. It means sending a callback with the URL (eg. ?callback=sampleFunction). Server-sided we setup our application to respond with a JSON body wrapped in a function named like our callback function. In this case</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">sampleFunction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #3366CC;">&quot;ourData&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #3366CC;">&quot;title&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;is an array&quot;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;title&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;...&quot;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span>   
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<h3>What we have to do (Sample)</h3>
<p><b>Frontend</b><br />
JS-Frameworks like <a href="http://jquery.com/">jQuery</a> are smart enough to send such requests with ease. Lets write a simple function with jQuery:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
  type<span style="color: #339933;">:</span> <span style="color: #3366CC;">'get'</span><span style="color: #339933;">,</span>
  url<span style="color: #339933;">:</span> <span style="color: #3366CC;">'file.json'</span><span style="color: #339933;">,</span>
  dataType<span style="color: #339933;">:</span> <span style="color: #3366CC;">'jsonp'</span><span style="color: #339933;">,</span>
  success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    doSomethingWith<span style="color: #009900;">&#40;</span>data<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></pre></div></div>

<p><b>Let&#8217;s see how to setup the server:</b><br />
Using <a href="http://www.ruby-lang.org/en/">Ruby</a> and <a href="http://rack.rubyforge.org/">Rack</a> it becomes very simple to beautifully provide regular JSON for non-JSONP clients and JSONP for jQuery &#038; Co.<br />
Simply use the rack middleware <a href="http://github.com/rack/rack-contrib/">rack-contrib by Ryan Tomayko</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gem <span style="color: #c20cb9; font-weight: bold;">install</span> rack-rack-contrib <span style="color: #660033;">--source</span>=http:<span style="color: #000000; font-weight: bold;">//</span>gems.github.com<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>If you&#8217;re using pure rack, put this in your config.ru</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rack/contrib/jsonp'</span>
use <span style="color:#6666ff; font-weight:bold;">Rack::JSONP</span></pre></div></div>

<p>Using <a href="http://www.sinatrarb.com/">Sinatra</a>, I&#8217;d put it somewhere with my config files.<br />
Let&#8217;s see how a sample <a href="http://www.sinatrarb.com/">Sinatra</a> application could look like:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'sinatra'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'json'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rack/contrib/jsonp'</span>
&nbsp;
use <span style="color:#6666ff; font-weight:bold;">Rack::JSONP</span>
&nbsp;
before <span style="color:#9966CC; font-weight:bold;">do</span>
  content_type <span style="color:#ff3333; font-weight:bold;">:json</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
get <span style="color:#996600;">'/posts'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  Posts.<span style="color:#9900CC;">find</span>.<span style="color:#9900CC;">to_a</span>.<span style="color:#9900CC;">to_json</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>That simple, this powerful.</p>
]]></content:encoded>
			<wfw:commentRss>http://wanderwort.de/2010/03/25/sinatra-rack-with-jsonp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>InDesign: Sprache für ganzes Dokument ändern</title>
		<link>http://wanderwort.de/2010/03/08/indesign-sprache-fur-ganzes-dokument-andern/</link>
		<comments>http://wanderwort.de/2010/03/08/indesign-sprache-fur-ganzes-dokument-andern/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:37:57 +0000</pubDate>
		<dc:creator>pex</dc:creator>
				<category><![CDATA[Gemachtes]]></category>
		<category><![CDATA[Arbeit]]></category>
		<category><![CDATA[InDesign]]></category>

		<guid isPermaLink="false">http://wanderwort.de/?p=262</guid>
		<description><![CDATA[Es gibt zwei Möglichkeiten die Sprache für das Text- und Absatzformat in InDesign zu ändern. Wenn wir allerdings nicht für jedes Textfeld die Sprache ändern wollen, müssen wir uns eines Workarounds bedienen. Schließlich gibt es kein &#8220;Sprache für Dokument ändern&#8221;. Dann wollen wir mal: Wir gehen in unser Menü: Bearbeiten -> Suchen/Ersetzen (bzw. MacOS: ⌘+F, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="/2010/03/08/indesign-sprache-fur-ganzes-dokument-andern/"><img src="http://www.adobe.com/accessibility/products/indesign/images/indesign_cs4_150x150.jpg" alt="InDesign" style="float: left;margin: 0 10px 10px 0"/></a> Es gibt zwei Möglichkeiten die Sprache für das Text- und Absatzformat in InDesign zu ändern. Wenn wir allerdings nicht für jedes Textfeld die Sprache ändern wollen, müssen wir uns eines Workarounds bedienen. Schließlich gibt es kein &#8220;Sprache für Dokument ändern&#8221;. Dann wollen wir mal:<br />
<span id="more-262"></span>Wir gehen in unser Menü: Bearbeiten -> Suchen/Ersetzen<br />
(bzw. MacOS: ⌘+F, Windows: CTRL+F)</p>
<p><img src="http://wanderwort.de/wp-content/uploads/2010/03/4erweiterte-optionen.png" alt="" title="4erweiterte-optionen" width="569" height="448" class="alignnone size-full wp-image-263" /></p>
<p>Man bediene sich der erweiterten Suchoptionen und kommt so zur nächsten Ansicht:</p>
<p><img src="http://wanderwort.de/wp-content/uploads/2010/03/5sprache-auswaehlen2.png" alt="" title="5sprache-auswaehlen" width="600" height="343" class="alignnone size-full wp-image-271" /></p>
<p>Nun wählen wir für die Suchoption unsere zu ersetzende Sprache aus, die im Dokument geführt wird. Die Auswahl wird mit OK bestätigt und im nächsten Schritt geben wir für das Ersetzen die Zielsprache auf die gleiche Weise ein. Wenn alles richtig lief, sieht das Suchen/Ersetzen-Fenster nun so aus:</p>
<p><img src="http://wanderwort.de/wp-content/uploads/2010/03/6optionen-ausgefuellt.png" alt="" title="6optionen-ausgefuellt" width="569" height="448" class="alignnone size-full wp-image-265" /></p>
<p>Wunderbar. Um das ganze Dokument zu ändern, muss bei &#8220;Durchsuchen&#8221; auch &#8220;Dokument&#8221; eingestellt sein!<br />
Mit &#8220;Alle ändern&#8221; stellen wir nun unser Dokument auf die neue Sprache um. </p>
<p>In allen Textfelder sollte nun, wenn wir das Textwerkzeug (T) benutzen, in den Optionen die neue Sprache erscheinen:</p>
<p><img src="http://wanderwort.de/wp-content/uploads/2010/03/2sprachauswahl.png" alt="" title="2sprachauswahl" width="600" height="45" class="alignnone size-full wp-image-275" /></p>
]]></content:encoded>
			<wfw:commentRss>http://wanderwort.de/2010/03/08/indesign-sprache-fur-ganzes-dokument-andern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cheatsheet: moving data from one server to another</title>
		<link>http://wanderwort.de/2010/01/20/moving-data-from-one-server-to-another/</link>
		<comments>http://wanderwort.de/2010/01/20/moving-data-from-one-server-to-another/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 06:00:11 +0000</pubDate>
		<dc:creator>pex</dc:creator>
				<category><![CDATA[Gemachtes]]></category>
		<category><![CDATA[Arbeit]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://wanderwort.de/?p=217</guid>
		<description><![CDATA[This article is about moving a running web-environment along with it&#8217;s MySQL database from one server to another via SSH. Compress files Let&#8217;s compress the directory we&#8217;re going to move using gzip: tar cfvz backup.tar.gz /path/ Dump MySQL database content mysqldump -uUser -p -hlocalhost database_name &#62; dump.sql You can also dump several databases with mysqldump [...]]]></description>
			<content:encoded><![CDATA[<p>This article is about moving a running web-environment along with it&#8217;s <a href="http://en.wikipedia.org/wiki/MySQL">MySQL</a> database from one server to another via <a href="http://en.wikipedia.org/wiki/Secure_Shell">SSH</a>.</p>
<h3>Compress files</h3>
<p>Let&#8217;s compress the directory we&#8217;re going to move using <a href="http://en.wikipedia.org/wiki/Gzip">gzip</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> cfvz backup.tar.gz <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

</p>
<h3>Dump MySQL database content</h3>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysqldump <span style="color: #660033;">-uUser</span> <span style="color: #660033;">-p</span> <span style="color: #660033;">-hlocalhost</span> database_name <span style="color: #000000; font-weight: bold;">&gt;</span> dump.sql</pre></div></div>

<p>You can also dump several databases with <a href="http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html">mysqldump</a> by addind the <code>--databases</code> or <code>--all-databases</code> parameter.</p>
<h3>Moving files</h3>
<p>Now we use <a href="http://en.wikipedia.org/wiki/Secure_Copy">SCP</a> to move files to our new machine. The following example copies from the old machine:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">scp</span> user<span style="color: #000000; font-weight: bold;">@</span>host:<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>backup.tar.gz .</pre></div></div>

<p>The other way round, copying the file to the new machine from the old one would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">scp</span> backup.tar.gz user<span style="color: #000000; font-weight: bold;">@</span>host:<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>backup.tar.gz</pre></div></div>

<p>Do the same with your database dump.
</p>
<h3>Uncompress files</h3>
<p>Simply type:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> xfvz backup.tar.gz</pre></div></div>

<p>Now we should have the same directory structure we had on our old machine.</p>
<h3>Import MySQL database</h3>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-uUser</span> <span style="color: #660033;">--default-character-set</span>=utf8 <span style="color: #660033;">-hlocalhost</span> <span style="color: #660033;">-p</span> database_name <span style="color: #000000; font-weight: bold;">&lt;</span> dump.sql</pre></div></div>

<p>If you have international content and an utf-8 environment running don&#8217;t forget to pass the charset-parameter!</p>
]]></content:encoded>
			<wfw:commentRss>http://wanderwort.de/2010/01/20/moving-data-from-one-server-to-another/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hamburger Hafen im Winter</title>
		<link>http://wanderwort.de/2010/01/12/204/</link>
		<comments>http://wanderwort.de/2010/01/12/204/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 16:42:36 +0000</pubDate>
		<dc:creator>pex</dc:creator>
				<category><![CDATA[Gemachtes]]></category>
		<category><![CDATA[Hafen]]></category>
		<category><![CDATA[Hamburg]]></category>

		<guid isPermaLink="false">http://wanderwort.de/?p=204</guid>
		<description><![CDATA[Passend zum Schneechaos in Norddeutschland ein paar Eindrücke aus dem Hamburger Hafen im Winter. Ich habe noch nichts nachbearbeitet &#8211; also seht ihr Rohmaterial aus der Kamera.]]></description>
			<content:encoded><![CDATA[<p>Passend zum Schneechaos in Norddeutschland ein paar Eindrücke aus dem Hamburger Hafen im Winter. Ich habe noch nichts nachbearbeitet &#8211; also seht ihr Rohmaterial aus der Kamera.</p>
<p><a href="http://wanderwort.de/wp-content/uploads/2010/01/DSC_0158.jpg"><img src="http://wanderwort.de/wp-content/uploads/2010/01/DSC_0158-1024x680.jpg" alt="Eisbrecher Hamburg" title="Eisbrecher Hamburg" width="450" height="298" class="aligncenter size-large wp-image-200" /></a></p>
<p><span id="more-204"></span><br />
<a href="http://wanderwort.de/wp-content/uploads/2010/01/DSC_0142.jpg"><img src="http://wanderwort.de/wp-content/uploads/2010/01/DSC_0142-1024x680.jpg" alt="Eisbrecher Elbe" title="Eisbrecher Elbe" width="450" height="298" class="aligncenter size-large wp-image-199" /></a></p>
<p><a href="http://wanderwort.de/wp-content/uploads/2010/01/DSC_0135.jpg"><img src="http://wanderwort.de/wp-content/uploads/2010/01/DSC_0135-1024x680.jpg" alt="Eisbrecher Elbe" title="Eisbrecher Elbe" width="450" height="298" class="aligncenter size-large wp-image-198" /></a></p>
<p><a href="http://wanderwort.de/wp-content/uploads/2010/01/DSC_0175.jpg"><img src="http://wanderwort.de/wp-content/uploads/2010/01/DSC_0175-1024x680.jpg" alt="Eisbrecher Bugsier" title="Eisbrecher Bugsier" width="450" height="298" class="aligncenter size-large wp-image-201" /></a></p>
<p><a href="http://wanderwort.de/wp-content/uploads/2010/01/DSC_0219.jpg"><img src="http://wanderwort.de/wp-content/uploads/2010/01/DSC_0219-1024x680.jpg" alt="Hamburg Hafenfähre" title="Hamburg Hafenfähre" width="450" height="298" class="aligncenter size-large wp-image-203" /></a></p>
<p><a href="http://wanderwort.de/wp-content/uploads/2010/01/DSC_0128.jpg"><img src="http://wanderwort.de/wp-content/uploads/2010/01/DSC_0128-1024x680.jpg" alt="Hafen Hamburg" title="Hafen Hamburg" width="450" height="298" class="aligncenter size-large wp-image-197" /></a></p>
<p><a href="http://wanderwort.de/wp-content/uploads/2010/01/DSC_0110.jpg"><img src="http://wanderwort.de/wp-content/uploads/2010/01/DSC_0110-1024x680.jpg" alt="Wir sind geboren um frei zu sein" title="Wir sind geboren um frei zu sein" width="450" height="298" class=" aligncenter size-large wp-image-196" /></a></p>
<p><a href="http://wanderwort.de/wp-content/uploads/2010/01/DSC_0186.jpg"><img src="http://wanderwort.de/wp-content/uploads/2010/01/DSC_0186-1024x680.jpg" alt="im Hafen" title="im Hafen" width="450" height="298" class="aligncenter size-large wp-image-202" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://wanderwort.de/2010/01/12/204/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>select any HTML text in element with jQuery</title>
		<link>http://wanderwort.de/2009/11/19/select-any-html-text-in-element-with-jquery/</link>
		<comments>http://wanderwort.de/2009/11/19/select-any-html-text-in-element-with-jquery/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 15:25:44 +0000</pubDate>
		<dc:creator>pex</dc:creator>
				<category><![CDATA[Gemachtes]]></category>
		<category><![CDATA[Arbeit]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://wanderwort.de/?p=170</guid>
		<description><![CDATA[The following script jQuery extension selects any text from a given jQuery selector. Tested with Firefox and Safari &#8211; should work in IE6+ as well. jQuery.fn.extend&#40;&#123; selectText: function&#40;&#41; &#123; var text = $&#40;this&#41;&#91;0&#93;; if &#40;$.browser.msie&#41; &#123; var range = document.body.createTextRange&#40;&#41;; range.moveToElementText&#40;text&#41;; range.select&#40;&#41;; &#125; else if &#40;$.browser.mozilla &#124;&#124; $.browser.opera&#41; &#123; var selection = window.getSelection&#40;&#41;; var range [...]]]></description>
			<content:encoded><![CDATA[<p>The following <del datetime="2009-11-19T15:26:12+00:00">script</del> <ins datetime="2009-11-19T15:26:37+00:00">jQuery extension</ins> selects any text from a given jQuery selector. Tested with Firefox and Safari &#8211; should work in IE6+ as well.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery.<span style="color: #660066;">fn</span>.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
  selectText<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: #003366; font-weight: bold;">var</span> text <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: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">browser</span>.<span style="color: #660066;">msie</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #003366; font-weight: bold;">var</span> range <span style="color: #339933;">=</span> document.<span style="color: #660066;">body</span>.<span style="color: #660066;">createTextRange</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      range.<span style="color: #660066;">moveToElementText</span><span style="color: #009900;">&#40;</span>text<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      range.<span style="color: #660066;">select</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: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">browser</span>.<span style="color: #660066;">mozilla</span> <span style="color: #339933;">||</span> $.<span style="color: #660066;">browser</span>.<span style="color: #660066;">opera</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #003366; font-weight: bold;">var</span> selection <span style="color: #339933;">=</span> window.<span style="color: #660066;">getSelection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #003366; font-weight: bold;">var</span> range <span style="color: #339933;">=</span> document.<span style="color: #660066;">createRange</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      range.<span style="color: #660066;">selectNodeContents</span><span style="color: #009900;">&#40;</span>text<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      selection.<span style="color: #660066;">removeAllRanges</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      selection.<span style="color: #660066;">addRange</span><span style="color: #009900;">&#40;</span>range<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">browser</span>.<span style="color: #660066;">safari</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #003366; font-weight: bold;">var</span> selection <span style="color: #339933;">=</span> window.<span style="color: #660066;">getSelection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      selection.<span style="color: #660066;">setBaseAndExtent</span><span style="color: #009900;">&#40;</span>text<span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> text<span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000066; font-weight: bold;">return</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: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>To use it simly do:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> shortSelector <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#name'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">selectText</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> longSelector <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ul#names li:contains(&quot;Hampel&quot;)'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">selectText</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>written on top of <a href="http://stackoverflow.com/questions/985272/jquery-selecting-text-in-an-element-akin-to-highlighting-with-your-mouse">Source</a> and <a href="http://www.codingforums.com/archive/index.php/t-105808.html">Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wanderwort.de/2009/11/19/select-any-html-text-in-element-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML to PDF Library for PHP 5</title>
		<link>http://wanderwort.de/2009/07/08/html-to-pdf-library-for-php-5/</link>
		<comments>http://wanderwort.de/2009/07/08/html-to-pdf-library-for-php-5/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 19:06:14 +0000</pubDate>
		<dc:creator>pex</dc:creator>
				<category><![CDATA[Gemachtes]]></category>
		<category><![CDATA[Arbeit]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://wanderwort.de/?p=138</guid>
		<description><![CDATA[As I had to build a simple html to pdf converting for a client using php, I found a beautiful library called DOMPDF written by Benj Carson. It seemed to be very lightweight and uncomplicated, which turned out to be true. In a standard case it really is as simple as $pdf-&#62;load_html&#40;$html&#41;; I am going [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wanderwort.de/2009/07/08/html-to-pdf-library-for-php-5/"><img src="http://wanderwort.de/wp-content/uploads/2009/07/dompdf_simple.png" alt="DomPDF HTML to PDF" title="dompdf_simple" width="200" height="76" class="size-full wp-image-146" style="float: left; margin: 0 15px 5px 0" /></a> As I had to build a simple html to pdf converting for a client using php, I found a <a href="http://www.digitaljunkies.ca/dompdf/">beautiful library called DOMPDF</a> written by Benj Carson.</p>
<p>It seemed to be very lightweight and uncomplicated, which turned out to be true. In a standard case it really is as simple as</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load_html</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$html</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>I am going to talk about the basic usage and problems I had to solve, specially with umlauts / non latin characters.<br />
<span id="more-138"></span></p>
<h3>Basic Usage</h3>
<p>To initiate an environment you just create a new instance of the given class.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#path-to-your-installation#/dompdf/dompdf_config.inc.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load_html</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#some-html#'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">stream</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'some-file.pdf'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Further information about the basic usage of the class can be found on the <a href="http://www.digitaljunkies.ca/dompdf/usage.php">project page</a>. I am only using it inline PHP.</p>
<h3>Convert your CSS styled HTML</h3>
<p>Now you have to feed the method load_html with some html. Therefore we build a whole, simple page including as stylesheet (css). One of the most important things about this class is, that you simply link to a css file and dompdf parses and uses it to style your pdf.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;some-css.css&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Your Content<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<p>Please notice that dompdf neither supports absolute positioning nor floating. Therefor we have to use backgound-image-position to position images. Remember not to use the short-form &#8220;background&#8221; as this isn&#8217;t supported neither.</p>
<h3>Fixing White-Spaces</h3>
<p>I had the problem of wrong white-spaces respectively line-breaks because I had to convert a german document. tommylacroix found <a href="http://www.dashinteractive.net/dompdf/index.php?v=3153736">a solution</a> that worked perfectly for me.<br />
You have to go into your text_frame_decorator.cls.php around line 127 and replace</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">function</span> split_text<span style="color: #009900;">&#40;</span><span style="color: #000088;">$offset</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: #000088;">$offset</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span>
      <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$split</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_frame<span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_node</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">splitText</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$offset</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$deco</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">copy</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$split</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>by</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">function</span> split_text<span style="color: #009900;">&#40;</span><span style="color: #000088;">$offset</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: #000088;">$offset</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span>
      <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_frame<span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_node</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$split</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_frame<span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_node</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">splitText</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$offset</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_frame<span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_node</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mb_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;">$offset</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$split</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">nodeValue</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mb_substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span><span style="color: #000088;">$offset</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$deco</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">copy</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$split</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>Using inline PHP embedded in HTML</h3>
<p>Last but not least there are several more options to manipulate the rendered pdf file. By adding some inline php code in your html we can manage to display page numbers, a header or footer, watermarks, etc.</p>
<p>To add page numbers to your pdf, we add the following code to our html:<br/> (I explained the usage in comments)</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/php&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pdf</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">## Setup a tiny configuration ##
</span>      <span style="color: #000088;">$text_height</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">17</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$text_size</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$font</span> <span style="color: #339933;">=</span> Font_Metrics<span style="color: #339933;">::</span><span style="color: #004000;">get_font</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;helvetica&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;normal&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">## Get the dimensions of our pdf-file ##
</span>      <span style="color: #000088;">$dimensions</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;width&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;height&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">## The Counter-Text with variables: ##
</span>      <span style="color: #000088;">$pageCounterText</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Page: {PAGE_NUM} of {PAGE_COUNT}&quot;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">## If you want to position the Counter on the right, you need the text-width: ##
</span>      <span style="color: #000088;">$pageCounterWidth</span> <span style="color: #339933;">=</span> Font_Metrics<span style="color: #339933;">::</span><span style="color: #004000;">get_text_width</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pageCounterText</span><span style="color: #339933;">,</span> <span style="color: #000088;">$font</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text_size</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">## Not we can add this to our pdf:
</span>      <span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">page_text</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$dimensions</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;height&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-</span><span style="color: #000088;">$text_height</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pageCounterText</span><span style="color: #339933;">,</span> <span style="color: #000088;">$font</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text_size</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></pre></div></div>

<p>The page_text method works like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  page_text<span style="color: #009900;">&#40;</span>float <span style="color: #000088;">$x</span><span style="color: #339933;">,</span> float <span style="color: #000088;">$y</span><span style="color: #339933;">,</span> string <span style="color: #000088;">$text</span><span style="color: #339933;">,</span> string <span style="color: #000088;">$font</span><span style="color: #339933;">,</span> float <span style="color: #000088;">$size</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span> <span style="color: #000088;">$color</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">## Explanation: ##
</span>    <span style="color: #000088;">$x</span><span style="color: #339933;">:</span> Position from the top
    <span style="color: #000088;">$y</span><span style="color: #339933;">:</span> Position from the left
    <span style="color: #000088;">$size</span><span style="color: #339933;">:</span> Font<span style="color: #339933;">-</span>Size
    <span style="color: #000088;">$color</span><span style="color: #339933;">:</span> an rgb<span style="color: #339933;">-</span><span style="color: #990000;">array</span> <span style="color: #339933;">-&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>R<span style="color: #339933;">,</span> G<span style="color: #339933;">,</span> B<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#40;</span>optional<span style="color: #009900;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://wanderwort.de/2009/07/08/html-to-pdf-library-for-php-5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bankenrückblick, Giroüberblick</title>
		<link>http://wanderwort.de/2009/06/18/bankenruckblick-girouberblick/</link>
		<comments>http://wanderwort.de/2009/06/18/bankenruckblick-girouberblick/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 10:22:12 +0000</pubDate>
		<dc:creator>pex</dc:creator>
				<category><![CDATA[Gemachtes]]></category>
		<category><![CDATA[Gemischtes]]></category>
		<category><![CDATA[Banken]]></category>
		<category><![CDATA[Finanzen]]></category>
		<category><![CDATA[Giro]]></category>

		<guid isPermaLink="false">http://wanderwort.de/?p=107</guid>
		<description><![CDATA[Nachdem ich mich nun seit einem Jahr mit den verschiedenen Banken auseinandersetzte und seit Amerika auch den Auslandseinsatz beurteilen kann, möchte ich die Erfahrungen nicht für mich behalten: norisbank .. hat als 100% Tochter der Deutschen Bank auf ganzer Linie versagt. Die Erreichbarkeit der Filialbank mit Direktbank Konditionen ist lächerlich. Man wartet ca. 2 Monate [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://wanderwort.de/wp-content/uploads/2009/06/money_tree.jpg" alt="Geldbaum" title="Geldbaum" width="200" height="215" class="size-full wp-image-108" style="float: left; margin: 0 5px 5px 0;" /> Nachdem ich mich nun seit einem Jahr mit den verschiedenen Banken auseinandersetzte und seit Amerika auch den Auslandseinsatz beurteilen kann, möchte ich die Erfahrungen nicht für mich behalten:<br />
<span id="more-107"></span></p>
<h3>norisbank</h3>
<p>.. hat als 100% Tochter der Deutschen Bank auf ganzer Linie versagt. Die Erreichbarkeit der Filialbank mit Direktbank Konditionen ist lächerlich. Man wartet ca. 2 Monate auf Antwortmails, Briefe verschwinden und die Hotline ist mit der Frage des Wochentags überfordert. Seit geraumer Zeit betreibt die norisbank außerdem Betrug mit Ihrem Top3-Zinskonto. Das Tagesgeldkonto, das dauerhaft unter den ersten drei Deutschlands sein soll, ist so unterverzinst, dass die Norisbank ganz einfach falsche Zahlen in Ihren Vergleich packt. Eine Frechheit, die aber dort niemand wahr haben möchte.</p>
<div class="subBox">
<strong>Giro</strong>: Kostenlos<br />
<strong>Kreditkarte</strong>: Kostenlos (MasterCard)<br />
<strong>Im Ausland</strong>: Enorme Gebühren<br />
<strong>Service</strong>: Lächerlich<br />
<strong>Zinsen</strong>: Betrugsversuch<br />
<strong>Onlinebanking</strong>: Unübersichtlich, kein <a href="http://de.wikipedia.org/wiki/HBCI">HBCI</a>
</div>
<h3>netbank</h3>
<p>Die netbank glänzt mit einer Verzinsung des Girokontos (immo mit 2,5%) bei Gehaltseingang. Auf dem Tagesgeldkonto gibt&#8217;s sogar 2,75% für Neukunden. Der Service ist nicht besonders nett, aber kompetent. Die Kreditkarte widerum grenzt wieder an Betrug. Und zwar ist diese nur im ersten Jahr kostenlos. Diese Information findet man allerdings erst in den tiefsten Tiefen der AGB. Dann kann man damit aber auch weltweit kostenlos Geld abheben.</p>
<div class="subBox">
<strong>Giro</strong>: Kostenlos<br />
<strong>Kreditkarte</strong>: im ersten Jahr kostenlos (MasterCard)<br />
<strong>Im Ausland</strong>: Gebührenfrei mit MasterCard<br />
<strong>Service</strong>: Gut, aber nicht sonderlich freundlich<br />
<strong>Zinsen</strong>: Top<br />
<strong>Onlinebanking</strong>: Übersichtlich
</div>
<h3>MLP-Bank</h3>
<p>Die Kreditkarte ist &#8211; obwohl sie als solche beworben wird &#8211; erstmal nicht kostenlos. Erst, wenn man genügend Umsatz damit erwirtschaftet bekommt man die knackige Jahresgebühr zurückerstattet. Auch die kostenlose Verfügung im Ausland erweist sich kniffelig. Man muss mindestens 100€ abheben, da man sonst doch zur Kasse gebeten wird. Dies gilt übrigens auch bei Abhebung im Inland! Wer seinen Döner dort kauft wo man keine 100€-Scheine wechseln kann, ist schlecht beraten.<br />
Ferner ist das Onlinebanking ein absolutes Chaos. Man findet nichts, manches wird (glaube ich) auch garnicht angezeigt. Buchungen sind nicht zuzuordnen, etc.</p>
<div class="subBox">
<strong>Giro</strong>: Kostenlos für Akademiker<br />
<strong>Kreditkarte</strong>: nicht kostenlos<br />
<strong>Im Ausland</strong>: ab 100€ (!) gebührenfrei mit MasterCard<br />
<strong>Service</strong>: Persönlicher Berater<br />
<strong>Zinsen</strong>: Mittelmaß<br />
<strong>Onlinebanking</strong>: Chaos
</div>
<h3>comdirect</h3>
<p>Die Comdirect-Bank hat ein nettes Feature, <del datetime="2009-06-16T08:48:59+00:00">dass einem jeden Monat einen Euro schenkt. Im Jahr also immerhin 12€ geschenkt, die man auch direkt spenden kann.</del> Allerdings ist das bei einem aktuellen Zinssatz vom 1,75% auf dem Tagesgeldkonto eher ein Tribut.</p>
<div class="subBox">
<strong>Giro</strong>: Kostenlos <del datetime="2009-06-16T08:48:59+00:00">(+1€ jeden Monat!)</del><br />
<strong>Kreditkarte</strong>: Kostenlos (VISA)<br />
<strong>Im Ausland</strong>: Kostenlos mit VISA (im Inland mit EC)<br />
<strong>Service</strong>: Noch nicht in Anspruch genommen<br />
<strong>Zinsen</strong>: Schlecht<br />
<strong>Onlinebanking</strong>: Übersichtlich
</div>
<h3><a href="http://partners.webmasterplan.com/click.asp?ref=492974&#038;site=4667&#038;type=text&#038;tnb=1" target="_blank">DKB</a></h3>
<p>Meine neueste Bank hat ein tolles Bild hinterlassen. Die <a href="http://partners.webmasterplan.com/click.asp?ref=492974&#038;site=4667&#038;type=text&#038;tnb=1" target="_blank">DKB</a> glänzt mit Top-Verzinsung von <del datetime="2009-08-11T11:47:53+00:00">2,55%</del> 2,05% aus der VISA-Karte. Nicht nur, dass man das VISA-Konto nicht mehr ausgleichen muss &#8211; man bekommt Geld dafür, wenn es verfügbar ist. Damit das Girokonto nicht zu kurz kommt, gibt es das so genannte VISA-Sparen. Ein &#8220;Überlauf&#8221;-Prinzip. Ist genug Geld auf dem Girokonto, wird es zum Verzinsen auf die VISA-Karte gepackt. Von hier aus kann man es in Deutschland und auch weltweit komplett kostenlos abheben. Ob 10€ oder 300€ ist egal.<br />
Auch der Service ist eindeutig zu empfehlen: E-Mails werden in ca. 2-4 Stunden beantwortet, die Hotline ist seltenst nicht erreichbar und fast alle Serviceleistungen sind kostenfrei (Kartenverlust, weitere Konten).<br />
- <a href="http://partners.webmasterplan.com/click.asp?ref=492974&#038;site=4667&#038;type=text&#038;tnb=1" target="_blank">zur Bank</a></p>
<div class="subBox">
<strong>Giro</strong>: Kostenlos<br />
<strong>Kreditkarte</strong>: Kostenlos (VISA)<br />
<strong>Im Ausland</strong>: Gebührenfrei mit VISA<br />
<strong>Service</strong>: 1a Hotline &#038; Mail-Support<br />
<strong>Zinsen</strong>: Sehr Gut<br />
<strong>Onlinebanking</strong>: Übersichtlich
</div>
<h3>Fazit</h3>
<p>Mein neuer, absoluter Favorit ist die <a href="http://partners.webmasterplan.com/click.asp?ref=492974&#038;site=4667&#038;type=text&#038;tnb=1" target="_blank">DKB</a>. Auch ohne Filialen fühlt man sich ständig gut beraten. Auf der anderen Seite hat die norisbank auf voller Linie als Filialbank versagt. Nur die comdirect hat ganz ähnliche Konditionen wie die <a href="http://partners.webmasterplan.com/click.asp?ref=492974&#038;site=4667&#038;type=text&#038;tnb=1" target="_blank">DKB</a> &#8211; ist aber nicht so gut verzinst. <del datetime="2009-06-16T08:48:59+00:00">Dafür gibt es jeden Monat einen Euro geschenkt</del>. Die netbank lohnt sich für Leute, die nicht viel im Ausland unterwegs sind und auf die Kreditkarte verzichten können. Ich würde mich nach diesen ausgiebigen Tests entscheiden zwischen folgenden. Über den Partnerlink könnt ihr, solltet ich euer Interesse geweckt haben, auch gleich mal testen:</p>
<div class="subBox">
<a href="http://partners.webmasterplan.com/click.asp?ref=492974&#038;site=4667&#038;type=text&#038;tnb=1" target="_blank">DKB</a><img src="http://banners.webmasterplan.com/view.asp?ref=492974&#038;site=4667&#038;type=text&#038;tnb=1&#038;js=1" BORDER="0" WIDTH="1" HEIGHT="1" /> (<a href="http://partners.webmasterplan.com/click.asp?ref=492974&#038;site=4667&#038;type=text&#038;tnb=1" target="_blank">zur Bank</a>)<br />
comdirect
</div>
<p>Ich werde nun erstmal meine Kredit- und EC-Karten Sammlungen den Banken zurückgeben und mich auf die DKB beschränken.</p>
<p>&#8211;<br />
Alle Verweise sind Partnerlinks</p>
]]></content:encoded>
			<wfw:commentRss>http://wanderwort.de/2009/06/18/bankenruckblick-girouberblick/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Magento with top Navigation only</title>
		<link>http://wanderwort.de/2009/05/08/magento-top-navigation/</link>
		<comments>http://wanderwort.de/2009/05/08/magento-top-navigation/#comments</comments>
		<pubDate>Fri, 08 May 2009 17:26:30 +0000</pubDate>
		<dc:creator>pex</dc:creator>
				<category><![CDATA[Gemachtes]]></category>

		<guid isPermaLink="false">http://wanderwort.de/?p=74</guid>
		<description><![CDATA[Again I had to learn how much magento e-commerce documentation sucks or better to say the lack of it. After reading several tutorials and part-conclusions, i found following working solution First of all it&#8217;s important to have one default category as a root category. Then you can use the following code in &#8220;magento/app/design/frontend///template/catalog/navigation/top.phtml&#8221;. &#60;div id=&#34;navi&#34;&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Again I had to learn how much magento e-commerce documentation sucks or better to say the lack of it. After reading several tutorials and part-conclusions, i found following working solution<br />
First of all it&#8217;s important to have <span style="text-decoration:underline">one</span> default category as a root category.  Then you can use the following code in &#8220;magento/app/design/frontend/<#your template#>/<#your layout#>/template/catalog/navigation/top.phtml&#8221;.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div id=&quot;navi&quot;&gt;
  &lt;ul&gt;
  <span style="color: #000000; font-weight: bold;">&lt;?php</span>
  <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getStoreCategories</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$cat</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;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isCategoryActive</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cat</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: #0000ff;">'&lt;li class=&quot;active&quot;&gt;
          &lt;a href=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCategoryUrl</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cat</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;
          &lt;span&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$cat</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;">&quot;&lt;/span&gt;&lt;/a&gt;
        &lt;/li&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</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: #0000ff;">'&lt;li class=&quot;normal&quot;&gt;
          &lt;a href=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCategoryUrl</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cat</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;
          &lt;span&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$cat</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;">&quot;&lt;/span&gt;&lt;/a&gt;
        &lt;/li&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
  &lt;/ul&gt;
&lt;/div&gt;</pre></div></div>

<p>Be sure to use $this->isCategoryActive() instead of finding out the current category first and compare it with the active one. This wouldn&#8217;t work for sub-categories so that an active sub-category wouldn&#8217;t mark it&#8217;s parent active. Actually many tutorials seem to have that mistake in their code.</p>
<p>A more or less good resource for magento developers is <a href="http://magetips.com/">magetips.com</a>.<br />
I found the <a href="http://magetips.com/2009/04/29/extending-an-existing-class-in-magento/">adressed function there</a> as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://wanderwort.de/2009/05/08/magento-top-navigation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

