<?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>TYPO3 &#8211; Aimeos</title>
	<atom:link href="https://aimeos.org/tips/tag/typo3/feed/" rel="self" type="application/rss+xml" />
	<link>https://aimeos.org/tips</link>
	<description>ultra fast PHP e-commerce framework</description>
	<lastBuildDate>Tue, 23 Jul 2024 07:31:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.7.8</generator>

<image>
	<url>https://aimeos.org/tips/wp-content/uploads/2019/09/Aimeos_e_200-100x104.png</url>
	<title>TYPO3 &#8211; Aimeos</title>
	<link>https://aimeos.org/tips</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Aimeos 2023.10 LTS release</title>
		<link>https://aimeos.org/tips/aimeos-2023-10-lts-release/</link>
					<comments>https://aimeos.org/tips/aimeos-2023-10-lts-release/#comments</comments>
		
		<dc:creator><![CDATA[aimeos]]></dc:creator>
		<pubDate>Wed, 25 Oct 2023 08:23:40 +0000</pubDate>
				<category><![CDATA[e-commerce]]></category>
		<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Releases]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[TYPO3]]></category>
		<category><![CDATA[ecommerce]]></category>
		<category><![CDATA[laravel]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[release]]></category>
		<guid isPermaLink="false">https://aimeos.org/tips/?p=1005</guid>

					<description><![CDATA[The 2023.10 version of the Aimeos e-commerce framework for Laravel and TYPO3 is available now! Especially developers will love the 2023 version because it contains a lot of simplifications and fully supports scaleable cloud setups like Kubernetes natively. The most<span class="ellipsis">&#8230;</span><div class="read-more"><a href="https://aimeos.org/tips/aimeos-2023-10-lts-release/">Read more <span class="screen-reader-text">Aimeos 2023.10 LTS release</span><span class="meta-nav"> &#8250;</span></a></div><!-- end of .read-more -->]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><a href="https://aimeos.org/tips/wp-content/uploads/2021/10/aimeos-release-rect-big.jpg"><img width="1024" height="538" src="https://aimeos.org/tips/wp-content/uploads/2021/10/aimeos-release-rect-big-1024x538.jpg" alt="" class="wp-image-887" srcset="https://aimeos.org/tips/wp-content/uploads/2021/10/aimeos-release-rect-big-1024x538.jpg 1024w, https://aimeos.org/tips/wp-content/uploads/2021/10/aimeos-release-rect-big-300x158.jpg 300w, https://aimeos.org/tips/wp-content/uploads/2021/10/aimeos-release-rect-big-768x403.jpg 768w, https://aimeos.org/tips/wp-content/uploads/2021/10/aimeos-release-rect-big-100x53.jpg 100w, https://aimeos.org/tips/wp-content/uploads/2021/10/aimeos-release-rect-big-150x79.jpg 150w, https://aimeos.org/tips/wp-content/uploads/2021/10/aimeos-release-rect-big-200x105.jpg 200w, https://aimeos.org/tips/wp-content/uploads/2021/10/aimeos-release-rect-big-450x236.jpg 450w, https://aimeos.org/tips/wp-content/uploads/2021/10/aimeos-release-rect-big-600x315.jpg 600w, https://aimeos.org/tips/wp-content/uploads/2021/10/aimeos-release-rect-big-900x473.jpg 900w, https://aimeos.org/tips/wp-content/uploads/2021/10/aimeos-release-rect-big.jpg 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>



<p>The 2023.10 version of the Aimeos e-commerce framework for Laravel and TYPO3 is available now! Especially developers will love the 2023 version because it contains a lot of simplifications and fully supports scaleable cloud setups like Kubernetes natively. The most important updates in 2023 are:</p>



<ul><li>Laravel 10 distributions</li><li>TYPO3 12 support</li><li>Kubernetes/Serverless support</li><li>Create managers easily</li><li>Merged order and order base</li><li>Stored basket panel</li><li>DB-based translations for type names</li><li>VueJS and GraphQL in backend</li></ul>



<span id="more-1005"></span>



<h2>Laravel 10 distributions</h2>



<div class="wp-block-image"><figure class="alignright size-large"><a href="https://aimeos.org/tips/wp-content/uploads/2021/10/laravel6.png"><img width="126" height="130" src="https://aimeos.org/tips/wp-content/uploads/2021/10/laravel6.png" alt="" class="wp-image-863" srcset="https://aimeos.org/tips/wp-content/uploads/2021/10/laravel6.png 126w, https://aimeos.org/tips/wp-content/uploads/2021/10/laravel6-100x103.png 100w" sizes="(max-width: 126px) 100vw, 126px" /></a></figure></div>



<p>Since the Laravel 10 release in February 2023, Aimeos fully supports the latest Laravel version and since 2023.04, the Aimeos headless and full stack distribution are based on Laravel 10. You can bootstrap your own Aimeos application in less than five minutes using those distributions and get a fully working Laravel 10 application. This also includes pre-configured authentication setup for both, the full stack and the headless distribution.</p>



<h2>TYPO3 12 support</h2>



<div class="wp-block-image"><figure class="alignleft size-large"><a href="https://aimeos.org/tips/wp-content/uploads/2021/10/typo3.png"><img width="128" height="128" src="https://aimeos.org/tips/wp-content/uploads/2021/10/typo3.png" alt="" class="wp-image-864" srcset="https://aimeos.org/tips/wp-content/uploads/2021/10/typo3.png 128w, https://aimeos.org/tips/wp-content/uploads/2021/10/typo3-100x100.png 100w" sizes="(max-width: 128px) 100vw, 128px" /></a></figure></div>



<p>Also, Aimeos 2023.x fully supports TYPO3 12.4 since it&#8217;s release in April. Many changes has happened in v12 compared to v11, especially a lot of deprecated code has been removed. This made it very hard to make Aimeos 2023.x available for TYPO3 v11 too so we&#8217;ve decided to support v12 only in that release. Therefore, if you need a feature from Aimeos 2023.x or want to upgrade after two years of free support, you must upgrade to the latest TYPO3 v12 too.</p>



<h2>Kubernetes/Serverless support</h2>



<p>We are proud to announce that Aimeos 2023+ is the first cloud-native e-commerce solution for Laravel. Everything including file imports can be distributed across any cloud environment like Kubernetes, AWS, Google Cloud, Azure or so called serverless environments now. Aimeos for Laravel is cloud-ready since the beginning and images/CSS/JS files can be stored in S3 or similar cloud storage services but files were read only from a local file system. This this year, you can store files for importing products, categories, users, etc. from any remote server regardless if they are in CSV or XML format.</p>



<p>We also moved our complete server infrastructure from traditional hosting to a private Kubernetes cloud beginning this year including the web sites, demo setups and private package repository.</p>



<h2>Create managers easily</h2>



<p>Extending existing managers is extremely simply but writing new managers for own data domains or extending existing data domains required a lot of boilerplate code in the past. Since 2023.10, creating new managers is as easy as extending managers now.</p>



<p>First of all, create a setup task for the database migration as before:</p>



<pre class="wp-block-code"><code>namespace Aimeos\Upscheme\Task;

class Test extends Base
{
    public function up()
    {
        $this-&gt;info( 'Creating test schema', 'v' );

        $this-&gt;db( 'db-test' )-&gt;table( $name, function( $table ) {
            $table-&gt;engine = 'InnoDB';

             $table-&gt;id()-&gt;primary( 'pk_mstes_id' );
             $table-&gt;string( 'siteid' );
             $table-&gt;string( 'label' )-&gt;default( '' );
             $table-&gt;int( 'position' )-&gt;default( 0 );
             $table-&gt;smallint( 'status' )-&gt;default( 1 );
             $table-&gt;meta();
         } );
    }
}</code></pre>



<p>Then, create the manager for the new domain named &#8220;test&#8221;:</p>



<pre class="wp-block-code"><code>namespace Aimeos\MShop\Test\Manager;

class Standard
    extends \Aimeos\MShop\Common\Manager\Base
    implements \Aimeos\MShop\Common\Manager\Iface
{
    public function getSaveAttributes() : array
    {
        return $this-&gt;createAttributes( &#91;
            'label' =&gt; &#91;
            ],
            'status' =&gt; &#91;
                'type' =&gt; 'int',
            ],
            'position' =&gt; &#91;
                'type' =&gt; 'int',
                'label' =&gt; 'Position for sorting'
            ],
        ] );
    }
}</code></pre>



