Category Archives: Typo3

Typo3 Add a Google Breadcrumb Rich Card

If you like to improve the search experience of you website you may want to add a rich card. One of these rich cards are the breadcrumbs. First, you need to decide which format you like: microdata or JSON-LD.

These snippets will generate a microdata that you can also use as your standard breadcrumb:

lib.richcard_breadcrumb {
 special = rootline
 special.range = 1 | 7
 wrap = <ol itemscope itemtype="http://schema.org/BreadcrumbList"> | </ol>

 1 = TMENU
 1 {
   NO.ATagParams = itemprop="item"
   NO.allWrap =<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">|</li>
   NO.stdWrap.wrap = <span itemprop="name">|</span>
   NO.after.cObject = COA
   NO.after.cObject {
    5 = TEXT
    5.dataWrap = <meta itemprop="position" content="{register:count_MENUOBJ}|" />
   }
 }
}

If you do not want to show a breadcrumb or like the JSON-LD more just use this code:

lib.richcard_breadcrumb = HMENU
lib.richcard_breadcrumb {
 special = rootline
 special.range = 1 | 7 
 wrap = { "@context": "http://schema.org", "@type": "BreadcrumbList", "itemListElement": | ] }
 1 = TMENU
 1 { 
  NO.allWrap = [ || ,| 
  NO.doNotLinkIt = 1
  NO.stdWrap.wrap = { "@type": "ListItem", "item": { | }
  NO.stdWrap.cObject = COA
  NO.stdWrap.cObject {
   10 = TEXT
   10 {
    stdWrap.typolink.parameter.field = uid
    stdWrap.typolink.forceAbsoluteUrl = 1
    stdWrap.typolink.returnLast = url
    htmlSpecialChars = 1
    wrap = "@id": "|",
   }
   20 = TEXT
   20 {
    field = title
    wrap = "name": "|"
   } 
  } 
  NO.after.cObject = COA
  NO.after.cObject {
   5 = TEXT
   5.dataWrap = ,"position": {register:count_MENUOBJ} | }
  }
 } 
}

 

Typo3 Link To Top Feature Fluidtemplate

If you like to modify the „Append with Link to Top of Page“ output of fluidtemplate (fluid_styled_content) (which is the default setting of Typo3 Version 8. However you can even use it with Version 6 or 7) you need to create an partial override.

Hint: When using css_style_content you can use tt_content.stdWrap.innerWrap2 ... to modify the output.

First you need to add the location of your override directory to you setup:
lib.contentElement.partialRootPaths.100 = EXT:tpl_site/Resources/Private/Partials/override/

Within this directory you now can override any file of
typo3/sysext/fluid_styled_content/Resources/Private/Partials
Beware of the folder structure!

The render of the „to top“-feature is in the file „Footer/All.html“. Therefore we need to create this file. It is a good idea to copy the original file and then make the modifications you like to do. I liked to add a class. So this is my file:

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:if condition="{data.linkToTop}">
<a class="topTopLink" href="#top"><f:translate key="toTop" extensionName="fluid_styled_content" /></a>
</f:if>
</html>

Typo3 and conditional TypoScript includes

Since a long time it’s possible to split your TypoScripts into external files and include them from your template via
<INCLUDE_TYPOSCRIPT: source="FILE: fileadmin/fileToInclude.ts">
So it’s very easy to use your favorite editor and, more important, organize the TypoScript-Files into smaller, reusable chunks.

My common setup is something like that:
Template-Code:
<INCLUDE_TYPOSCRIPT: source="FILE: fileadmin/tpl/include.ts">

fileadmin/tpl/include.ts:
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/tpl/ts/site.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/tpl/ts/defaults.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/tpl/ts/header.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/tpl/ts/menu.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/tpl/ts/plugin_news.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/tpl/ts/plugin_facebook.ts">

But there is one large downside. Every include adds an [GLOBAL] at the end of file. So it’s not possible to include files based on a multi level condition. For example if you like to develop a new design and want to test it on a test domain. For more information see https://forge.typo3.org/issues/16525

But since Typo3 7.6 there is something which can help. Continue reading »

Typo3 – Easy upgrade of pibase extension to TYPO3 6.2 or 7.6

After upgrading a Typo3 4.5 Installation to Version 6.2 your old pibase extension may still running. Hmm .. at least mostly 🙂
You just need to remove some requice_once statements and modify the ext_table.php to use the \TYPO3\CMS\Core\Utility\ExtensionManagementUtility class. Most of the other stuff is still there.
Once when you try to upgrade to version 7.6 you are in need to modify a bit more. But don’t worry. After all it isn’t that complicated. And by the way … you don’t need to wait until you upgrade. These changes are running very well even in an 6.2 installation.
So here is a small list of needed action to upgrade from 4.5 via 6.2 to 7.6 🙂
Continue reading »

Typo3: Backend Search

