Make Pibase extension compatible to TYPO3 6.2.x

1) Remove the line starting with “require_once”, that includes TYPO3 core files
For Ex:
require_once(PATH_tslib.’class.tslib_pibase.php’);
require_once(PATH_t3lib.’class.t3lib_tsparser.php’);

But keep the “require_once” line that includes custom class from current extension
For Ex:
require_once (PATH_site.”/typo3conf/ext/myextension/library/class.mylibclass.php”);

2. Download the TYPO3 source, in my case I am referring to TYPO3 6.2.2
Open the file “typo3-6.2.2\sysext\core\Migrations\Code\LegacyClassesForIde.php”.

This file has very important information regarding migrations.

3. Open the pi1.php file of the extension that you are going to update.

4. Replace the class names by referring to LegacyClassesForIde.php of TYPO3 core.
For Ex:
Replace “tslib_pibase” with “\TYPO3\CMS\Frontend\Plugin\AbstractPlugin”.
To do this, search for “tslib_pibase” on “LegacyClassesForIde.php” and replace with the part next to “extends”
“abstract class tslib_pibase extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {}”

So
“class tx_myextension_pi1 extends tslib_pibase {”
becomes
“class tx_myextension_pi1 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {”

5. Similarly replace “t3lib_div” with “\TYPO3\CMS\Core\Utility\GeneralUtility”.
We can do search and replace all occurrences.

6. Similarly replace “t3lib_extMgm” with “\TYPO3\CMS\Core\Utility\ExtensionManagementUtility”
and repeat this step until all the replacement availabilities are replaced.

7. And for custom class inclusions, replace
require_once (PATH_site.”/typo3conf/ext/myextension/library/class.mylibclass.php”);
with
require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(‘myextension’).’library/class.mylibclass.php’);
“PATH_site” may not work in some cases.

8. Replace
t3lib_div::makeInstance(‘t3lib_TSparser’);
with
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(‘TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser’);
The paths comes in quotes should have double back slashes.

9. Remove the line
t3lib_div::loadTCA(“tt_content”);
that may be there in ext_tables.php
In TYPO3 6.2 version, all TCA are auto loaded. So we need not load again.

TYPO3 adding section frames.

Below is the way how we can add the section frames by preserving the content element ID. This way works on TYPO3 6.x.

1. In TS template

### FRAMES ###
tt_content.stdWrap.innerWrap.cObject {
100 < tt_content.stdWrap.innerWrap.cObject.default
100.20.10.value = boxclass
}

2. In page TS Config

TCEFORM.tt_content.section_frame {
addItems.100 = My custom box
}

How to set Open Graph (o:g) meta tags using Typoscript.

The open graph meta tags affects the way how our page link looks, when we share it on social media like on Facebook.

Below is the way how we can set og:title, og:type, og:url, og:description and og:image using Typoscript.

page.headerData {
# Add Open Graph meta
1 = COA
1 {
10 = TEXT
10 {
value = {$siteTitle} : {TSFE:page|title}
insertData = 1
dataWrap = <meta property=”og:title” content=”|”>
}
20 = TEXT
20 {
value = article
wrap = <meta property=”og:type” content=”|”>
}
30 = TEXT
30 {
typolink {
parameter.data = tsfe:id
parameter.insertData = 1
useCacheHash = 1
addQueryString = 1
addQueryString.method = get
addQueryString.exclude = id
forceAbsoluteUrl = 1
returnLast = url
}
wrap = <meta property=”og:url” content=”|”>
}
40 = TEXT
40 {
value = {$siteTitle}
wrap = <meta property=”og:site_name” content=”|”>
}
50 = TEXT
50 {
data = page:description
required = 1
stripHtml = 1
wrap = <meta property=”og:description” content=”|”>
}
60 = FILES
60 {
#gets image form media tab of page
references {
table = pages
uid.data = page:uid
fieldName = media
}
renderObj = TEXT
renderObj {
typolink {
parameter.data = file:current:publicUrl
forceAbsoluteUrl = 1
returnLast = url
}
wrap = |,
}
stdWrap {
listNum = 0
# Use logo image if none is available
ifEmpty.cObject = TEXT
ifEmpty.cObject.typolink {
parameter = fileadmin/templates/images/logo.png
forceAbsoluteUrl = 1
returnLast = url
}
wrap = <meta property=”og:image” content=”|”>
}
}
}
}

Typoscript to include IE specific css and js

Here is how we can include css and javascript that targets different Internet explorer versions using typoscript.

page {
includeJS {
iejs = fileadmin/templates/js/ie.js
iejs.allWrap = <!–[if lt IE 9]> | <![endif]–>
iejs.excludeFromConcatenation = 1
}

includeCSS {
iecss = fileadmin/templates/css/ie.css
iecss.allWrap = <!–[if lt IE 9]> | <![endif]–>
iecss.excludeFromConcatenation = 1
}
}

Here I am including css and js for ie version less than 9.