<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		
		<title>TYPO3Bloke.net: TYPO3 Blog</title>
		<link>http://typo3bloke.net/</link>
		<description>TYPO3 technical blog</description>
		<language>en</language>
		<image>
			<title>TYPO3Bloke.net: TYPO3 Blog</title>
			<url>http://typo3bloke.net/typo3conf/ext/tt_news/ext_icon.gif</url>
			<link>http://typo3bloke.net/</link>
			<width>18</width>
			<height>16</height>
			<description>TYPO3 technical blog</description>
		</image>
		<generator>TYPO3 - get.content.right</generator>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		
		
		
		<lastBuildDate>Wed, 23 Jul 2008 12:28:00 +0300</lastBuildDate>
		
		
		<item>
			<title>Extension updates: loginusertrack and comments</title>
			<link>http://typo3bloke.net/post-details/extension_updates_loginusertrack_and_comments/</link>
			<description>&lt;p class="bodytext"&gt;I just sent two extension updates to TER. They will appear soon. Login user track and comments were updated.&lt;/p&gt;
&lt;p class="bodytext"&gt;Login user track is a TYPO3 extension that records Frontend user activities. It records when user last logged in, how many pages he visited and what pages he visited. The extension was originally written by Kasper but was not updated for a long time. Netcreators needed additional functionality to this extension, so I took it, added...&lt;/p&gt;</description>
			<guid isPermaLink="false">http://typo3bloke.net/post-details/extension_updates_loginusertrack_and_comments/</guid>
			<content:encoded><![CDATA[<p class="bodytext">I just sent two extension updates to TER. They will appear soon. Login user track and comments were updated.</p>
<h2>loginusertrack</h2>
<p class="bodytext">Login user track is a TYPO3 extension that records Frontend user activities. It records when user last logged in, how many pages he visited and what pages he visited. The extension was originally written by Kasper but was not updated for a long time. <a href="http://netcreators.com/" title="Netcreators provides TYPO3 solutions" target="_blank" class="external-link-new-window" >Netcreators</a> needed additional functionality to this extension, so I took it, added that functionality and rewrote the other 50% of extension to use modern TYPO3 API. I also changed XCLASS to hook, which is always better. In addition Frontend handling is very efficient and does not slow down TYPO3.</p>
<p class="bodytext"><img src="http://typo3bloke.net/fileadmin/article-images/loginusertrack-typo3-extension.png" height="415" width="483" alt="" /></p>
<p class="bodytext">Current update fixes a minor but very annoying bug with time units (seconds, minutes, etc) not visible in Backend statistics module.</p>
<h2>Comments</h2>
<p class="bodytext">The change in comments is significant. It is a result of my investgation of <a href="http://typo3bloke.net/post-details/why_substitutemarkerarraycached_is_bad/" title="Why substituteMarkerArrayCached is bad?" class="external-link-new-window" >substituteMarkerArrayCached problems</a>. Now comments does not use this function. It means it will run faster and will produce less data in the database. That gives another performance increase to TYPO3.</p>]]></content:encoded>
			<category>News</category>
			
			
			<pubDate>Wed, 23 Jul 2008 12:28:00 +0300</pubDate>
			
		</item>
		
		<item>
			<title>Howto: use Frontend user data in a TYPO3 mailform</title>
			<link>http://typo3bloke.net/post-details/howto_use_frontend_user_data_in_a_typo3_mailform/</link>
			<description>&lt;p class="bodytext"&gt;Today I had an interesting challenge. I had to create a contact form on the Intranet web site. This web site always has Frontend user logged in. I was going to use standard TYPO3 mailform. Typically such form contains fields for user name and e-mail. When I started to create the form, I immediately realized that it will be stupid to ask for this information if user is already logged it. I should find a way to insert this information automatically.&lt;/p&gt;</description>
			<guid isPermaLink="false">http://typo3bloke.net/post-details/howto_use_frontend_user_data_in_a_typo3_mailform/</guid>
			<content:encoded><![CDATA[<p class="bodytext">Today I had an interesting challenge. I had to create a contact form on the Intranet web site. This web site always has Frontend user logged in. I was going to use standard TYPO3 mailform. Typically such form contains fields for user name and e-mail. When I started to create the form, I immediately realized that it will be stupid to ask for this information if user is already logged it. I should find a way to insert this information automatically.</p>
<p class="bodytext"> The obvious solution that come to the mind is to make an extension that will modify the form to include Frontend user data. Yes, it is possible.</p>
<p class="bodytext">But what I like about TYPO3 is that lots of things are possible without PHP programming. And adding Frontend user data to mail form is possible with a simple TypoScript.&nbsp;Here it is: </p>
<p class="csc-frame-frame2">01: tt_content.mailform = COA_INT<br />02: tt_content.mailform.20.hiddenFields {<br />03:  &nbsp;&nbsp; name = TEXT<br />04:  &nbsp;&nbsp; name.data = TSFE:fe_user|user|username<br />05:  &nbsp;&nbsp; email = TEXT<br />06:  &nbsp;&nbsp; email.data = TSFE:fe_user|user|email<br />07: }</p>
<p class="bodytext">(This code assumes that you use CSS styled content, which you definitely should use now!)</p>
<p class="bodytext">Let's start with line 2. It adds hidden fields to the form. The &quot;hiddenFields&quot; property is an array of content objects. Name of the object becomes name of the form field. Value of the object becomes value of the field. In lines 3 to 4 and 5 to 6 I created two fields. I used &quot;data&quot; stdWrap property to fetch Frontend user data. If you do not know what is stdWrap or &quot;data&quot;, you can read about it in my <a href="http://typo3bloke.net/post-details/typo3_stdwrap_explained_part_1/" title="Article about TYPO3 stdWrap" target="_blank" class="external-link-new-window" >article about stdWrap</a>.</p>
<p class="bodytext">How does it look like in HTML? Here is a fragment:</p>
<p class="csc-frame-frame2">&lt;input type=&quot;hidden&quot; name=&quot;fromname&quot; value=&quot;test01&quot; /&gt;<br />&lt;input type=&quot;hidden&quot; name=&quot;frommail&quot; value=&quot;test@example.com&quot; /&gt;</p>
<p class="bodytext">What about line 1? Why is it there?</p>
<p class="bodytext">The answer is simple: you need to make form non-cacheable to avoid caching of the first user who visits this page. You need unique user name and e-mail.</p>
<h2>What if user is not logged in?</h2>
<p class="bodytext">If user is not logged in, you can use TypoScript conditions to add normal fields to the form.</p>
<h2>Extension or TypoScript?</h2>
<p class="bodytext">After making this part of code I remembered something. Several times I saw that people make extensions when several lines of TypoScript can do the same work. It reminds me that the first obvious solution is not always the best. There should be no rush with implementation. Careful thinking always produces much better result.</p>
<p class="bodytext">Did I already pronounced this before? Oh, yes. It was mentioned twice: once in my &quot;<a href="http://typo3bloke.net/post-details/background_thinking/" title="Make effective decisions: think on the background!" class="external-link-new-window" >Background thinking</a>&quot; article and second time during my &quot;<a href="http://typo3bloke.net/post-details/slides_from_productivity_session/" title="Slides from Personal productivity session" class="external-link-new-window" >Personal productivity</a>&quot; session in TYPO3 user group in the Netherlands in July 2008.</p>
<p class="bodytext">What do you think about it?</p>]]></content:encoded>
			<category>TYPO3 General</category>
			
			
			<pubDate>Tue, 22 Jul 2008 17:43:00 +0300</pubDate>
			
		</item>
		
		<item>
			<title>Slides from productivity session</title>
			<link>http://typo3bloke.net/post-details/slides_from_productivity_session/</link>
			<description>&lt;p class="bodytext"&gt;In July I had a session about personal productivity at TYPO3 user group in Holland. I planned to make video from these slides but I instead I decided another way to share slides. I put them to &lt;a href="http://www.slideshare.net/dulepov/personal-productivity" title="Slides from productivity session" target="_blank" class="external-link-new-window" &gt;SlideShare&lt;/a&gt;. You can also vote for these slides to participate in the &quot;World Best Presentation Contest' 08&quot;.&lt;/p&gt;
