Typo3 Using typoLink in your own FrontEnd (FE) extension

Using the the typoLink function in your own Typo3 extension is very simple. First you need an instance of the tslib_cObj object. Then setup the config array and call the method. That’s all.
To create the instance you need to include the object first:

include_once(PATH_site.'typo3/sysext/cms/tslib/class.tslib_content.php');

Then create the tslib_cObj:

$cObj=t3lib_div::makeInstance('tslib_cObj');

Setup the config array: (See the typoLink documentation of possible entries)

$conf = array( 'parameter' => 'http://www.bstar.de' );

Call the method:

echo $cObj->typoLink('bstar.de', $conf );


If you don’t want to setup the conf array and don’t need the power of typoLink you can use getTypoLink also:

echo $cObj->getTypoLink('bstar.de', 'http://www.bstar.de' );

Cron sends no mail to MAILTO address

When you are using cron to do some automatic jobs and want the output to be mailed, be sure you are entering the mail address in the right format. In this case it means that the mail address must not contain an „_“ (underscore)! If you enter into the MAILTO env of the crontab a mail address which contains an underscore you’ll wait forever 😉
Of course this behavior depends of your cron version …

So don’t use an underscore when ever you are able to do.

Typo3 locallang.xml and UTF-8 II

Again I need to talk about the default section of the locallang.xml. When you are following the tip of my last post you may encounter an other problem. You don’t have a default anymore (yeah! I know I suggest to remove the default section). This is may a problem if you need to handle many languages and don’t had translate all of them right now.
So here comes my bad work-around.

  1. open ../t3lib/class.t3lib_div.php in an editor
  2. search for:
    $LOCAL_LANG['default'][$labelKey] = $csConvObj->utf8_decode($labelValue,'iso-8859-1');
  3. replace 'iso-8859-1' with $origCharset
  4. save the file
  5. you may need to clear you llxml cache

Now you can use the default section again and UTF-8 characters are working fine.

Typo3 output UTF-8 in your own extensions

After you had finally master your the utf8 convert of you Typ3 installation may encounter an other problem. Your own extension is not producing utf8 output.
Your first idea will be to add "SET NAMES UTF8;" to you database connection when using the DBAL of Typo3. But this is not your problem 😉 $GLOBALS['TYPO3_DB']->exec_SELECTquery (which is actually using the DBAL) gives your right want you want!

After a while you’ll may find out that you’ve used for some reasons htmlentities. And this is your problem! But don’t panic. You just need to added some more parameters and the world will be fine again. Just add ‚UTF-8‘ as third parameter to give the function a hint that you are using uft8. Tricky … isn’t it 😉

So it will look similar like this:
$str = htmlentities( $dbData, ENT_COMPAT, 'UTF-8' );

Typo3 locallang.xml and UTF-8

Building a multi language site can be very hard. First of all you need be sure that you are running Typo3 and your database with the correct encoding. UTF-8 is your friend! Apply all the setting you need for you installation (have a look at http://wiki.typo3.org/index.php/UTF-8_support will may help you) and also ensure your database is using UTF-8. (BTW: If you database tables are using UFT-8 you do NOT need to set $TYPO3_CONF_VARS[‚SYS‘][‚multiplyDBfieldSize‘] and do not forget to run database->compare of the installation tool)

Now your Typo3 installation is working fine. Really? Have you checked your own extensions? Ups! There is may a problem if you use getLL and locallang.xml. Some chars are may mess up even if the locallang.xml looks fine (of course you are using an UTF-8 enabled editor and you are saving this file as UTF-8).

The problem is the „default“ languageKey setting. You are not allowed to use any encoding then ansi. But what if you need some special chars there? Be sure you set an other default key (for example „config.language = en“ will do this job for english) and rename „default“ to „en“. Now you are fine!

Impressum

Provider:
Blue Star Software
Dipl.-Ing. tech. Informatik Roger Sennert
Fritz-KrÀmer-Weg 3
57258 Freudenberg
phone: +49 2734 436520
Germany
e-mail: info(at)bluestarsoftware.de

VAT identification number according to § 27 a Umsatzsteuergesetz:
DE 216762420

In accordance with § 28 BDSG we object to any kind of commercial use and passing on of our data.

Liability: The contents of this website have been examined carefully and were created to the best of our knowledge. However, we do not claim responsibility for the completeness, topicality, quality and correctness of the information presented on this site.
In spite of careful examination of external links, we do not accept responsibility for their contents. It is the providers of the linked sites who are responsible for their contents. We have made sure that these sites neither break any law nor offend common decency exactly once, that is before they were incorporated into our site.

Data security: Personal data are ascertained only with your knowledge and your consent. If you wish, we will send you all the information about your stored personal data free of charge.

Violation of patent law: If you think that any of the items on this website violates one of your patents, please tell us immediately so that we can change the particular item as soon as possible.

Google Analytics: This website uses Google Analytics, a web analytics service provided by Google, Inc. (”Google”). Google Analytics uses “cookies”, which are text files placed on your computer, to help the website analyze how users use the site. The information generated by the cookie about your use of the website (including your IP address) will be transmitted to and stored by Google on servers in the United States. Google will use this information for the purpose of evaluating your use of the website, compiling reports on website activity for website operators and providing other services relating to website activity and internet usage. Google may also transfer this information to third parties where required to do so by law, or where such third parties process the information on Google’s behalf. Google will not associate your IP address with any other data held by Google. You may refuse the use of cookies by selecting the appropriate settings on your browser, however please note that if you do this you may not be able to use the full functionality of this website. By using this website, you consent to the processing of data about you by Google in the manner and for the purposes set out above.