<p>That&#8217;s all! You can work with your new manager like with any other manager from the Aimeos core:</p>



<pre class="wp-block-code"><code>$manager = \Aimeos\MShop::create( $this-&gt;context(), 'test' )

$item = $manager-&gt;create()
    -&gt;set( 'label', 'test label' )
    -&gt;set( 'position', 2 )
    -&gt;set( 'status', 1 );

$item = $manager-&gt;save( $item );

$label = $item-&gt;label;
// or using get() with default value
$label = $item-&gt;get( 'label', 'default value' );</code></pre>



<p>For more information, there&#8217;s an article about <a href="https://aimeos.org/docs/latest/models/create-managers/">creating new managers</a> in the Aimeos documentation.</p>



<h2>Merged order and order base</h2>



<p>The biggest architectural change since the beginning is simplifying the order data domain by merging the order and order base tables/managers/items. The initial idea behind was that we can have several invoice/refund entries for each stored order base item (=basket) but that turned out to not work well over the years and complicated handling orders a lot. Thus, the data is all stored in the order record now.</p>



<p>That leads to some consequences, especially for the JSON:API as this change isn&#8217;t backward compatible! An application using the JSON:API doesn&#8217;t need to use the order endpoint any more to create an order item because the basket endpoint did that already. Furthermore, the property names in the basket changed and &#8220;.base&#8221; has to be removed.</p>



<p>The JSON:API has been backward compatible for six years (2017-2022) and we want to keep v2 stable for the next 5-10 years now.</p>



<h2>Stored basket panel</h2>



<div class="wp-block-image"><figure class="alignright size-medium"><a href="https://aimeos.org/tips/wp-content/uploads/2023/10/saved-basket.png"><img width="300" height="180" src="https://aimeos.org/tips/wp-content/uploads/2023/10/saved-basket-300x180.png" alt="" class="wp-image-1009" srcset="https://aimeos.org/tips/wp-content/uploads/2023/10/saved-basket-300x180.png 300w, https://aimeos.org/tips/wp-content/uploads/2023/10/saved-basket-1024x614.png 1024w, https://aimeos.org/tips/wp-content/uploads/2023/10/saved-basket-768x461.png 768w, https://aimeos.org/tips/wp-content/uploads/2023/10/saved-basket-1536x922.png 1536w, https://aimeos.org/tips/wp-content/uploads/2023/10/saved-basket-100x60.png 100w, https://aimeos.org/tips/wp-content/uploads/2023/10/saved-basket-150x90.png 150w, https://aimeos.org/tips/wp-content/uploads/2023/10/saved-basket-200x120.png 200w, https://aimeos.org/tips/wp-content/uploads/2023/10/saved-basket-450x270.png 450w, https://aimeos.org/tips/wp-content/uploads/2023/10/saved-basket-600x360.png 600w, https://aimeos.org/tips/wp-content/uploads/2023/10/saved-basket-900x540.png 900w, https://aimeos.org/tips/wp-content/uploads/2023/10/saved-basket.png 2000w" sizes="(max-width: 300px) 100vw, 300px" /></a></figure></div>



<p>Customer baskets are stored in the database during some time and now, the admin backend contains a new &#8220;Sales &gt; Baskets&#8221; Panel in the admin backend. Administrators and editors can check saved and abandoned baskets of the customers and it&#8217;s also possible to send emails to 3rd party applications for reminding customers about their abandoned carts.</p>



<h2>DB-based translations for type names</h2>



<div class="wp-block-image"><figure class="alignleft size-medium"><a href="https://aimeos.org/tips/wp-content/uploads/2023/10/type-translations.png"><img width="300" height="180" src="https://aimeos.org/tips/wp-content/uploads/2023/10/type-translations-300x180.png" alt="" class="wp-image-1011" srcset="https://aimeos.org/tips/wp-content/uploads/2023/10/type-translations-300x180.png 300w, https://aimeos.org/tips/wp-content/uploads/2023/10/type-translations-1024x614.png 1024w, https://aimeos.org/tips/wp-content/uploads/2023/10/type-translations-768x461.png 768w, https://aimeos.org/tips/wp-content/uploads/2023/10/type-translations-1536x922.png 1536w, https://aimeos.org/tips/wp-content/uploads/2023/10/type-translations-100x60.png 100w, https://aimeos.org/tips/wp-content/uploads/2023/10/type-translations-150x90.png 150w, https://aimeos.org/tips/wp-content/uploads/2023/10/type-translations-200x120.png 200w, https://aimeos.org/tips/wp-content/uploads/2023/10/type-translations-450x270.png 450w, https://aimeos.org/tips/wp-content/uploads/2023/10/type-translations-600x360.png 600w, https://aimeos.org/tips/wp-content/uploads/2023/10/type-translations-900x540.png 900w, https://aimeos.org/tips/wp-content/uploads/2023/10/type-translations.png 2000w" sizes="(max-width: 300px) 100vw, 300px" /></a></figure></div>



<p>Before, translations for attribute types were only possible by translating them statically the Gettext translation files or in the Aimeos configuration. Thus, only developers were able to update these translations and it was difficult to update translations if they have been delivered by ERP systems.</p>



<p>Now, type translations are saved in the database along with the types and can be edited in the admin backend and updated easily by ERP systems. This is available for all types, not only attribute types.</p>



<h2>VueJS and GraphQL in backend</h2>



