<?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>Schnipsel - Code Schnipsel (Snippets) zu Wordpress, PHP, HTML, CSS, jQuery &#187; PHP</title>
	<atom:link href="http://schnipsel.davidhellmann.com/category/php/feed" rel="self" type="application/rss+xml" />
	<link>http://schnipsel.davidhellmann.com</link>
	<description>Code Schnipsel (Snippets) zu Wordpress, PHP, HTML, CSS, jQuery</description>
	<lastBuildDate>Tue, 08 Mar 2011 00:20:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Tweet This mit WordPress</title>
		<link>http://schnipsel.davidhellmann.com/wordpress/tweet-this-mit-wordpress/69</link>
		<comments>http://schnipsel.davidhellmann.com/wordpress/tweet-this-mit-wordpress/69#comments</comments>
		<pubDate>Wed, 07 Oct 2009 14:37:15 +0000</pubDate>
		<dc:creator>David Hellmann</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://schnipsel.davidhellmann.com/?p=69</guid>
		<description><![CDATA[Twitter ist &#252;berall! Hier ein kleiner Schnipsel zum einfachen einbinden in WordPress. Das ganze kommt von Frank Bueltge und von René. Die Funktion kommt einfach in die functions.php im Themeordner. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 /** * get a short/tiny url * @author: [...]]]></description>
			<content:encoded><![CDATA[<p>
Twitter ist &#252;berall! Hier ein kleiner Schnipsel zum einfachen einbinden in WordPress. Das ganze kommt von <a href="http://bueltge.de/tweet-this-mit-wordpress/875/">Frank Bueltge</a> und von <a href="http://www.rene-ade.de/inhalte/php-code-zum-erstellen-einer-tinyurl-ueber-tinyurl-com-api.html">René</a>.
</p>
<span id="more-69"></span>
<p>Die Funktion kommt einfach in die <strong>functions.php</strong> im <strong>Themeordner</strong>.</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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * get a short/tiny url
 * @author: René Ade
 * @link: http://www.rene-ade.de/inhalte/php-code-zum-erstellen-einer-tinyurl-ueber-tinyurl-com-api.html
 */</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'fb_gettinyurl'</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;">function</span> fb_gettinyurl<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$url</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'http://tinyurl.com/api-create.php?url='</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'r'</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;">$fp</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$tinyurl</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fgets</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$fp</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;">$tinyurl</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tinyurl</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
                <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tinyurl</span><span style="color: #339933;">;</span>
            <span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$fp</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$url</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>



<p>Eingebunden an der jeweiligen Wunschstelle der Seite wird es dann wie folgt:</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;">&lt;a class=&quot;tweetthis&quot; href=&quot;http://twitter.com/home?status=<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Lohnenswert: '</span> <span style="color: #339933;">.</span> get_the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">' '</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> fb_gettinyurl<span style="color: #009900;">&#40;</span> get_permalink<span style="color: #009900;">&#40;</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>&quot; title=&quot;Tweet this&quot;&gt;
	&lt;img src=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'stylesheet_directory'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/images/layout/tweetthis.jpg&quot; border=&quot;0&quot; /&gt;
&lt;/a&gt;</pre></td></tr></table></div>



<p>Bei Twitter erscheint dann das hier: <strong>Lohnenswert: Titel des Beitrags http://tinyurl...</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://schnipsel.davidhellmann.com/wordpress/tweet-this-mit-wordpress/69/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Simple PHP Schleife</title>
		<link>http://schnipsel.davidhellmann.com/php/simple-php-schleife/66</link>
		<comments>http://schnipsel.davidhellmann.com/php/simple-php-schleife/66#comments</comments>
		<pubDate>Thu, 02 Jul 2009 13:20:31 +0000</pubDate>
		<dc:creator>David Hellmann</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[schleife]]></category>

		<guid isPermaLink="false">http://schnipsel.davidhellmann.com/php/simple-php-schleife/66</guid>
		<description><![CDATA[Kann man oft gebrauchen wenn man kleine Sachen schnell &#246;fters darstellen will. 1 2 3 &#60;?php for&#40;$i = 0; $i &#60; 10; $i++&#41; &#123; ?&#62; html code oder sonst was hier &#60;?php &#125; ?&#62;]]></description>
			<content:encoded><![CDATA[<p>
Kann man oft gebrauchen wenn man kleine Sachen schnell &#246;fters darstellen will.
</p>
<span id="more-66"></span>


<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: #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: #cc66cc;">10</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: #000000; font-weight: bold;">?&gt;</span>
	html code oder sonst was hier
<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></pre></td></tr></table></div>


]]></content:encoded>
			<wfw:commentRss>http://schnipsel.davidhellmann.com/php/simple-php-schleife/66/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Navigation f&#252;r statische Webseiten</title>
		<link>http://schnipsel.davidhellmann.com/php/navigation-fuer-statische-webseiten/44</link>
		<comments>http://schnipsel.davidhellmann.com/php/navigation-fuer-statische-webseiten/44#comments</comments>
		<pubDate>Mon, 18 May 2009 18:35:00 +0000</pubDate>
		<dc:creator>David Hellmann</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Navigation]]></category>

		<guid isPermaLink="false">http://schnipsel.davidhellmann.com/?p=44</guid>
		<description><![CDATA[Von Thomas geklaut. Eine statische Seite besteht meistens aus mehreren HTML Dateien. Bestenfalls sind es aber keine HTML Dateien sondern PHP Dateien da man dort wie der Name schon sagt PHP einsetzen kann. Man k&#246;nnte jetzt in der Navigation auf jeder Seite von Hand den aktuellen Man&#252;punkt hervorheben. Ein wenig einfacher geht das aber mittels [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Von Thomas geklaut.</strong> Eine statische Seite besteht meistens aus mehreren HTML Dateien. Bestenfalls sind es aber keine HTML Dateien sondern PHP Dateien da man dort wie der Name schon sagt PHP einsetzen kann. Man k&#246;nnte jetzt in der Navigation auf jeder Seite von Hand den aktuellen Man&#252;punkt hervorheben. Ein wenig einfacher geht das aber mittels PHP. Die Navigation wird dann in die Datei "<strong>header.php</strong>" ausgelagert und sp&#228;ter in den jeweiligen Seiten per "<strong>include</strong>" eingef&#252;gt.
</p>
<span id="more-44"></span>
<p>Als erstes gibt man jeder Datei eine kleine PHP Zeile mit, diese kommt ganz oben in die Datei und sieht wie folgt aus:</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="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$pageID</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;startseite&quot;</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: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'include/header.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
// In der &quot;header.php&quot; befindet sich dann die Navigation
&nbsp;
&lt;h2&gt;Startseite&lt;/h2&gt;
&lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin pellentesque, est ut venenatis aliquam, lorem quam porttitor ligula, eget ultrices velit dui sed quam. Praesent vehicula placerat lectus. Nulla pede. Quisque a nulla quis massa pulvinar sagittis. Pellentesque neque massa, mattis vulputate, pellentesque nec, vehicula volutpat, purus. Proin pretium dui et nulla cursus eleifend. Aenean aliquam urna eget urna. Vestibulum euismod elit. Donec eget augue sit amet neque elementum pretium. Proin posuere lacus id lacus. Duis vel justo suscipit neque ornare iaculis.&lt;/p&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'include/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>Jetzt kommt die Navigation die dann wie folgt aussehen k&#246;nnte:</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="php" style="font-family:monospace;">&lt;ul id=&quot;navi&quot;&gt;
	&lt;li&gt;&lt;a class=&quot;<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;">$pageID</span> <span style="color: #339933;">==</span> startseite<span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'aktiv'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; href=&quot;index.php&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a class=&quot;<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;">$pageID</span> <span style="color: #339933;">==</span> portfolio<span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'aktiv'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; href=&quot;portfolio.php&quot;&gt;Pension&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a class=&quot;<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;">$pageID</span> <span style="color: #339933;">==</span> about<span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'aktiv'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; href=&quot;about.php&quot;&gt;Mosel&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a class=&quot;<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;">$pageID</span> <span style="color: #339933;">==</span> kontakt<span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'aktiv'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; href=&quot;kontakt.php&quot;&gt;Briedel&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre></td></tr></table></div>



<p>Hier wird nun einfach abgefragt "Wenn pageID gleich startseite dann gebe "aktiv" aus. Somit wird nur auf der aktuellen Seite das "aktiv" ausgegeben und der Men&#252;punkt wird hervorgehoben.</p>]]></content:encoded>
			<wfw:commentRss>http://schnipsel.davidhellmann.com/php/navigation-fuer-statische-webseiten/44/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