&lt;p class="bodytext"&gt;Enjoy!&lt;/p&gt;</description>
			<guid isPermaLink="false">http://typo3bloke.net/post-details/slides_from_productivity_session/</guid>
			<content:encoded><![CDATA[<p class="bodytext">In July I had a session about personal productivity at TYPO3 user group in Holland. I planned to make video from these slides but I instead I decided another way to share slides. I put them to <a href="http://www.slideshare.net/dulepov/personal-productivity" title="Slides from productivity session" target="_blank" class="external-link-new-window" >SlideShare</a>. You can also vote for these slides to participate in the &quot;World Best Presentation Contest' 08&quot;.</p>
<p class="bodytext">Enjoy!</p>]]></content:encoded>
			<category>Productivity</category>
			
			
			<pubDate>Mon, 21 Jul 2008 21:40:00 +0300</pubDate>
			
		</item>
		
		<item>
			<title>Nominate me as TYPO3 MVP!</title>
			<link>http://typo3bloke.net/post-details/nominate_me_as_typo3_mvp/</link>
			<description>&lt;p class="bodytext"&gt;Pack Publishing has &lt;a href="http://www.packtpub.com/award" title="Packt publishing 2008 Open Source CMS Award" target="_blank" class="external-link-new-window" &gt;announced&lt;/a&gt; its yearly &quot;2008 Open Source CMS Award&quot;. There are different categories, one of them is MVP, for person, who contributed a lot to the CMS.&lt;/p&gt;
