Login / Status
developer.Resource
Home . Development . Articles . Using links in frontend plugins
Sponsors
hosted by punkt.deTYPO3 and Open Source MagazineAOE Media

Obey the rules

If you want to develop clean code within a framework like TYPO3, you have to obey some rules. In our example you have to use certain methods for creating links which might be not as straight-forward as creating the link yourself. But in return these methods will make sure that your code is compatible with other extensions and core functions.  

Recently a new extension called speakinguris has been published. It simulates static HTML files including folders and subfolders which results in nicely built locators like http://example.org/documentation/tutorials/index.html.

There are many extensions which have been programmed before speakinguris existed, but they are compatible with the new link style because they are using the TYPO3 API for creating links! The next section describes where you find these functions and how you use them correctly.

The base of your frontend plugins

At the same time Kasper Skårhøj put the idea of extensions for TYPO3 into reality, he delivered a PHP class which would serve as a basis for all upcoming frontend plugins. This class is called “pi_base”, derived from “plugin base”.

Whenever you create a new frontend plugin with TYPO3's kickstarter wizard, you will find a working hello world example in the extension's directory. This sample code already uses pi_base and maybe you have been using it at some point without really taking notice of it.

By the way - the file which contains the pibase is part of the CMS extension and located in typo3/sysext/cms/tslib/class.tslib_pibase.php. Have a look at this file right now, it is well commented and provides some vital features for your own plugins.