<?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>zoe.vc &#187; typoscript</title>
	<atom:link href="http://www.zoe.vc/tag/typoscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zoe.vc</link>
	<description>development &#38; freelancing blog</description>
	<lastBuildDate>Mon, 30 Jan 2012 07:03:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>TypoScript auslesen (eID und BE-Modul)</title>
		<link>http://www.zoe.vc/2008/typoscript-auslesen/</link>
		<comments>http://www.zoe.vc/2008/typoscript-auslesen/#comments</comments>
		<pubDate>Fri, 30 May 2008 22:48:00 +0000</pubDate>
		<dc:creator>Alex (zoe.vc)</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[TYPO3]]></category>
		<category><![CDATA[backend-module]]></category>
		<category><![CDATA[eID]]></category>
		<category><![CDATA[Typo3]]></category>
		<category><![CDATA[typoscript]]></category>

		<guid isPermaLink="false">http://www.zoe.vc/2008/typoscript-auslesen/</guid>
		<description><![CDATA[Manchmal muss man beim Entwickeln für Typo3 TypoScript an den unterschiedlichsten Stellen auslesen. Im folgenden zwei Beispiele, die mich gerade ein wenig auf die Probe gestellt haben. TypoScript bei Nutzung von eID Das Skript, welches mit eID angesprochen wird, ist ja lightweight und lädt erstmal nahezu nix vom Typo3-Kern. Nutzer und Datenbank sind schnell initialisiert, [...]]]></description>
			<content:encoded><![CDATA[<p>Manchmal muss man beim Entwickeln für Typo3 TypoScript an den unterschiedlichsten Stellen auslesen. Im folgenden zwei Beispiele, die mich gerade ein wenig auf die Probe gestellt haben.</p>
<p><strong>TypoScript bei Nutzung von eID</strong></p>
<p>Das Skript, welches mit eID angesprochen wird, ist ja lightweight und lädt erstmal nahezu nix vom Typo3-Kern. Nutzer und Datenbank sind schnell initialisiert, aber wenn man z.B. Werte aus dem TypoScript Setup des Plugins auslesen will geht das nicht nur mit einer Zeile Code. Dem eID-Skript muss auf irgendeine Weise die PageID übergeben werden (ich mache das mit einer Get-Variable), die braucht man nämlich, um das TSFE (das ja nicht da ist), ordentlich zu initialisieren. Man instanziiert sich eine tslib_fe Klasse, verbindet zur Datenbank, initialisiert den Nutzer, das Template und die Config und schon ist man fertig:</p>
<pre class="php"><span style="color: #808080; font-style: italic;">// eID specific initialization of user and database</span>
tslib_eidtools::<span style="color: #006600;">connectDB</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
tslib_eidtools::<span style="color: #006600;">initFeUser</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// initialize TSFE</span>
<span style="color: #b1b100;">require_once</span><span style="color: #66cc66;">&#40;</span>PATH_tslib.<span style="color: #ff0000;">'class.tslib_fe.php'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">require_once</span><span style="color: #66cc66;">&#40;</span>PATH_t3lib.<span style="color: #ff0000;">'class.t3lib_page.php'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$temp_TSFEclassName</span> = t3lib_div::<span style="color: #006600;">makeInstanceClassName</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'tslib_fe'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$GLOBALS</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'TSFE'</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0000ff;">$temp_TSFEclassName</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$TYPO3_CONF_VARS</span>, <span style="color: #0000ff;">$pid</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$GLOBALS</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'TSFE'</span><span style="color: #66cc66;">&#93;</span>-&amp;gt;connectToDB<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$GLOBALS</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'TSFE'</span><span style="color: #66cc66;">&#93;</span>-&amp;gt;initFEuser<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$GLOBALS</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'TSFE'</span><span style="color: #66cc66;">&#93;</span>-&amp;gt;determineId<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$GLOBALS</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'TSFE'</span><span style="color: #66cc66;">&#93;</span>-&amp;gt;getCompressedTCarray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$GLOBALS</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'TSFE'</span><span style="color: #66cc66;">&#93;</span>-&amp;gt;initTemplate<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$GLOBALS</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'TSFE'</span><span style="color: #66cc66;">&#93;</span>-&amp;gt;getConfigArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre>
<p>Nun kann man altbekannt via</p>
<pre class="php"><span style="color: #0000ff;">$GLOBALS</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'TSFE'</span><span style="color: #66cc66;">&#93;</span>-&amp;gt;tmpl-&amp;gt;setup<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'plugin.'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'extensionkey.'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'your_value'</span><span style="color: #66cc66;">&#93;</span></pre>
<p>auf die Daten zugreifen. Mit der letzten Codezeile kann man übrigens auch in nicht vollständig initialisierten Plugins das TypoScript beliebig auslesen.</p>
<p><strong>TypoScript in Backend-Modulen</strong></p>
<p>In Backend-Modulen ist es auch manchmal notwendig, auf das TypoScript Setup zuzugreifen, zum Beispiel beim Senden einer Email, um den Absender auszulesen etc. Der Ablauf ist ähnlich wie bei eID, jedoch ermitteln wir selber die RootPageID und nutzen die t3lib_pageSelect und t3lib_tsparser_ext Klassen. Ich habe das ganze in eine Funktion gepackt, da man das ja nicht unbedingt immer braucht:</p>
<pre class="php"><span style="color: #808080; font-style: italic;">/**
 * Loads the TypoScript for the given extension prefix, e.g. tx_cspuppyfunctions_pi1, for use in a backend module.
 *
 * @param string $extKey
 * @return array
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> loadTypoScriptForBEModule<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$extKey</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">require_once</span><span style="color: #66cc66;">&#40;</span>PATH_t3lib . <span style="color: #ff0000;">'class.t3lib_page.php'</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #b1b100;">require_once</span><span style="color: #66cc66;">&#40;</span>PATH_t3lib . <span style="color: #ff0000;">'class.t3lib_tstemplate.php'</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #b1b100;">require_once</span><span style="color: #66cc66;">&#40;</span>PATH_t3lib . <span style="color: #ff0000;">'class.t3lib_tsparser_ext.php'</span><span style="color: #66cc66;">&#41;</span>;
	<a href="http://www.php.net/list"><span style="color: #000066;">list</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$page</span><span style="color: #66cc66;">&#41;</span> = t3lib_BEfunc::<span style="color: #006600;">getRecordsByField</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'pages'</span>, <span style="color: #ff0000;">'pid'</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0000ff;">$pageUid</span> = <a href="http://www.php.net/intval"><span style="color: #000066;">intval</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$page</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'uid'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0000ff;">$sysPageObj</span> = t3lib_div::<span style="color: #006600;">makeInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'t3lib_pageSelect'</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0000ff;">$rootLine</span> = <span style="color: #0000ff;">$sysPageObj</span>-&amp;gt;getRootLine<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pageUid</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0000ff;">$TSObj</span> = t3lib_div::<span style="color: #006600;">makeInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'t3lib_tsparser_ext'</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0000ff;">$TSObj</span>-&amp;gt;tt_track = <span style="color: #cc66cc;">0</span>;
	<span style="color: #0000ff;">$TSObj</span>-&amp;gt;init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0000ff;">$TSObj</span>-&amp;gt;runThroughTemplates<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$rootLine</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0000ff;">$TSObj</span>-&amp;gt;generateConfig<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$TSObj</span>-&amp;gt;setup<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'plugin.'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$extKey</span> . <span style="color: #ff0000;">'.'</span><span style="color: #66cc66;">&#93;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
<p>Und damit hätte man wieder ein paar Typo3-Probleme weniger...</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zoe.vc/2008/typoscript-auslesen/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Typo3: erstellbare Elemente auf Seite limitieren.</title>
		<link>http://www.zoe.vc/2008/erstellbare-elemente-auf-seite-limitieren/</link>
		<comments>http://www.zoe.vc/2008/erstellbare-elemente-auf-seite-limitieren/#comments</comments>
		<pubDate>Sat, 16 Feb 2008 10:39:59 +0000</pubDate>
		<dc:creator>Alex (zoe.vc)</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[TYPO3]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Typo3]]></category>
		<category><![CDATA[typoscript]]></category>

		<guid isPermaLink="false">http://www.zoe.vc/2008/erstellbare-elemente-auf-seite-limitieren/</guid>
		<description><![CDATA[[german]In Typo3 ist es des öfteren sinnvoll, die erstellbaren Elemente auf einer Seite zu limitieren. Vor allem bei SysFoldern in denen man jeweils nur bestimmte Elemente speichern will macht das Sinn, denn im SysFolder "Nutzer" möchte ich eher keine anderen Elemente haben. Außerdem erhöht das die Übersichtlichkeit und bringt Redakteure nicht dazu, neue Elemente "einfach [...]]]></description>
			<content:encoded><![CDATA[<p>[german]In Typo3 ist es des öfteren sinnvoll, die erstellbaren Elemente auf einer Seite zu limitieren. Vor allem bei SysFoldern in denen man jeweils nur bestimmte Elemente speichern will macht das Sinn, denn im SysFolder "Nutzer" möchte ich eher keine anderen Elemente haben. Außerdem erhöht das die Übersichtlichkeit und bringt Redakteure nicht dazu, neue Elemente "einfach irgendwohin" zu speichern.</p>
<p>In der TSConfig der entsprechenden Seite muss man einfach nur:</p>
<p><code>mod.web_list.allowedNewTables = db_tablename,db_tablename_2</code></p>
<p>angeben, wobei db_tablename entsprechend die Namen der Datenbanktabellen der Elemente sind.</p>
<p>[/german]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zoe.vc/2008/erstellbare-elemente-auf-seite-limitieren/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

