<?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>Nicolas Kuttler &#187; CSS</title>
	<atom:link href="http://www.nicolaskuttler.de/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nicolaskuttler.de</link>
	<description>IT Dienstleistungen, Saarbrücken</description>
	<lastBuildDate>Sat, 12 Jun 2010 21:42:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Shortcodes, CSS und JS nur wenn nötig einbinden</title>
		<link>http://www.nicolaskuttler.de/2009/10/24/shortcodes-css-und-js-nur-wenn-notig-einbinden/</link>
		<comments>http://www.nicolaskuttler.de/2009/10/24/shortcodes-css-und-js-nur-wenn-notig-einbinden/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 10:05:48 +0000</pubDate>
		<dc:creator>nicolas</dc:creator>
				<category><![CDATA[Content Management]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.nicolaskuttler.de/?p=379</guid>
		<description><![CDATA[Vor kurzem wollte ich eine neue Funktionalität für mein Blog haben, und ich wollte dafür ein neues plugin hinzufügen. Also habe ich verschiedene getestet und bin auf etwas überraschendes gestoßen: zumindest eines der plugins, die ich mir angeschaut habe, wollte seine CSS-Datei und jquery auf jeder Seite meines Blogs laden. Nach einigen weiteren Tests wurde [...]]]></description>
			<content:encoded><![CDATA[<p>Vor kurzem wollte ich eine neue Funktionalität für mein Blog haben, und ich wollte dafür ein neues plugin hinzufügen. Also habe ich verschiedene getestet und bin auf etwas überraschendes gestoßen: zumindest eines der plugins, die ich mir angeschaut habe, wollte seine CSS-Datei <strong>und</strong> jquery auf jeder Seite meines Blogs laden. Nach einigen weiteren Tests wurde mir dann klar dass dieses Verhalten weit verbreitet ist.<span id="more-379"></span></p>
<p>Und das ist nicht gut so. Jquery ist durchaus klein, CSS Stile normalerweise auch. Aber das ist kein Grund sie jedem Besucher beim Aufruf irgend einer beliebigen Seite aufzuzwingen. Ein paar weitere Nachforschungen haben keine einfache Lösung ergeben, also habe ich meine eigene geschrieben.</p>
<p>Normalerweise bindet ein plugin seine Dateien über die <tt>wp_print_styles</tt> oder <tt>wp_print_scripts</tt> Aktionen ein:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wp_print_styles'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'deinplugin_css_einbinden'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> deinplugin_css_einbinden<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$csslink</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Nimm statt dessen etwas wie folgendes:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wp_print_styles'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'deinplugin_css_einbinden'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> deinplugin_css_einbinden<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Prüfen ob der shortcode im Inhalt der Seite vorkommt</span>
    <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">strstr</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_content</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'[deinshortcode]'</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: #000088;">$csslink</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Das ist schon alles. Bitte fügt eure CSS- und JavaScript-Dateien nicht jeder Seite meines Blogs hinzu.</p>
<p><strong>Update</strong>: Dieser <a href="http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/">exzellente Artikel</a> stellt eine verbesserte Lösung dieses Problems dar.</p>
<p><strong>Update 2</strong>: <a href="http://scribu.net/wordpress/optimal-script-loading.html">Die bisher beste Lösung um JavaScript zu laden</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nicolaskuttler.de/2009/10/24/shortcodes-css-und-js-nur-wenn-notig-einbinden/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Typo3, YAML und die vertikale Navigation</title>
		<link>http://www.nicolaskuttler.de/2009/10/08/typo3-yaml-und-die-vertikale-navigation/</link>
		<comments>http://www.nicolaskuttler.de/2009/10/08/typo3-yaml-und-die-vertikale-navigation/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 08:47:02 +0000</pubDate>
		<dc:creator>nicolas</dc:creator>
				<category><![CDATA[Content Management]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[Typo3]]></category>
		<category><![CDATA[typoscript]]></category>
		<category><![CDATA[YAML]]></category>

		<guid isPermaLink="false">http://www.nicolaskuttler.de/?p=72</guid>
		<description><![CDATA[Mit dem YAML CSS framework TYPO3 templates zu entwickeln ist recht einfach, wenn man die Grundlagen von typoscript kennt. Allerdings muss man valides HTML produzieren, damit die Navigationskomponente vertikale Listennavigation korrekt dargestellt wird. Hier ist ein Ansatz, dies in Typo3 zu erreichen: tmp.nav = HMENU tmp.nav &#123; 1 = TMENU 1 &#123; expAll = 1 [...]]]></description>
			<content:encoded><![CDATA[<p>Mit dem <a href="http://www.yaml.de/en/">YAML CSS framework</a> <a href="http://www.typo3.com">TYPO3</a> templates zu entwickeln ist recht einfach, wenn man die Grundlagen von typoscript kennt. Allerdings muss man valides HTML produzieren, damit die  <a href="http://www.yaml.de/en/documentation/css-components/components-for-navigation.html">Navigationskomponente</a> <strong>vertikale Listennavigation</strong> korrekt dargestellt wird.<span id="more-72"></span></p>
<p>Hier ist ein Ansatz, dies in Typo3 zu erreichen:</p>

<div class="wp_syntax"><div class="code"><pre class="typoscript" style="font-family:monospace;">tmp<span style="color: #339933; font-weight: bold;">.</span>nav <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #990000; font-weight: bold;">HMENU</span>
tmp<span style="color: #339933; font-weight: bold;">.</span>nav <span style="color: #009900;">&#123;</span>
    <span style="color: #cc0000;">1</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #990000; font-weight: bold;">TMENU</span>
    <span style="color: #cc0000;">1</span> <span style="color: #009900;">&#123;</span>
        expAll <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #cc0000;">1</span>
        wrap <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #3366CC;">&lt;ul&gt;</span><span style="color: #339933; font-weight: bold;">|</span><span style="color: #3366CC;">&lt;/ul&gt;</span>
        <span style="color: #990000; font-weight: bold;">NO</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #cc0000;">1</span>
        <span style="color: #990000; font-weight: bold;">NO</span> <span style="color: #009900;">&#123;</span>
            wrapItemAndSub <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #3366CC;">&lt;li&gt;</span><span style="color: #339933; font-weight: bold;">|</span><span style="color: #3366CC;">&lt;/li&gt;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #990000; font-weight: bold;">CUR</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #cc0000;">1</span>
        <span style="color: #990000; font-weight: bold;">CUR</span> <span style="color: #009900;">&#123;</span>
            wrapItemAndSub <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #3366CC;">&lt;li&gt;</span><span style="color: #339933; font-weight: bold;">|</span><span style="color: #3366CC;">&lt;/li&gt;</span>
            ATagParams<span style="color: #339933; font-weight: bold;">=</span> id<span style="color: #339933; font-weight: bold;">=</span>&quot;active&quot;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #cc0000;">2</span> <span style="color: #339933; font-weight: bold;">&lt;</span> <span style="color: #339933; font-weight: bold;">.</span>1
    2<span style="color: #339933; font-weight: bold;">.</span>wrap <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #3366CC;">&lt;ul&gt;</span><span style="color: #339933; font-weight: bold;">|</span><span style="color: #3366CC;">&lt;/ul&gt;</span>
    <span style="color: #cc0000;">3</span> <span style="color: #339933; font-weight: bold;">&lt;</span> <span style="color: #339933; font-weight: bold;">.</span>2
    <span style="color: #aaa; font-style: italic;"># [...]</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.nicolaskuttler.de/2009/10/08/typo3-yaml-und-die-vertikale-navigation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
