<?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>nerdcenter &#187; TYPO3</title>
	<atom:link href="http://nerdcenter.de/category/typo3/feed/" rel="self" type="application/rss+xml" />
	<link>http://nerdcenter.de</link>
	<description>IT-Kniffe eines Webentwicklers.</description>
	<lastBuildDate>Sun, 10 Apr 2011 16:55:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>TemplaVoilà: Default content for empty fields</title>
		<link>http://nerdcenter.de/templavoil-default-content-for-empty-fields/</link>
		<comments>http://nerdcenter.de/templavoil-default-content-for-empty-fields/#comments</comments>
		<pubDate>Fri, 26 Nov 2010 11:48:29 +0000</pubDate>
		<dc:creator>kcore</dc:creator>
				<category><![CDATA[TypoScript]]></category>

		<guid isPermaLink="false">http://nerdcenter.de/?p=114</guid>
		<description><![CDATA[

Thanks to stdWrap doing this is quite easy:
Edit the TemplaVoilà datastructure, search the field you want to fill with default content if it&#8217;s empty and look for it&#8217;s TypoScript configuration:
&#60;TypoScript&#62;
	10 = RECORDS
	10 {
		source.current = 1
		tables = tt_content
	}
&#60;/TypoScript&#62;
Add the following nodes under it:
&#60;proc type="array"&#62;
	&#60;stdWrap&#62;&#60;![CDATA[
		ifEmpty {
			cObject =&#60; lib.sidebarDefaultContent
		}
	]]&#62;&#60;/stdWrap&#62;
&#60;/proc&#62;
lib.sidebarDefaultContent can be any content object of your choice, for [...]]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<p>Thanks to stdWrap doing this is quite easy:</p>
<p>Edit the TemplaVoilà datastructure, search the field you want to fill with default content if it&#8217;s empty and look for it&#8217;s TypoScript configuration:</p>
<p><code>&lt;TypoScript&gt;<br />
	10 = RECORDS<br />
	10 {<br />
		source.current = 1<br />
		tables = tt_content<br />
	}<br />
&lt;/TypoScript&gt;</code></p>
<p>Add the following nodes under it:</p>
<p><code>&lt;proc type="array"&gt;<br />
	&lt;stdWrap&gt;&lt;![CDATA[<br />
		ifEmpty {<br />
			cObject =&lt; lib.sidebarDefaultContent<br />
		}<br />
	]]&gt;&lt;/stdWrap&gt;<br />