&lt;p class="bodytext"&gt;I'd like to ask you nominate me if you think I deserve it. It is easy as &lt;a href="http://www.packtpub.com/article/nominate-open-source-cms-mvp" title="Nominate me as TYPO3 MVP!" target="_blank" class="external-link-new-window" &gt;filling the form&lt;/a&gt; and clicking &quot;Nominate&quot; button. Btw, you can win iPod Nano if you nominate someone.&lt;/p&gt;
&lt;p class="bodytext"&gt;Thank you in advance!&lt;/p&gt;
&lt;p class="bodytext"&gt;P.S. My name is &lt;b&gt;Dmitry Dulepov&lt;/b&gt;.&lt;/p&gt;</description>
			<guid isPermaLink="false">http://typo3bloke.net/post-details/nominate_me_as_typo3_mvp/</guid>
			<content:encoded><![CDATA[<p class="bodytext">Pack Publishing has <a href="http://www.packtpub.com/award" title="Packt publishing 2008 Open Source CMS Award" target="_blank" class="external-link-new-window" >announced</a> its yearly &quot;2008 Open Source CMS Award&quot;. There are different categories, one of them is MVP, for person, who contributed a lot to the CMS.</p>
<p class="bodytext">I'd like to ask you nominate me if you think I deserve it. It is easy as <a href="http://www.packtpub.com/article/nominate-open-source-cms-mvp" title="Nominate me as TYPO3 MVP!" target="_blank" class="external-link-new-window" >filling the form</a> and clicking &quot;Nominate&quot; button. Btw, you can win iPod Nano if you nominate someone.</p>
<p class="bodytext">Thank you in advance!</p>
<p class="bodytext">P.S. My name is <b>Dmitry Dulepov</b>.</p>]]></content:encoded>
			<category>TYPO3 General</category>
			
			
			<pubDate>Sun, 20 Jul 2008 14:26:00 +0300</pubDate>
			
		</item>
		
		<item>
			<title>Cruelty to animals</title>
			<link>http://typo3bloke.net/post-details/cruelty_to_animals/</link>
			<description>&lt;p class="bodytext"&gt;This is not really my topic. But I have two cats myself and I am shoked.&lt;/p&gt;
&lt;p class="bodytext"&gt;Warning: shoking image inside.&lt;/p&gt;</description>
			<guid isPermaLink="false">http://typo3bloke.net/post-details/cruelty_to_animals/</guid>
			<content:encoded><![CDATA[<p class="bodytext">This is not really my topic. But I have two cats myself and I am shoked.</p>
<p class="bodytext">Yesterday, July 17, near 11:00 two men, one of them said to be a teacher at <a href="http://www.lspa.lv/main.html" title="Latvian Sport Pedagogical Academy" target="_blank" class="external-link-new-window" >Latvian Sport Pedagogical Academy</a>, throw a small cat to their dog. The dog broke kitten's stomach.</p>
<p class="bodytext"><img src="http://typo3bloke.net/fileadmin/article-images/cruelty-to-animals/kitty.jpg" width="444" height="334" alt="" /></p>
<p class="bodytext"><b>Look in his eyes!</b> He probably came to people hoping to play with them. Small cats do this... But they threw him to the big dog as a piece of meat.</p>
<p class="bodytext"><img src="http://typo3bloke.net/fileadmin/article-images/cruelty-to-animals/kitty2.jpg" width="444" height="297" alt="" /></p>
<p class="bodytext">Police was called by people passing by. When arrived, police made a fine to dog's owner for walking with dog without muzzle. They did not want to register cruelty to the kitten.</p>
<p class="bodytext">Pure creature was in agony all time while transferred to animal hospital by rescue team. Doctors were not able to save it. They have to give the kitten deathly injection to stop his suffering.</p>
<p class="bodytext">State authorities will write an official letter to police asking to open a crime case. It is not clear if police will do it or not.</p>
<p class="bodytext">Latvia calls itself &quot;European country&quot;. So far only one was was prosecuted for cruelty to animals in Latvia. All others avoided prosecution.</p>]]></content:encoded>
			<category>Buzz</category>
			
			
			<pubDate>Fri, 18 Jul 2008 11:40:00 +0300</pubDate>
			
		</item>
		
		<item>
			<title>How to fill RealURL cache</title>
			<link>http://typo3bloke.net/post-details/how_to_fill_realurl_cache/</link>
			<description>&lt;p class="bodytext"&gt;From time to time I see this question: how to fill RealURL cache with page addresses?&lt;/p&gt;