After you upgraded from a Typo3 Version 4.5 LTS to Version 6.2 or higher you may wounder why the backend search is not working anymore as expected. Even in the list mode the result of extension records can be empty.
If it’s your own extension you can fix it very easy. Since Version 4.6 the search behavior was changed (see https://forge.typo3.org/issues/36452).
To re-enable the search function of your own extension records to have to add this line to your ext_table.php:

$TCA['name_of_table']['ctrl']['searchFields'] = 'col1, col2, col3';

Just include all columns which make sense. Clear the system cache and it’s done. Of course you need to do this for every table which you wanted to be searched 🙂

Typo3 Replace old getPageLink in an extbase controller

If you wounder how to create links in an extbase controller instead of using the old pi_getPageLink methode you should have a look at this:

$this->controllerContext->getUriBuilder()->reset()
  ->setArguments([
    'tx_myext[action]'=>'show', 
    'tx_myext[param]'=>$model->getUid() ])
  ->setTargetPageUid($GLOBALS["TSFE"]->id)
  ->setCreateAbsoluteUri(true)
  ->buildFrontendUri();

To get more information you may search for getUriBuilder

Typo3 Problems with image gm convert and umlauts

If you have a problem when uploading images with umlauts in the file name you first stop may will be to check the config.local_all setting. The setting should match some value of the locale -a command of the server. Mose of the time it’s something like en_US.uft8 or de_DE.utf8.
But if you still getting errors like

/usr/local/bin/gm convert: Unable to open file ([image file name]) [No such file or directory].

You should also set systemLocale of the Typo3 configuration. The most simple way to do this is to use the Installation Tool/All Configuration:

$TYPO3_CONF_VARS['SYS']['systemLocale'] = 'de_DE.utf-8';

Typo3: „Cannot find tslib“ and „Lock file could not be created“

Recently I had to move my Typo3 Installation from one server to new one. It should be easy to move. However the reality is another one 😉 In specialty if you are using Plesk.

After I used the MigrationManager of Plesk the site wasn’t running. I got the message

Cannot find tslib/. Please set path by defining $configured_tslib_path in index.php.

A quick search showed up that the symbolic link of the global typo3 installation isn’t working. I’ve checked that but it was correct. But then I got an idea: The old installation was running on Plesk Version 9 and the new one on Version 11. In Version 9 you hat to the open_basedir youself via the vhost.conf file. Since Version 11 you can (and have to) do this via the web interface. So I changed the php setting of the subscription to {WEBSPACEROOT}/:{TMP}/:/srv/typo3 (where /srv/typo3 is the path to my global Typo3 installation) and I got a step further.

Next try to load the site. After a while just a blank page showed up. Quick view into the error_log show this message

Lock file could not be created
Exception thrown in file ...

This is an easy one: Just adjusted the permissions of you typo3temp directory and everything went fine.

Typo3 cli_dispatch.phpsh scheduler Exception ‚localconf.php is not found!‘

After a system update or something else it may happen you get an Exception of your Typo3 Installation. It’s not always the main site but can also could be your „cron“ scripts (cli_dispatch.phpsh)

Fatal error: Uncaught exception 'Exception' with message 'localconf.php is not found!' in ../t3lib/config_default.php:707
Stack trace:
#0 ../typo3/sysext/cms/tslib/index_ts.php(128): require()
#1 ../index.php(84): require('...')
#2 {main} thrown in ../t3lib/config_default.php on line 707


or

Fatal error: Uncaught exception 'Exception' with message 'localconf.php is not found!' in ../t3lib/config_default.php:707
Stack trace:
#0 .../typo3/init.php(206): require()
#1 .../typo3/index.php(63): require('...')
#2 {main} thrown in .../t3lib/config_default.php on line 707

Of course the line numbers could be different 😉
So …. what’s the problem? It so simple that you just forget how you solved it the last time. „Last time? I don’t remember that there was a last time!?“. But you did!
Just check the php.ini and ensure that safe_mode = Off is set. Furthermore check the open_basedir setting. Ensure that (when used at all) all needed directories are set.

Typo3: indexed_search and external files (like pdf, doc …)

I’ve tried to get indexed_search in Typo3 to work. If you try to do this the first time it isn’t really easy.

After the basic setup the normal search was fine. However external documents like pdf and winword were not being indexed. Of course I’ve installed the needed tools and checked the path to them many times. Sure I’ve check if that these tools (pdftotext, catdoc) are running fine on command line.

But it took me hours to realize why it wasn’t running after all. The open_basedir restriction of php!
The extension indexed_search first checks if the program exists via the is_file method. If you installed the programs to the default path /usr/bin you are in trouble now. It’s no problem to execute the program via php but the function is_file will fail. So indexed_search thinks it’s not install and will not index pdf or any other external files.

Now you’ve several options. First of all you could add /usr/bin to the open_basedir path. Not a good idea at all! Second you could modify the extension not to check the files but just run the programs. Not so good either since it will break after an update of your Typo3 installation. Third of all you could copy the programs to your existing open_basedir path. Then adjust the configuration of indexed_search where to find the programs and it’s working like a charm …