&lt;/proc&gt;</code></p>
<p>lib.sidebarDefaultContent can be any content object of your choice, for example a RECORDS object:</p>
<p><code>lib.sidebarDefaultContent = RECORDS<br />
lib.sidebarDefaultContent {<br />
  tables = tt_content<br />
  source = 93, 95<br />
}</code></p>
<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://nerdcenter.de/templavoil-default-content-for-empty-fields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TYPO3 HTML save cropping</title>
		<link>http://nerdcenter.de/typo3-html-save-crop/</link>
		<comments>http://nerdcenter.de/typo3-html-save-crop/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 16:48:11 +0000</pubDate>
		<dc:creator>kcore</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[TYPO3]]></category>

		<guid isPermaLink="false">http://nerdcenter.de/?p=68</guid>
		<description><![CDATA[

Meistens reicht die Methode tslib_cObj::crop vollkommen aus, um Texte &#8211; etwa für eine Listenansicht &#8211; zu kürzen. Wenn jedoch RTE formatierte Texte im Spiel sind und die Formatierung in der gekürzten Version beibehalten werden soll, ist es reine Glückssache, kein invalides (X)HTML durch nicht geschlossene bzw. &#8220;verkrüppelte&#8221; Tags zu generieren. Abhilfe schafft die folgende crop-Methode, [...]]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<p>Meistens reicht die Methode tslib_cObj::crop vollkommen aus, um Texte &#8211; etwa für eine Listenansicht &#8211; zu kürzen. Wenn jedoch RTE formatierte Texte im Spiel sind und die Formatierung in der gekürzten Version beibehalten werden soll, ist es reine Glückssache, kein invalides (X)HTML durch nicht geschlossene bzw. &#8220;verkrüppelte&#8221; Tags zu generieren. Abhilfe schafft die folgende crop-Methode, die eine Portierung der Javascript-Version von <a href="http://blog.stevenlevithan.com/archives/get-html-summary">Steven Levithan</a> darstellt:</p>
<pre>public static function crop($input, $numMaxChars) {
	$output = '';
	$charCount = 0;
	$openTags = array();
	$matches = array();
	$htmlTags = '/\w+|[^\w&lt;]|&lt;(\/)?(\w+)[^&gt;]*(\/)?&gt;|&lt;/';
	$selfClosingHtmlTags = '/^(?:[hb]r|img)$/i';

	preg_match_all($htmlTags, $input, $matches);
	$i = 0;
	$numMatches = count($matches[0]);
	while(($i &lt; $numMatches) &#038;&#038; ($charCount &lt; $numMaxChars)) {
		// are we dealing with an html tag?
		if($matches[2][$i] != '') {
			$output .= $matches[0][$i];
			// if it isn't a self closing tag
			if(preg_match($selfClosingHtmlTags, $matches[2][$i]) == 0) {
				// if its a closing tag...
				if($matches[1][$i] == '/') {
					array_pop($openTags);
				} else {
					$openTags[] = $matches[2][$i];
				}
			}
		} else {
			$charCount += mb_strlen($matches[0][$i], $GLOBALS['TSFE']-&gt;renderCharset);
			if($charCount &lt;= $numMaxChars) {
				$output .= $matches[0][$i];
			}
		}

		$i++;
	}

	// closing open tags
	$i = count($openTags);
	while($i--) {
		$output .= '&lt;/' . $openTags[$i] . '&gt;';
	}

	return $output;
}</pre>
<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://nerdcenter.de/typo3-html-save-crop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TYPO3: Frontend Renderer als Singleton</title>
		<link>http://nerdcenter.de/typo3-frontend-renderer-als-singleton/</link>
		<comments>http://nerdcenter.de/typo3-frontend-renderer-als-singleton/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 22:18:13 +0000</pubDate>
		<dc:creator>kcore</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[TYPO3]]></category>
		<category><![CDATA[Frontend]]></category>
		<category><![CDATA[Pattern]]></category>
		<category><![CDATA[PHP5]]></category>
		<category><![CDATA[Renderer]]></category>
		<category><![CDATA[Singleton]]></category>

		<guid isPermaLink="false">http://nerdcenter.de/typo3-frontend-renderer-als-singleton/</guid>
		<description><![CDATA[

Renderer sind stets einmalig. Das Singleton Design Pattern bilded genau dies ab: Es wird lediglich eine einzige Instanz der Klasse erzeugt und zurückgegeben. Die folgende Klasse kann als Basis für die View-Schicht der eigenen TYPO3 Extension verwendet werden. Sie ist von pi_base abgeleitet und bietet so den gewohnten Funktionsumfang. Der Codeschnipsel stammt aus einer mini [...]]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<p>Renderer sind stets einmalig. Das Singleton Design Pattern bilded genau dies ab: Es wird lediglich eine einzige Instanz der Klasse erzeugt und zurückgegeben. Die folgende Klasse kann als Basis für die View-Schicht der eigenen TYPO3 Extension verwendet werden. Sie ist von pi_base abgeleitet und bietet so den gewohnten Funktionsumfang. Der Codeschnipsel stammt aus einer mini TYPO3 Extension, an der ich gerade privat bastel.</p>
<pre>&lt;?php
/***************************************************************
*  Copyright notice
*
*  (c) 2009 Thorsten Boock &lt;thorsten (at) nerdcenter.de&gt;
*  All rights reserved
*
*  This script is part of the TYPO3 project. The TYPO3 project is
*  free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  The GNU General Public License can be found at
*  http://www.gnu.org/copyleft/gpl.html.
*
*  This script is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

require_once(PATH_tslib . 'class.tslib_pibase.php');

/**
 * Frontend Renderer
 * Till PHP 5.3 this class has to be declared as final because
 * we don't know the names of the classes extending this one.
 *
 * @author Thorsten Boock &lt;thorsten (at) nerdcenter.de&gt;
 */
final class tx_tbwhoisonline_renderer_fe extends tslib_pibase {
	/**
	 * Instance of this class (Singleton Design Pattern)
	 *
	 * @var tx_whoisonline_renderer_fe
	 */
	private static		$instance					=	null;
	/**
	 * Path to the template file used for rendering
	 *
	 * @var string
	 */
	private				$templateFile				=	'';
	/**
	 * The contents of the file $this-&gt;templateFile
	 *
	 * @var string
	 */
	private				$templateHTML				=	'';

	/**
	 * Empty constructor (Singleton Design Pattern)
	 *
	 */
	private function __construct() {

	}

	/**
	 * Empty clone function (Singleton Design Pattern)
	 *
	 */
	private function __clone() {

	}

	/**
	 * Instantiating this object (Singleton Design Pattern)
	 *
	 * @return tx_tbwhoisonline_renderer_fe
	 */
	public static function getInstance() {
		if(self::$instance == null) {
			self::$instance = new tx_tbwhoisonline_renderer_fe();
		}
		return self::$instance;
	}

	/**
	 * Initializing this object
	 *
	 * @param array $conf
	 */
	public function init($conf) {
		// init tslib_pibase
		$this-&gt;conf = $conf;
		$this-&gt;pi_setPiVarDefaults();
		$this-&gt;pi_loadLL();
		// get cObj instance and load template
 		$this-&gt;cObj = t3lib_div::makeInstance('tslib_cObj');
 		$this-&gt;templateHTML = $this-&gt;cObj-&gt;fileResource($this-&gt;templateFile);
		// override defaults with typoscript configuration
		foreach($this-&gt;conf as $key =&gt; $value) {
			$key = str_replace('.', '', $key);
			if(isset($this-&gt;$key)) {
				$this-&gt;$key = $value;
			}
		}
	}
}
?&gt;</pre>
<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://nerdcenter.de/typo3-frontend-renderer-als-singleton/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