&lt;p class="bodytext"&gt;The answer is pretty simple...&lt;/p&gt;</description>
			<guid isPermaLink="false">http://typo3bloke.net/post-details/how_to_fill_realurl_cache/</guid>
			<content:encoded><![CDATA[<p class="bodytext">From time to time I see this question: how to fill RealURL cache with page addresses?</p>
<p class="bodytext">The answer is pretty simple. Make a new &quot;hide in menu&quot; page. Insert Sitemap there. Logout from Backend. Enter that new page address in the browser bar.</p>
<p class="bodytext">Notice that logging out is essential. RealURL will not cache anything if you are logged in to Backend.</p>
<p class="bodytext">This procedure will fill cache with page addresses. But it will not create cached entries for stuff like tt_news. So this tip is good if you have mostly pages.</p>]]></content:encoded>
			<category>EXT:RealURL</category>
			
			
			<pubDate>Tue, 15 Jul 2008 21:51:00 +0300</pubDate>
			
		</item>
		
		<item>
			<title>Why substituteMarkerArrayCached is bad</title>
			<link>http://typo3bloke.net/post-details/why_substitutemarkerarraycached_is_bad/</link>
			<description>&lt;p class="bodytext"&gt;In the previous article we talked about TYPO3 template functions. I mentioned that  substituteMarkerArrayCached is a function that developers should not use. In this article I am going to explain why.&lt;/p&gt;
&lt;p class="bodytext"&gt;As you remember...&lt;/p&gt;</description>
			<guid isPermaLink="false">http://typo3bloke.net/post-details/why_substitutemarkerarraycached_is_bad/</guid>
			<content:encoded><![CDATA[<p class="bodytext">In the <a href="http://typo3bloke.net/post-details/using_templates_in_typo3_frontend_plugins/" title="Template functions in TYPO3" target="_top" class="external-link-new-window" >previous article</a> we talked about TYPO3 template functions. I mentioned that&nbsp; substituteMarkerArrayCached is a function that developers should not use. In this article I am going to explain why.</p>
<p class="bodytext">As you remember there are four “substitute” functions for use with TYPO3 templates:</p><ul><li>substituteMarker<br />This function substitutes a single marker</li><li>substituteMarkerArray<br />This function does the same as above but for many markers in the array</li><li>substituteSubpart<br />Substitutes a single subpart</li><li>substituteMarkerArrayCached<br />Our today's case.</li></ul><p class="bodytext">The first two functions substitute marker and marker array. The third substitutes template subpart. The obvious missing function is the one to substitute subpart array.</p>
<p class="bodytext">substituteMarkerArrayCached takes several arguments, three first are most interesting to us. It takes template, marker array and subpart array. It means that this function works almost like the function we just found missing. In other words, it can substitute subpart array:</p>
<p class="csc-frame-frame2">$content = $this-&gt;cObj-&gt;substituteMarkerArrayCached($template, array(), $subPartArray);</p>
<p class="bodytext">But there is a catch.</p>
<p class="bodytext">The catch is in the “Cached” word in the function name. This function caches its results and tries to reuse them next time. Caching happens in the cache_hash table.</p>
<p class="bodytext">It does not look bad from the first glance. It may even speed up the web site.</p>
<p class="bodytext">Does it really?</p>
<p class="bodytext">Imagine a web site with articles. Let's say 10000 articles. Each article has comments. Suppose that average number of comments is 10 per article. So, if comments use substituteMarkerArrayCached, it would lead to 100000 records in cache_hash table. Now imagine of each comment requires two calls to substituteMarkerArrayCached...</p>
<p class="bodytext">You can say: “Big deal! Disks are large and cheap now!”. Yes, they are. But it is not a disk space. It is MySQL who will suffer.</p>
<p class="bodytext">MySQL works very well with indexes. If it can locate a record using index, the speed can be fantastic. Autoincrement fields make a good index. This is a typical case for most tables in TYPO3. But cache_hash uses MD5 value as index. MD5 values look like random data for MySQL. They do not make good database indexes. So you can be easily out of luck with this table when think about indexes.</p>
<p class="bodytext">Another problem lies in a large number of records in this table. MySQL uses indexes only if it believes that it can save time by using them. If MySQL thinks that using index will not result in much performance gain, it will revert to full table scan. Imagine ful table scan on 100000 row table. Wouldn't non-cached version of substituteMarkerArrayCached be faster for a two entries in $subPartArray?</p>
<p class="bodytext">Unless you have really huge subpart and marker array, I recommend to avoid using substituteMarkerArrayCached at all. It can make performance better for really large substitutions but not for smaller ones. PHP code often runs faster than a single database query (especially if query goes over network).</p>
<p class="bodytext">You can replace a call to substituteMarkerArrayCached with the following code:</p>
<p class="csc-frame-frame2">$content = $this-&gt;cObj-&gt;substituteMarkerArray($template, $markers);<br />foreach ($subParts as $subPart =&gt; $subContent) {<br />&nbsp;&nbsp; &nbsp;$content = $this-&gt;cObj-&gt;substituteSubpart($content, $subPart, $subContent);<br />}</p>
<p class="bodytext">This is how comments extension is going to work starting from the next version.</p>
<h2>Summary</h2>
<p class="bodytext">substituteMarkerArrayCached is bad because it stores results in and fetches results from cache_hash table. This causes lots of records and slower execution for a simple substitutions. So do not this function unless your substitutions contain a lot of data.</p>]]></content:encoded>
			<category>Performance</category>
			
			
			<pubDate>Tue, 15 Jul 2008 18:12:00 +0300</pubDate>
			
		</item>
		
		<item>
			<title>Using templates in TYPO3 Frontend plugins</title>
			<link>http://typo3bloke.net/post-details/using_templates_in_typo3_frontend_plugins/</link>
			<description>&lt;p class="bodytext"&gt;Firsts, I wanted to write a warning article about the substituteMarkerArrayCached function. But then I understood that article is going to be about template functions in general and warning should be in the different article.&lt;/p&gt;