<p>Several panels have been rewritten in the admin backend to use VueJS components now. This lead to better code quality and is another step forward to remove all jQuery-related code in the next versions. Also, VueJS components for which no VueJS 3 version is available has been replaced by better supported ones, namely the combo box select components which have been replaced by Vue Multiselect now. Finally, this will make the upgrade to VueJS 3 possible in the next versions.</p>



<p>Furthermore, requests to the JSON admin API has been replaced by requests to the new GraphQL API where possible. We will continue to extend the GraphQL API and replace existing JSON admin API requests until we completely phased out the JSON admin API. In 2024.x, the JSON admin API will be also marked as deprecated. The frontend JSON:API will never be replaced and will be the only way for frontends to interact with Aimeos servers as GraphQL is not suited well for read-heavy applications like e-commerce apps.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://aimeos.org/tips/aimeos-2023-10-lts-release/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>How to use the TYPO3 caching framework with cache groups</title>
		<link>https://aimeos.org/tips/how-to-use-the-typo3-caching-framework-with-cache-groups/</link>
					<comments>https://aimeos.org/tips/how-to-use-the-typo3-caching-framework-with-cache-groups/#respond</comments>
		
		<dc:creator><![CDATA[aimeos]]></dc:creator>
		<pubDate>Tue, 25 Aug 2015 10:52:53 +0000</pubDate>
				<category><![CDATA[TYPO3]]></category>
		<category><![CDATA[cache group]]></category>
		<category><![CDATA[caching framework]]></category>
		<guid isPermaLink="false">https://aimeos.org/tips/?p=139</guid>

					<description><![CDATA[The TYPO3 caching framework is a great way to speed up your site if your extension needs to perform tasks that can be cached. In the Aimeos TYPO3 extension, we use it to store content like list or detail views<span class="ellipsis">&#8230;</span><div class="read-more"><a href="https://aimeos.org/tips/how-to-use-the-typo3-caching-framework-with-cache-groups/">Read more <span class="screen-reader-text">How to use the TYPO3 caching framework with cache groups</span><span class="meta-nav"> &#8250;</span></a></div><!-- end of .read-more -->]]></description>
										<content:encoded><![CDATA[<p>The TYPO3 caching framework is a great way to speed up your site if your extension needs to perform tasks that can be cached. In the <a href="http://typo3.org/extensions/repository/view/aimeos">Aimeos TYPO3 extension</a>, we use it to store content like list or detail views of the web shop to get lightning fast response times. Since version 6.2, a cache can belong to one or more cache groups in the caching framework and it enables editors to control more precisely which caches should be flushed. Unfortunately, this features isn&#8217;t well documented yet in the TYPO3 documentation but here&#8217;s the remedy!</p>
<p><span id="more-139"></span></p>
<h2>What are cache groups</h2>
<p>In the TYPO3 caching framework, there are currently three types of caches:</p>
<ul>
<li><strong>pages</strong> : Front-end related caches</li>
<li><strong>system</strong> : Low-level caches that shouldn&#8217;t normally be flushed</li>
<li><strong>all</strong> : All other caches that don&#8217;t fall into one of the two categories before</li>
</ul>
<p>Based on the cache type (a.k.a cache group) the caches are flushed on different occasions. This makes a difference for the editors because depending on what they have changed, most often one of the cache groups will be flushed as well. Also, there are at least two options available when editors decide to flush the caches manually:</p>
<p><a href="https://aimeos.org/tips/wp-content/uploads/2015/08/Aimeos-typo3-cache7.png"><img class="aligncenter wp-image-142" src="https://aimeos.org/tips/wp-content/uploads/2015/08/Aimeos-typo3-cache7.png" alt="Aimeos-typo3-cache7" width="300" height="150" srcset="https://aimeos.org/tips/wp-content/uploads/2015/08/Aimeos-typo3-cache7.png 300w, https://aimeos.org/tips/wp-content/uploads/2015/08/Aimeos-typo3-cache7-100x50.png 100w, https://aimeos.org/tips/wp-content/uploads/2015/08/Aimeos-typo3-cache7-150x75.png 150w, https://aimeos.org/tips/wp-content/uploads/2015/08/Aimeos-typo3-cache7-200x100.png 200w" sizes="(max-width: 300px) 100vw, 300px" /></a>The first option will only flush front-end related caches while the second one flushes all caches that are not in the &#8220;system&#8221; or &#8220;pages&#8221; cache group. Flushing the &#8220;system&#8221; caches isn&#8217;t that easy any more but those don&#8217;t need to be cleared at all by editors. Instead, they are automatically flushed if e.g. a new extension is installed.</p>
<p>Therefore, it makes sense to tell TYPO3 which cache group your cache should be in if you use the caching framework to store data temporarily. This allows at least editors to selectively flush caches instead of the famous &#8220;flush all caches to be sure&#8221;! More information about which cache in in which cache group can be found in the article about the <a href="https://docs.typo3.org/typo3cms/CoreApiReference/CachingFramework/Architecture/Index.html#caching-architecture-core">TYPO3 caching architecture</a>.</p>
<h2>Set up your extension cache</h2>
<p>To create your own cache in your TYPO3 extension, there are only a few lines in the <code>ext_localconf.php</code> of your extension necessary. You can copy and paste these lines and only have to replace the <code>aimeos</code> string by the name of your own TYPO3 extension:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="php"><pre class="de1"><span class="kw1">if</span><span class="br0">&#40;</span> <span class="sy0">!</span><span class="kw3">is_array</span><span class="br0">&#40;</span> <span class="re0">$TYPO3_CONF_VARS</span><span class="br0">&#91;</span><span class="st_h">'SYS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'caching'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'cacheConfigurations'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'aimeos'</span><span class="br0">&#93;</span> <span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span>
    <span class="re0">$TYPO3_CONF_VARS</span><span class="br0">&#91;</span><span class="st_h">'SYS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'caching'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'cacheConfigurations'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'aimeos'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="kw3">array</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="kw1">if</span><span class="br0">&#40;</span> <span class="sy0">!</span><span class="kw3">isset</span><span class="br0">&#40;</span><span class="re0">$TYPO3_CONF_VARS</span><span class="br0">&#91;</span><span class="st_h">'SYS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'caching'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'cacheConfigurations'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'aimeos'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'frontend'</span><span class="br0">&#93;</span> <span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span>
    <span class="re0">$TYPO3_CONF_VARS</span><span class="br0">&#91;</span><span class="st_h">'SYS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'caching'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'cacheConfigurations'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'aimeos'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'frontend'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st_h">'TYPO3\\CMS\\Core\\Cache\\Frontend\\StringFrontend'</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="kw1">if</span><span class="br0">&#40;</span> <span class="sy0">!</span><span class="kw3">isset</span><span class="br0">&#40;</span><span class="re0">$TYPO3_CONF_VARS</span><span class="br0">&#91;</span><span class="st_h">'SYS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'caching'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'cacheConfigurations'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'aimeos'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'backend'</span><span class="br0">&#93;</span> <span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span>
    <span class="re0">$TYPO3_CONF_VARS</span><span class="br0">&#91;</span><span class="st_h">'SYS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'caching'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'cacheConfigurations'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'aimeos'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'backend'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st_h">'TYPO3\\CMS\\Core\\Cache\\Backend\\DatabaseBackend'</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="kw1">if</span><span class="br0">&#40;</span> <span class="sy0">!</span><span class="kw3">isset</span><span class="br0">&#40;</span><span class="re0">$TYPO3_CONF_VARS</span><span class="br0">&#91;</span><span class="st_h">'SYS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'caching'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'cacheConfigurations'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'aimeos'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'options'</span><span class="br0">&#93;</span> <span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span>
	<span class="re0">$TYPO3_CONF_VARS</span><span class="br0">&#91;</span><span class="st_h">'SYS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'caching'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'cacheConfigurations'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'aimeos'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'options'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="kw3">array</span><span class="br0">&#40;</span> <span class="st_h">'defaultLifetime'</span> <span class="sy0">=&amp;</span>gt<span class="sy0">;</span> <span class="nu0">0</span> <span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="kw1">if</span><span class="br0">&#40;</span> <span class="sy0">!</span><span class="kw3">isset</span><span class="br0">&#40;</span><span class="re0">$TYPO3_CONF_VARS</span><span class="br0">&#91;</span><span class="st_h">'SYS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'caching'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'cacheConfigurations'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'aimeos'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'groups'</span><span class="br0">&#93;</span> <span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span>
	<span class="re0">$TYPO3_CONF_VARS</span><span class="br0">&#91;</span><span class="st_h">'SYS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'caching'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'cacheConfigurations'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'aimeos'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'groups'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="kw3">array</span><span class="br0">&#40;</span> <span class="st_h">'pages'</span> <span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div></div></div></div></div></div>


<p>The whole if/is_array/isset thing is necessary to allow administrators to overwrite your settings in the <code>typo3conf/LocalConfiguration.php</code> file as the configuration of your extension is loaded afterwards. Thus, it would overwrite any previous configuration settings if you don&#8217;t check first if they exist.</p>
<p>There are four settings you can use to configure your cache in the TYPO3 caching framework:</p>
<ul>
<li><strong>frontend</strong> : What type of data is accepted</li>
<li><strong>backend</strong> : Where is the data stored</li>
<li><strong>options</strong> : Additional configuration settings for the back-end</li>
<li><strong>groups</strong> : The cache groups your extension cache belongs to</li>
</ul>
<p>There&#8217;s the choice between two cache front-ends and several cache back-ends. A complete list of both including their options is available in the <a href="https://docs.typo3.org/typo3cms/CoreApiReference/CachingFramework/FrontendsBackends/Index.html">TYPO3 cache front-end/back-end</a> article. The <code>groups</code> setting can be either <code>pages</code>, <code>system</code>, <code>all</code> or a combination thereof. Normally, you should use only one cache group and the group <code>all</code> is the default value if you don&#8217;t specify one.</p>
<div class="caution">If you use the default <code>database</code> back-end, you should be aware that the default lifetime of cached entries is only <strong>ONE HOUR</strong> if you don&#8217;t set it to a different value or to unlimited (&#8220;0&#8221;) like in the example above. Don&#8217;t forget to set up the <strong>&#8220;Caching framework garbage collection&#8221;</strong> scheduler task to clean up old entries. Otherwise, your cache tables will grow infinitely!</div>
<h2>Use your new cache</h2>
<p>Once set up, you can access the cache everywhere in you TYPO3 extension and you only have to write a few lines:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="php"><pre class="de1"><span class="re0">$name</span> <span class="sy0">=</span> <span class="st_h">'TYPO3\\CMS\\Core\\Cache\\CacheManager'</span><span class="sy0">;</span>
<span class="re0">$manager</span> <span class="sy0">=</span> \TYPO3\CMS\Core\Utility\GeneralUtility<span class="sy0">::</span><span class="me2">makeInstance</span><span class="br0">&#40;</span> <span class="re0">$name</span> <span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$cache</span> <span class="sy0">=</span> <span class="re0">$manager</span><span class="sy0">-&amp;</span>gt<span class="sy0">;</span>getCache<span class="br0">&#40;</span> <span class="st_h">'aimeos'</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


<p>They create an instance of the cache manager and retrieve your cache by name. Replace <code>aimeos</code> with the name of your extension resp. the name you&#8217;ve used in your <code>ext_localconf.php</code> in the cache setup code. Now you are able to set and get cached entries or remove them from the cache again:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="php"><pre class="de1"><span class="re0">$cache</span><span class="sy0">-&amp;</span>gt<span class="sy0">;</span>set<span class="br0">&#40;</span> <span class="st_h">'auniqueidentifier'</span><span class="sy0">,</span> <span class="re0">$data</span><span class="sy0">,</span> <span class="kw3">array</span><span class="br0">&#40;</span> <span class="st_h">'tag1'</span><span class="sy0">,</span> <span class="st_h">'tag2'</span> <span class="br0">&#41;</span> <span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$data</span> <span class="sy0">=</span> <span class="re0">$cache</span><span class="sy0">-&amp;</span>gt<span class="sy0">;</span>get<span class="br0">&#40;</span> <span class="st_h">'auniqueidentifier'</span> <span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$cache</span><span class="sy0">-&amp;</span>gt<span class="sy0">;</span>remove<span class="br0">&#40;</span> <span class="st_h">'auniqueidentifier'</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


<p>So, let&#8217;s go and make your TYPO3 extension fast! <img src="https://s.w.org/images/core/emoji/13.0.1/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://aimeos.org/tips/how-to-use-the-typo3-caching-framework-with-cache-groups/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Language mapping in TYPO3 with RealURL and bootstrap package</title>
		<link>https://aimeos.org/tips/language-mapping-in-typo3-with-realurl-and-bootstrap-package/</link>
					<comments>https://aimeos.org/tips/language-mapping-in-typo3-with-realurl-and-bootstrap-package/#comments</comments>
		
		<dc:creator><![CDATA[aimeos]]></dc:creator>
		<pubDate>Wed, 03 Jun 2015 08:17:00 +0000</pubDate>
				<category><![CDATA[TYPO3]]></category>
		<category><![CDATA[bootstrap package]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[RealURL]]></category>
		<guid isPermaLink="false">http://aimeos.org/tips/?p=120</guid>

					<description><![CDATA[The cool thing about the TYPO3 bootstrap_package extension is that you can set up a new site within minutes because everything is pre-configured. This also includes the RealURL setup so you already see the page titles in your URLs and<span class="ellipsis">&#8230;</span><div class="read-more"><a href="https://aimeos.org/tips/language-mapping-in-typo3-with-realurl-and-bootstrap-package/">Read more <span class="screen-reader-text">Language mapping in TYPO3 with RealURL and bootstrap package</span><span class="meta-nav"> &#8250;</span></a></div><!-- end of .read-more -->]]></description>
										<content:encoded><![CDATA[<p>The cool thing about the TYPO3 bootstrap_package extension is that you can set up a new site within minutes because everything is pre-configured. This also includes the RealURL setup so you already see the page titles in your URLs and the language parameter value is mapped too.</p>
<p><span id="more-120"></span></p>
<h2>The dark side</h2>
<p>You will face the dark side of the bootstrap package when you try to use different languages than those configured as examples. There&#8217;s only a mapping between the value of <code>sys_language_id</code> and English, German and Danish available and if you try to add a mapping manually, RealURL immediately switches to the &#8220;manual mode&#8221; where you have to configure everything yourself once again.</p>
<p>Loosing the auto-configuration implies a lot of work, especially if you are using the Aimeos web shop extension or similar ones, which add a lot of RealURL rules out of the box. Thus, it&#8217;s very compelling to try to overwrite only the RealURL configuration which is responsible for the language ID/code mapping.</p>
<h2>The bright side</h2>
<p>Fortunately, the bootstrap package allows you to overwrite its RealURL auto-configuration rules including the <code>preVars</code> section which is responsible for the language mapping.</p>
<p>First of all, you need an extension for your project where you can add the RealURL rules to. You can either use the Kickstarter extension or the <a href="http://aimeos.org/developer/extensions/">Aimeos extension creator</a>. The automatic configuration requires a PHP class and method that will add new or overwrite existing RealURL rules. You should add it in the <code>Classes/Realurl.php</code> file of your extension. Copy this code to your new file:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="php"><ol><li class="li1"><pre class="de1"><span class="sy0">&amp;</span>lt<span class="sy0">;</span>?php</pre></li><li class="li1"><pre class="de1">&nbsp;</pre></li><li class="li1"><pre class="de1"><span class="kw2">namespace</span> \<span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">&nbsp;</pre></li><li class="li1"><pre class="de1"><span class="kw2">class</span> Realurl</pre></li><li class="li1"><pre class="de1"><span class="br0">&#123;</span></pre></li><li class="li1"><pre class="de1">        <span class="kw2">public</span> <span class="kw2">function</span> addAutoConfig<span class="br0">&#40;</span> <span class="kw3">array</span> <span class="re0">$params</span><span class="sy0">,</span> <span class="re0">$pObj</span> <span class="br0">&#41;</span></pre></li><li class="li1"><pre class="de1">        <span class="br0">&#123;</span></pre></li><li class="li1"><pre class="de1">                <span class="re0">$params</span><span class="br0">&#91;</span><span class="st_h">'config'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'preVars'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="kw3">array</span><span class="br0">&#40;</span></pre></li><li class="li1"><pre class="de1">                        <span class="st_h">'GETvar'</span> <span class="sy0">=&amp;</span>gt<span class="sy0">;</span> <span class="st_h">'L'</span><span class="sy0">,</span></pre></li><li class="li1"><pre class="de1">                        <span class="st_h">'valueMap'</span> <span class="sy0">=&amp;</span>gt<span class="sy0">;</span> <span class="kw3">array</span><span class="br0">&#40;</span></pre></li><li class="li1"><pre class="de1">                                <span class="st_h">'en'</span> <span class="sy0">=&amp;</span>gt<span class="sy0">;</span> <span class="st_h">'0'</span><span class="sy0">,</span></pre></li><li class="li1"><pre class="de1">                                <span class="st_h">'de'</span> <span class="sy0">=&amp;</span>gt<span class="sy0">;</span> <span class="st_h">'1'</span><span class="sy0">,</span></pre></li><li class="li1"><pre class="de1">                                <span class="st_h">'...'</span> <span class="sy0">=&amp;</span>gt<span class="sy0">;</span> <span class="st_h">'2'</span><span class="sy0">,</span></pre></li><li class="li1"><pre class="de1">                        <span class="br0">&#41;</span><span class="sy0">,</span></pre></li><li class="li1"><pre class="de1">                        <span class="st_h">'noMatch'</span> <span class="sy0">=&amp;</span>gt<span class="sy0">;</span> <span class="st_h">'bypass'</span><span class="sy0">,</span></pre></li><li class="li1"><pre class="de1">                <span class="br0">&#41;</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">&nbsp;</pre></li><li class="li1"><pre class="de1">                <span class="kw1">return</span> <span class="re0">$params</span><span class="br0">&#91;</span><span class="st_h">'config'</span><span class="br0">&#93;</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">        <span class="br0">&#125;</span></pre></li><li class="li1"><pre class="de1"><span class="br0">&#125;</span></pre></li></ol></div></div></div></div></div></div></div>


<p>The <code>addAutoConfig()</code> method replaces the second entry of the &#8220;preVars&#8221; array, which are exactly the language mapping rules in the bootstrap package. You can change or add as many entries in the &#8220;valueMap&#8221; array as you like. The array keys are the strings that will be shown in the URL while the values are the sys_language_id values of the languages you&#8217;ve configured in your TYPO3 page tree and TypoScript configuration.</p>
<div class="note">Remember to replace the <code>&lt;vendor&gt;</code> and <code>&lt;extname&gt;</code> placeholders in the <code>namespace</code> statement in the third line of the file. <code>&lt;vendor&gt;</code> can be an arbitrary string while <code>&lt;extname&gt;</code> must be your extension name which the first letter in upper case as well as all letters that follow an underscore, e.g. &#8220;bootstrap_package&#8221; becomes &#8220;BootstrapPackage&#8221;.</div>
<p>Afterwards, you have to add your class to the RealURL hook that will call your method when collecting the rules for auto-configuration. This is done in the <code>ext_localconf.php</code> of your extension by adding these lines:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="php"><ol><li class="li1"><pre class="de1"><span class="re0">$GLOBALS</span><span class="br0">&#91;</span><span class="st_h">'TYPO3_CONF_VARS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'SC_OPTIONS'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'ext/realurl/class.tx_realurl_autoconfgen.php'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'extensionConfiguration'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">''</span><span class="br0">&#93;</span> <span class="sy0">=</span></pre></li><li class="li1"><pre class="de1">	<span class="st_h">'EXT:/Classes/Realurl.php:\\\\Realurl-&amp;gt;addAutoConfig'</span><span class="sy0">;</span></pre></li></ol></div></div></div></div></div></div></div>


<p>As above, you have to replace the <code>&lt;vendor&gt;</code> and <code>&lt;extname&gt;</code> placeholders with the same values you&#8217;ve used for the <code>namespace</code> statement.</p>
<div class="caution">The order you will install the extensions matters! Make sure the RealURL extension is installed first, then the bootstrap package and afterwards the rest of the extensions which contain RealURL rules including your new one.</div>
<p>Finally, clear your caches (TYPO3 general and frontend caches) and delete the <code>typo3conf/realurl_autoconf.php</code> file. Then, your languages should appear correctly mapped in your URLs.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://aimeos.org/tips/language-mapping-in-typo3-with-realurl-and-bootstrap-package/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Steps to configure your TYPO3 extension automatically</title>
		<link>https://aimeos.org/tips/steps-to-configure-your-typo3-extension-automatically/</link>
					<comments>https://aimeos.org/tips/steps-to-configure-your-typo3-extension-automatically/#comments</comments>
		
		<dc:creator><![CDATA[aimeos]]></dc:creator>
		<pubDate>Wed, 18 Feb 2015 11:16:27 +0000</pubDate>
				<category><![CDATA[TYPO3]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[usability]]></category>
		<guid isPermaLink="false">http://aimeos.org/tips/?p=53</guid>

					<description><![CDATA[Simplicity is key! I think nobody would oppose to this little sentence but in the TYPO3 ecosystem, many things are not very simple &#8211; at least not for new users. Even the most popular extensions need a deep knowledge of<span class="ellipsis">&#8230;</span><div class="read-more"><a href="https://aimeos.org/tips/steps-to-configure-your-typo3-extension-automatically/">Read more <span class="screen-reader-text">Steps to configure your TYPO3 extension automatically</span><span class="meta-nav"> &#8250;</span></a></div><!-- end of .read-more -->]]></description>
										<content:encoded><![CDATA[<p>Simplicity is key! I think nobody would oppose to this little sentence but in the TYPO3 ecosystem, many things are not very simple &#8211; at least not for new users. Even the most popular extensions need a deep knowledge of how to configure them before they can be used. And good documentation is most of time a rare thing!</p>
<p>So why not build an extension that works out of the box and configures itself as far as possible to give users an instant feeling of success? The <code>constants.txt</code> or <code>setup.txt</code> TypoScript files of the extensions can contain almost all default settings. But things get difficult if the required configuration depends on dynamic things like page IDs. Then, all hope of simplicity is lost and users have to add the necessary settings themselves again.</p>
<p><span id="more-53"></span></p>
<h2>Is this really true?</h2>
<p>The signal/slot mechanism described in the article about <a title="Execute scripts after TYPO3 extension installation" href="http://aimeos.org/tips/how-to-execute-scripts-after-installing-typo3-extensions/">executing scripts after installing an extension</a> provides the tools to get things done. Although, the article is very generic and I would like to go into more detail about how we&#8217;ve implemented things in the <a title="Aimeos TYPO3 web shop distribution" href="http://typo3.org/extensions/repository/view/aimeos_dist">Aimeos web shop distribution</a>.</p>
<p>The distribution imports some pages from the <code>data.t3d</code> file and the TYPO3 importer cares about avoiding conflicts with existing pages by reassigning the page IDs. Problems arose after we&#8217;ve added some required TypoScript settings for access restricted pages like the &#8220;MyAccount&#8221; page. In order to redirect to the login form when a user isn&#8217;t logged in, you have to configure its page ID. That seems to be impossible at the first glance when the page ID will differ in each TYPO3 installation.</p>
<p>The solution is to look up the page ID from the database dynamically after the extension is installed and generate a <code>constants.txt</code> file that will then contain the actual page ID. The constants in this file can be used in the TypoScript <code>setup.txt</code> file afterwards.</p>
<p>But first, you need to make sure your code will be executed automatically after the extension is installed. Remember the steps from the <a title="Execute scripts after TYPO3 extension installation" href="http://aimeos.org/tips/how-to-execute-scripts-after-installing-typo3-extensions/">article about executing scripts</a>? The first one was to register your extension for listening to the signal for extension installation:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="php"><ol><li class="li1"><pre class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>TYPO3_MODE <span class="sy0">===</span> <span class="st_h">'BE'</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></pre></li><li class="li1"><pre class="de1">    <span class="re0">$class</span> <span class="sy0">=</span> <span class="st_h">'TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher'</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">    <span class="re0">$dispatcher</span> <span class="sy0">=</span> \TYPO3\CMS\Core\Utility\GeneralUtility<span class="sy0">::</span><span class="me2">makeInstance</span><span class="br0">&#40;</span><span class="re0">$class</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">    <span class="re0">$dispatcher</span><span class="sy0">-&amp;</span>gt<span class="sy0">;</span>connect<span class="br0">&#40;</span></pre></li><li class="li1"><pre class="de1">        <span class="st_h">'TYPO3\\CMS\\Extensionmanager\\Service\\ExtensionManagementService'</span><span class="sy0">,</span></pre></li><li class="li1"><pre class="de1">        <span class="st_h">'hasInstalledExtensions'</span><span class="sy0">,</span></pre></li><li class="li1"><pre class="de1">        <span class="st_h">'\\\\'</span><span class="sy0">,</span></pre></li><li class="li1"><pre class="de1">        <span class="st_h">''</span></pre></li><li class="li1"><pre class="de1">    <span class="br0">&#41;</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"><span class="br0">&#125;</span></pre></li></ol></div></div></div></div></div></div></div>


<p><strong>Please replace &lt;vendor&gt;, &lt;extension&gt;, &lt;classname&gt; and &lt;method&gt;</strong> with the strings that fits for your extension. Afterwards, you must implement the method of your class you&#8217;ve registered for listening. We use the name of the <a title="Setup class from Aimeos web shop distribution" href="https://github.com/aimeos/aimeos-typo3-dist/blob/master/Classes/Setup.php">Aimeos setup class</a> in our example because you can have a look at it&#8217;s implementation for reference.</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="php"><ol><li class="li1"><pre class="de1"><span class="sy0">&amp;</span>lt<span class="sy0">;</span>?php</pre></li><li class="li1"><pre class="de1">&nbsp;</pre></li><li class="li1"><pre class="de1"><span class="kw2">namespace</span> \<span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">&nbsp;</pre></li><li class="li1"><pre class="de1"><span class="kw2">use</span> \TYPO3\CMS\Core\Utility\GeneralUtility<span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"><span class="kw2">use</span> \TYPO3\CMS\Backend\Utility\BackendUtility<span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">&nbsp;</pre></li><li class="li1"><pre class="de1"><span class="kw2">class</span> Setup</pre></li><li class="li1"><pre class="de1"><span class="br0">&#123;</span></pre></li><li class="li1"><pre class="de1">    <span class="kw2">public</span> <span class="kw2">function</span> process<span class="br0">&#40;</span> <span class="re0">$extname</span> <span class="sy0">=</span> <span class="kw4">null</span> <span class="br0">&#41;</span></pre></li><li class="li1"><pre class="de1">    <span class="br0">&#123;</span></pre></li><li class="li1"><pre class="de1">        <span class="kw1">if</span><span class="br0">&#40;</span> <span class="re0">$extname</span> <span class="sy0">!==</span> <span class="st_h">''</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span></pre></li><li class="li1"><pre class="de1">            <span class="kw1">return</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">        <span class="br0">&#125;</span></pre></li><li class="li1"><pre class="de1">&nbsp;</pre></li><li class="li1"><pre class="de1">        <span class="re0">$data</span> <span class="sy0">=</span> <span class="st_h">''</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">        <span class="re0">$ds</span> <span class="sy0">=</span> <span class="kw4">DIRECTORY_SEPARATOR</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">        <span class="re0">$filename</span> <span class="sy0">=</span> <span class="kw3">dirname</span><span class="br0">&#40;</span> __DIR__ <span class="br0">&#41;</span> <span class="sy0">.</span> <span class="re0">$ds</span> <span class="sy0">.</span> <span class="st_h">'Configuration'</span> <span class="sy0">.</span> <span class="re0">$ds</span> <span class="sy0">.</span> <span class="st_h">'TypoScript'</span> <span class="sy0">.</span> <span class="re0">$ds</span> <span class="sy0">.</span> <span class="st_h">'constants.txt'</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">&nbsp;</pre></li><li class="li1"><pre class="de1">        <span class="re0">$records</span> <span class="sy0">=</span> BackendUtility<span class="sy0">::</span><span class="me2">getRecordsByField</span><span class="br0">&#40;</span> <span class="st_h">'pages'</span><span class="sy0">,</span> <span class="st_h">'title'</span><span class="sy0">,</span> <span class="st_h">'My account'</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">&nbsp;</pre></li><li class="li1"><pre class="de1">	<span class="kw1">foreach</span><span class="br0">&#40;</span> <span class="re0">$records</span> <span class="kw1">as</span> <span class="re0">$record</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span></pre></li><li class="li1"><pre class="de1">            <span class="re0">$data</span> <span class="sy0">.=</span> <span class="st_h">'config.typolinkLinkAccessRestrictedPages = '</span> <span class="sy0">.</span> <span class="kw3">intval</span><span class="br0">&#40;</span> <span class="re0">$record</span><span class="br0">&#91;</span><span class="st_h">'uid'</span><span class="br0">&#93;</span> <span class="br0">&#41;</span> <span class="sy0">.</span> <span class="st0">&quot;<span class="es1">\n</span>&quot;</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">        <span class="br0">&#125;</span></pre></li><li class="li1"><pre class="de1">&nbsp;</pre></li><li class="li1"><pre class="de1">        GeneralUtility<span class="sy0">::</span><span class="me2">writeFile</span><span class="br0">&#40;</span> <span class="re0">$filename</span><span class="sy0">,</span> <span class="re0">$data</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">    <span class="br0">&#125;</span></pre></li><li class="li1"><pre class="de1"><span class="br0">&#125;</span></pre></li></ol></div></div></div></div></div></div></div>


<div class="note">The example contains placeholders for &lt;vendor&gt; and &lt;extension&gt; and you have to replace them with the names from your extension.</div>
<p>First we have to ensure that the <code>constants.txt</code> file is only created if our own extension is installed. Thus, we check for the extension name to filter out all other extension installations.</p>
<p>The TYPO3 backend utilities contains some nice methods to retrieve records from the database with only little effort. For example, you can use the <code>getRecordsByField()</code> method from the <code>BackendUtility</code> class to fetch all records from a table where a field matches a certain value. Here we want to get all records where the &#8220;title&#8221; equals &#8220;My account&#8221; from the &#8220;pages&#8221; table.</p>
<div class="caution">Searching for a page with a title only works as long as the page isn&#8217;t renamed! In the best case, your extension has added the page including the page name itself, so this won&#8217;t be a problem. It&#8217;s not bad if somebody renames the page afterwards because the page ID will stay the same in this case. The only problematic situation could be several pages with the same name.</div>
<p>Make sure you generate valid TypoScript afterwards, including new lines and keep an eye on <strong>security by enforcing the types</strong> you are expecting! The <code>foreach()</code> loop is a great way to deal with no records and several returned records too because both can an will happen sooner or later. Don&#8217;t throw an exception if something unexpected happens because it may lead to not being able to install your extension at all! It&#8217;s better to drop those records and add a message to the log file.</p>
<div class="tip">You don&#8217;t have to add all TypoScript statements to your <code>constants.txt</code> that contains a dynamic value. Instead, you can also define them like &#8220;page.myaccount.id = 123&#8221; and <strong>reference the constants</strong> in your <code>setup.txt</code> with &#8220;{$page.myaccount.id}&#8221;. This is especially handy to keep your <code>constants.txt</code> small and if you need the value several times.</div>
<p>At last, your extension has to write the TypoScript statements to the <code>constants.txt</code> file. The <code>GeneralUtiltiy</code> class from the TYPO3 core contains a little <code>writeFile()</code> helper function to get this done within one line.</p>
<h2>Simple, isn&#8217;t it?</h2>
<p>These few additional lines can make the difference between an easy installable extension and hours of frustrations bugging your users. I think the little effort during the development of your extension is worth the hours saved later on. Your users will thank you for your work by using your extension more often!</p>
<p>A special thanks for the inspiration to this tutorial goes to Stephan Schuler from netlogix.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://aimeos.org/tips/steps-to-configure-your-typo3-extension-automatically/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>How to execute scripts after installing TYPO3 extensions</title>
		<link>https://aimeos.org/tips/how-to-execute-scripts-after-installing-typo3-extensions/</link>
					<comments>https://aimeos.org/tips/how-to-execute-scripts-after-installing-typo3-extensions/#comments</comments>
		
		<dc:creator><![CDATA[aimeos]]></dc:creator>
		<pubDate>Thu, 12 Feb 2015 09:58:19 +0000</pubDate>
				<category><![CDATA[TYPO3]]></category>
		<category><![CDATA[custom script]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[installation]]></category>
		<guid isPermaLink="false">http://aimeos.org/tips/?p=35</guid>

					<description><![CDATA[Extensions are a great way to add features to the TYPO3 CMS and there are extension for virtually everything! Simply download them from the TYPO3 extension repository and install them via the Extension Manager in the TYPO3 back-end. So far<span class="ellipsis">&#8230;</span><div class="read-more"><a href="https://aimeos.org/tips/how-to-execute-scripts-after-installing-typo3-extensions/">Read more <span class="screen-reader-text">How to execute scripts after installing TYPO3 extensions</span><span class="meta-nav"> &#8250;</span></a></div><!-- end of .read-more -->]]></description>
										<content:encoded><![CDATA[<p>Extensions are a great way to add features to the TYPO3 CMS and there are extension for virtually everything! Simply download them from the <a title="TYPO3 extension repository" href="http://typo3.org/extensions/repository/">TYPO3 extension repository</a> and install them via the Extension Manager in the TYPO3 back-end. So far so good &#8230;</p>
<p>Often, the remaining tasks of configuring the extension, adding new pages with the plug-ins from the extension or importing required data into the database becomes much more cumbersome. Why can&#8217;t life be not as easy as in other CMS? Just click and everything works?</p>
<p><span id="more-35"></span></p>
<h2>Yes, we can!</h2>
<p>The infrastructure for performing additional tasks after installing extensions is part of TYPO3 since some time. At least since TYPO3 6.2 it works flawlessly, before your way may vary. The trick is to utilize the <strong>signal/slot mechanism</strong> to connect to the Extension Management service and listen for signals emitted after an extension was installed.</p>
<p>In the <a title="Aimeos TYPO3 web shop extension" href="http://typo3.org/extensions/repository/view/aimeos">Aimeos TYPO3 web shop extension</a> we&#8217;ve added the following code to the <strong><a title="Aimeos TYPO3 ext_localconf.php code" href="https://github.com/aimeos/aimeos-typo3/blob/master/ext_localconf.php">ext_localconf.php</a></strong>:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="php"><ol><li class="li1"><pre class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>TYPO3_MODE <span class="sy0">===</span> <span class="st_h">'BE'</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></pre></li><li class="li1"><pre class="de1">    <span class="re0">$class</span> <span class="sy0">=</span> <span class="st_h">'TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher'</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">    <span class="re0">$dispatcher</span> <span class="sy0">=</span> \TYPO3\CMS\Core\Utility\GeneralUtility<span class="sy0">::</span><span class="me2">makeInstance</span><span class="br0">&#40;</span><span class="re0">$class</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">    <span class="re0">$dispatcher</span><span class="sy0">-&amp;</span>gt<span class="sy0">;</span>connect<span class="br0">&#40;</span></pre></li><li class="li1"><pre class="de1">        <span class="st_h">'TYPO3\\CMS\\Extensionmanager\\Service\\ExtensionManagementService'</span><span class="sy0">,</span></pre></li><li class="li1"><pre class="de1">        <span class="st_h">'hasInstalledExtensions'</span><span class="sy0">,</span></pre></li><li class="li1"><pre class="de1">        <span class="st_h">'Aimeos\\Aimeos\\Setup'</span><span class="sy0">,</span></pre></li><li class="li1"><pre class="de1">        <span class="st_h">'executeOnSignal'</span></pre></li><li class="li1"><pre class="de1">    <span class="br0">&#41;</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"><span class="br0">&#125;</span></pre></li></ol></div></div></div></div></div></div></div>


<p>The first line ensures that we are connecting only to the Extension Management service if we are in the back-end. If you leave this line out, your script would connect at every front-end request too, which would only slow down response times. The next two lines instantiates the signal/slot dispatcher class and the <code>makeInstance()</code> method of the <code>GeneralUtility</code> class does a good job.</p>
<div class="caution">Don&#8217;t use the PHP &#8220;new&#8221; operator for creating the class instance! This would create one instance each time the code is executed instead of sharing a common instance during the request.</div>
<p>The remaining lines connect your method <code>executeOnSignal()</code> of your namespaced class <code>Aimeos\Aimeos\Setup</code> to the Extension Management service whose class name is handed over as first parameter. Here we are listening to the <code>hasInstalledExtensions</code> signal, that is emitted by the service after an extension has been installed. The key of the installed extension will be passed as first parameter to our method.</p>
<div class="note">There&#8217;s another signal that is emitted by the Extension Management service named <code>willInstallExtensions</code>. By listening to this signal, your script can be informed about which extensions are going to be installed next. An array of extension keys is given in this case.</div>
<h2>Do what you need</h2>
<p>At last, you need to create a class that contains the code to be executed after an extension is installed. The Aimeos TYPO3 extension contains a <a title="Aimeos TYPO3 setup class code" href="https://github.com/aimeos/aimeos-typo3/blob/master/Classes/Setup.php"><code>Setup</code> class</a> in the <code>Classes/</code> directory of the extension with a method named <code>executeOnSignal()</code> to care about this. The basic code of this class is:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="php"><ol><li class="li1"><pre class="de1"><span class="sy0">&amp;</span>lt<span class="sy0">;</span>?php</pre></li><li class="li1"><pre class="de1">&nbsp;</pre></li><li class="li1"><pre class="de1"><span class="kw2">namespace</span> Aimeos\Aimeos<span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">&nbsp;</pre></li><li class="li1"><pre class="de1"><span class="kw2">class</span> Setup</pre></li><li class="li1"><pre class="de1"><span class="br0">&#123;</span></pre></li><li class="li1"><pre class="de1">    <span class="kw2">public</span> <span class="kw2">function</span> executeOnSignal<span class="br0">&#40;</span> <span class="re0">$extname</span> <span class="sy0">=</span> <span class="kw4">null</span> <span class="br0">&#41;</span></pre></li><li class="li1"><pre class="de1">    <span class="br0">&#123;</span></pre></li><li class="li1"><pre class="de1">        <span class="kw1">if</span><span class="br0">&#40;</span> <span class="re0">$extname</span> <span class="sy0">!==</span> <span class="st_h">'aimeos'</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span></pre></li><li class="li1"><pre class="de1">            <span class="kw1">return</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1">        <span class="br0">&#125;</span></pre></li><li class="li1"><pre class="de1">&nbsp;</pre></li><li class="li1"><pre class="de1">        <span class="co1">// your code</span></pre></li><li class="li1"><pre class="de1">    <span class="br0">&#125;</span></pre></li><li class="li1"><pre class="de1"><span class="br0">&#125;</span></pre></li></ol></div></div></div></div></div></div></div>


<p>The <strong>namespace declaration</strong> is important but <strong>must be adapted to your extension</strong>. The first namespace part is the vendor name, e.g. the name of your company. The second part is the extension key with the first letter uppercased. If your extension key contains an underscore, then the underscore is removed and the next character transformed to uppercase as well, e.g. the <code>boostrap_package</code> uses <code>BootstrapPackage</code> as the second namespace part.</p>
<p>You are free to use any valid class and method name in your extension. Only make sure that the third and fourth parameter of the <code>connect()</code> method call are named appropriately. Also, ensure that your class and method are neither abstract nor static so an instance can be created. Like said above, the key name of the extension that has been installed is given as first parameter to your method. For compatibility reasons, you should make that parameter optional by assigning a default value of <code>null</code>.</p>
<div class="tip">Use the given extension key name to filter for your one! The Extension Management service will inform your script about every extension that is installed, not only your own one. Otherwise, you would execute your script code for every installed extension and this may slow down the installation process depending on how much your code does.</div>
<h2>What&#8217;s next?</h2>
<p>Pretty simple, isn&#8217;t it? Now it&#8217;s time to pimp your TYPO3 extension to remove as much burden as possible from the user! In a second article we will go into more detail how this can save your users day when your extension imports pages and depending TypoScript configuration.</p>
<p>A special thanks goes to <a href="https://twitter.com/benjaminkott">Benjamin Kott</a> for his <a title="TYPO3 bootstrap_package extension" href="http://typo3.org/extensions/repository/view/bootstrap_package">bootstrap_package</a> because it was the first that provided a working example that the signal/slot infrastructure can be used for these kind of use cases.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://aimeos.org/tips/how-to-execute-scripts-after-installing-typo3-extensions/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