&lt;p class="bodytext"&gt;Let's have an overview of TYPO3 templates and functions to handle them.&lt;/p&gt;
&lt;h2&gt;TYPO3 template basics&lt;/h2&gt;
&lt;p class="bodytext"&gt;Templates in TYPO3 are normal HTML files. These files contain special markers that TYPO3 can replace with data. Markers typically are words in CAPS surrounded by three hash marks. For example: ###LINK###.&lt;/p&gt;
&lt;p class="bodytext"&gt;There are two types  of markers: single markers and subpart markers. Single markers is a single piece of data, it is replaced as is. Subpart markers surround parts of the HTML code. Here is an example:&lt;/p&gt;
&lt;p class="csc-frame-frame2"&gt;&lt;!-- ###LIST### begin --&gt;&lt;br /&gt;Repeating elements:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;!-- ###REPEATING### begin --&gt;&lt;br /&gt;&lt;li&gt;Iteration ###NUMBER###&lt;/li&gt;&lt;br /&gt;&lt;!-- ###REPEATING### end --&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;!-- ###LIST### end --&gt;&lt;/p&gt;
&lt;p class="bodytext"&gt;Here ###LIST### and ###REPEATING### are subpart markers. Extension can get a subpart and replace it as whole. Often it is used for repeating elements of for subparts that should be removed under certain conditions. “begin” and “end” are not necessary but conventional.&lt;/p&gt;
&lt;p class="bodytext"&gt;###NUMBER### is a single marker.&lt;/p&gt;
&lt;h2&gt;Template functions in TYPO3 Frontend&lt;/h2&gt;
&lt;p class="bodytext"&gt;TYPO3 has functions to work with templates. Extension authors may use these function to process markers.&lt;/p&gt;
&lt;p class="bodytext"&gt;The functions are located in class tslib_cObj and available in Frontend plugins through $this-&gt;cObj. Here is the list:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;getSubpart&lt;br /&gt;Obtains a subpart from template&lt;/li&gt;&lt;li&gt;substituteMarker&lt;br /&gt;This function substitutes a single marker. Just that.&lt;/li&gt;&lt;li&gt;substituteMarkerArray&lt;br /&gt;This function does the same as above but for many markers in the array&lt;/li&gt;&lt;li&gt;substituteSubpart&lt;br /&gt;Substitutes a single subpart&lt;/li&gt;&lt;li&gt;substituteMarkerArrayCached&lt;br /&gt;This is a bad function that you should not use. &lt;a href="http://typo3bloke.net/post-details/why_substitutemarkerarraycached_is_bad/" title="Explains why substituteMarkerArrayCached is bad" target="_blank" class="external-link-new-window" &gt;Read why&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;p class="bodytext"&gt;As you see, there is no function to substitute subpart array. You have to do it in a loop for each subpart.&lt;/p&gt;
&lt;h2&gt;Using TYPO3 template functions&lt;/h2&gt;
&lt;p class="bodytext"&gt;But let's see code example. Example assumes that HTML template is located in $this-&gt;templateCode.&lt;/p&gt;
&lt;p class="csc-frame-frame2"&gt;function generateRepeatingContent() {&lt;br /&gt;    // Get template&lt;br /&gt;    $template = $this-&gt;cObj-&gt;getSubpart($this-&gt;templateCode, '###LIST###');&lt;br /&gt;    // Get subpart template&lt;br /&gt;    $subTemplate = $this-cObj-&gt;getSubpart($template, '###REPEATING###');&lt;br /&gt;    // Loop to create repeating content&lt;br /&gt;    $subPartContent = '';&lt;br /&gt;    for ($i = 1; $i &lt;= 10; $i++) {&lt;br /&gt;        $subPartContent .= $this-&gt;cObj-&gt;substituteMarker($subTemplate,&lt;br /&gt;            '###NUMBER###', $i);&lt;br /&gt;    }&lt;br /&gt;    // Substitute subpart&lt;br /&gt;    return $this-&gt;cObj-&gt;substituteSubpart($template, '###REPEATING###',&lt;br /&gt;        $subPartContent);&lt;br /&gt;}&lt;/p&gt;
&lt;p class="bodytext"&gt;This example uses the same template as shown above.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p class="bodytext"&gt;This is how easy to use templates in TYPO3. So when you develop extension next time, you can make it better by providing templatable output for your extension.&lt;/p&gt;</description>
			<guid isPermaLink="false">http://typo3bloke.net/post-details/using_templates_in_typo3_frontend_plugins/</guid>
			<content:encoded><![CDATA[<p class="bodytext">Firsts, I wanted to write a warning article about the substituteMarkerArrayCached function. But then I understood that article is going to be about template functions in general and warning should be in the different article.</p>
<p class="bodytext">Let's have an overview of TYPO3 templates and functions to handle them.</p>
<h2>TYPO3 template basics</h2>
<p class="bodytext">Templates in TYPO3 are normal HTML files. These files contain special markers that TYPO3 can replace with data. Markers typically are words in CAPS surrounded by three hash marks. For example: ###LINK###.</p>
<p class="bodytext">There are two types&nbsp; of markers: single markers and subpart markers. Single markers is a single piece of data, it is replaced as is. Subpart markers surround parts of the HTML code. Here is an example:</p>
<p class="csc-frame-frame2">&lt;!-- ###LIST### begin --&gt;<br />Repeating elements:<br />&lt;ul&gt;<br />&lt;!-- ###REPEATING### begin --&gt;<br />&lt;li&gt;Iteration ###NUMBER###&lt;/li&gt;<br />&lt;!-- ###REPEATING### end --&gt;<br />&lt;/ul&gt;<br />&lt;!-- ###LIST### end --&gt;</p>
<p class="bodytext">Here ###LIST### and ###REPEATING### are subpart markers. Extension can get a subpart and replace it as whole. Often it is used for repeating elements of for subparts that should be removed under certain conditions. “begin” and “end” are not necessary but conventional.</p>
<p class="bodytext">###NUMBER### is a single marker.</p>
<h2>Template functions in TYPO3 Frontend</h2>
<p class="bodytext">TYPO3 has functions to work with templates. Extension authors may use these function to process markers.</p>
<p class="bodytext">The functions are located in class tslib_cObj and available in Frontend plugins through $this-&gt;cObj. Here is the list:</p><ul><li>getSubpart<br />Obtains a subpart from template</li><li>substituteMarker<br />This function substitutes a single marker. Just that.</li><li>substituteMarkerArray<br />This function does the same as above but for many markers in the array</li><li>substituteSubpart<br />Substitutes a single subpart</li><li>substituteMarkerArrayCached<br />This is a bad function that you should not use. <a href="http://typo3bloke.net/post-details/why_substitutemarkerarraycached_is_bad/" title="Explains why substituteMarkerArrayCached is bad" target="_blank" class="external-link-new-window" >Read why</a>.</li></ul><p class="bodytext">As you see, there is no function to substitute subpart array. You have to do it in a loop for each subpart.</p>
<h2>Using TYPO3 template functions</h2>
<p class="bodytext">But let's see code example. Example assumes that HTML template is located in $this-&gt;templateCode.</p>
<p class="csc-frame-frame2">function generateRepeatingContent() {<br />&nbsp;&nbsp; &nbsp;// Get template<br />&nbsp;&nbsp; &nbsp;$template = $this-&gt;cObj-&gt;getSubpart($this-&gt;templateCode, '###LIST###');<br />&nbsp;&nbsp; &nbsp;// Get subpart template<br />&nbsp;&nbsp; &nbsp;$subTemplate = $this-cObj-&gt;getSubpart($template, '###REPEATING###');<br />&nbsp;&nbsp; &nbsp;// Loop to create repeating content<br />&nbsp;&nbsp; &nbsp;$subPartContent = '';<br />&nbsp;&nbsp; &nbsp;for ($i = 1; $i &lt;= 10; $i++) {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;$subPartContent .= $this-&gt;cObj-&gt;substituteMarker($subTemplate,<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;'###NUMBER###', $i);<br />&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;// Substitute subpart<br />&nbsp;&nbsp; &nbsp;return $this-&gt;cObj-&gt;substituteSubpart($template, '###REPEATING###',<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $subPartContent);<br />}</p>
<p class="bodytext">This example uses the same template as shown above.</p>
<h2>Conclusion</h2>
<p class="bodytext">This is how easy to use templates in TYPO3. So when you develop extension next time, you can make it better by providing templatable output for your extension.</p>]]></content:encoded>
			<category>Extensions</category>
			
			
			<pubDate>Fri, 11 Jul 2008 21:23:00 +0300</pubDate>
			
		</item>
		
		<item>
			<title>&quot;TYPO3 Core Overview&quot; presentation</title>
			<link>http://typo3bloke.net/post-details/typo3_core_overview_presentation/</link>
			<description>&lt;p class="bodytext"&gt;On July 4th I made two presentations at TYPO3 user group in Netherlands. The first was about TYPO3 core and the second is about being productive.&lt;/p&gt;
&lt;p class="bodytext"&gt;I got a lot of requests for these slides and I  promised to put them online. Here is the TYPO3 core presentation. It did not contain much text on the slides, so I made a QuickTime videos. Videos are available in two sizes:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://typo3bloke.net/fileadmin/presentations/typo3-core-overview-small.mov" title="Initiates file download" class="download" &gt;Small&lt;/a&gt; (256x192, 4.6MB)&lt;/li&gt;&lt;li&gt;&lt;a href="http://typo3bloke.net/fileadmin/presentations/typo3-core-overview-middle.mov" title="Initiates file download" class="download" &gt;Medium&lt;/a&gt; (512x384, 9MB)&lt;/li&gt;&lt;/ul&gt;&lt;p class="bodytext"&gt;I must tell that this is my first experience in making video out of presentations, so I apologize for any problems in the video. People in TUG liked the presentation and I hope you all like the video.&lt;/p&gt;
&lt;p class="bodytext"&gt;This video will also be available through &lt;a href="http://typo3.nl/" title="Dutch TYPO3 web site" target="_blank" class="external-link-new-window" &gt;typo3.nl&lt;/a&gt; web site. &lt;/p&gt;
&lt;p class="bodytext"&gt;License &amp; disclamer: anyone can freely copy and distribute these movies without modification (no cutting or extracts permitted). I tried to make facts as accurate as possible but you need to check them if you want to use them for commercial purposes. I am not going to be responsible for misuse of this material or any loses that come from it.&lt;/p&gt;
&lt;p class="bodytext"&gt;[Update, July 21, 2008] Now you can also see these slides on &lt;a href="http://www.slideshare.net/dulepov/typo3-core-overview/" title="TYPO3 core Overview on SlideShare" target="_blank" class="external-link-new-window" &gt;SlideShare&lt;/a&gt; but without audio.&lt;/p&gt;</description>
			<guid isPermaLink="false">http://typo3bloke.net/post-details/typo3_core_overview_presentation/</guid>
			<content:encoded><![CDATA[<p class="bodytext">On July 4th I made two presentations at TYPO3 user group in Netherlands. The first was about TYPO3 core and the second is about being productive.</p>
<p class="bodytext">I got a lot of requests for these slides and I  promised to put them online. Here is the TYPO3 core presentation. It did not contain much text on the slides, so I made a QuickTime videos. Videos are available in two sizes:</p><ul><li><a href="http://typo3bloke.net/fileadmin/presentations/typo3-core-overview-small.mov" title="Initiates file download" class="download" >Small</a> (256x192, 4.6MB)</li><li><a href="http://typo3bloke.net/fileadmin/presentations/typo3-core-overview-middle.mov" title="Initiates file download" class="download" >Medium</a> (512x384, 9MB)</li></ul><p class="bodytext">I must tell that this is my first experience in making video out of presentations, so I apologize for any problems in the video. People in TUG liked the presentation and I hope you all like the video.</p>
<p class="bodytext">This video will also be available through <a href="http://typo3.nl/" title="Dutch TYPO3 web site" target="_blank" class="external-link-new-window" >typo3.nl</a> web site. </p>
<p class="bodytext">License &amp; disclamer: anyone can freely copy and distribute these movies without modification (no cutting or extracts permitted). I tried to make facts as accurate as possible but you need to check them if you want to use them for commercial purposes. I am not going to be responsible for misuse of this material or any loses that come from it.</p>
<p class="bodytext">[Update, July 21, 2008] Now you can also see these slides on <a href="http://www.slideshare.net/dulepov/typo3-core-overview/" title="TYPO3 core Overview on SlideShare" target="_blank" class="external-link-new-window" >SlideShare</a> but without audio.</p>]]></content:encoded>
			<category>TYPO3 General</category>
			
			
			<pubDate>Thu, 10 Jul 2008 21:43:00 +0300</pubDate>
			
		</item>
		
		<item>
			<title>How to kill TYPO3 performance from extension</title>
			<link>http://typo3bloke.net/post-details/how_to_kill_typo3_performance_from_extension/</link>
			<description>&lt;p class="bodytext"&gt;Today I went to check &lt;a href="http://buzz.typo3.org/" title="TYPO3 community blogging web site" target="_blank" class="external-link-new-window" &gt;buzz.typo3.org&lt;/a&gt; for new articles. I scanned through some when I came across the article named &quot;&lt;a href="http://buzz.typo3.org/article/dynamic-caching-in-typo3/" title="The article with major performance implications" target="_blank" class="external-link-new-window" &gt;Dynamic Caching in TYPO3&lt;/a&gt;&quot;. The article is interesting because it describes unusual techniques related to caching. But author does one &quot;not-so-good&quot; thing. He promotes the use of $TSFE-&gt;set_no_cache(). As I said many times, this is &lt;b&gt;evil&lt;/b&gt; and should be avoided at all costs! Search for another solution, do whatever tricks but never ever use set_no_cache()! It will kill your web site under any serious load.&lt;/p&gt;
&lt;p class="bodytext"&gt;It is not a big problem for the particular case described in that article. In the article this function will be used only for a logged-in user who views his own card. But readers may learn about the function and start using it in extensions without realizing what they do. That's bad. We had a problem some time ago in commerce extension, which disabled caching for the whole web site and made the site extremely sloooooooow and created huge load on the server. Bad. Too bad. I wish all writers make a &lt;b&gt;bold warning&lt;/b&gt; when mentioning this function: &lt;b&gt;dangerous!&lt;/b&gt;&lt;/p&gt;
&lt;p class="bodytext"&gt;Last week I made a performance review of yet another web site and yet again (again and again!) I found problems caused by misuse of set_no_cache(). It was found in three extensions (download, link list and one proprietary). It is typically the set_no_cache-case when people ask why their site has such a bad performance. If it only were in my power, I would go to TER and remove all extensions that use set_no_cache().&lt;/p&gt;
&lt;p class="bodytext"&gt;Don't use this function! It is for core only! It is not for you! Avoid at all costs!&lt;/p&gt;</description>
			<guid isPermaLink="false">http://typo3bloke.net/post-details/how_to_kill_typo3_performance_from_extension/</guid>
			<content:encoded><![CDATA[<p class="bodytext">Today I went to check <a href="http://buzz.typo3.org/" title="TYPO3 community blogging web site" target="_blank" class="external-link-new-window" >buzz.typo3.org</a> for new articles. I scanned through some when I came across the article named &quot;<a href="http://buzz.typo3.org/article/dynamic-caching-in-typo3/" title="The article with major performance implications" target="_blank" class="external-link-new-window" >Dynamic Caching in TYPO3</a>&quot;. The article is interesting because it describes unusual techniques related to caching. But author does one &quot;not-so-good&quot; thing. He promotes the use of $TSFE-&gt;set_no_cache(). As I said many times, this is <b>evil</b> and should be avoided at all costs! Search for another solution, do whatever tricks but never ever use set_no_cache()! It will kill your web site under any serious load.</p>
<p class="bodytext">It is not a big problem for the particular case described in that article. In the article this function will be used only for a logged-in user who views his own card. But readers may learn about the function and start using it in extensions without realizing what they do. That's bad. We had a problem some time ago in commerce extension, which disabled caching for the whole web site and made the site extremely sloooooooow and created huge load on the server. Bad. Too bad. I wish all writers make a <b>bold warning</b> when mentioning this function: <b>dangerous!</b></p>
<p class="bodytext">Last week I made a performance review of yet another web site and yet again (again and again!) I found problems caused by misuse of set_no_cache(). It was found in three extensions (download, link list and one proprietary). It is typically the set_no_cache-case when people ask why their site has such a bad performance. If it only were in my power, I would go to TER and remove all extensions that use set_no_cache().</p>
<p class="bodytext">Don't use this function! It is for core only! It is not for you! Avoid at all costs!</p>]]></content:encoded>
			<category>Performance</category>
			
			
			<pubDate>Mon, 30 Jun 2008 11:40:00 +0300</pubDate>
			
		</item>
		
	</channel>
</rss>