EXT: KB TV Content Slide

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed:2014-06-02T19:50:10
Author:Bernhard Kraft
Email:kraftb@think-open.at
Info 3:
Info 4:

EXT: KB TV Content Slide

Extension Key: kb_tv_cont_slide

Copyright 2005-2014, Bernhard Kraft, < kraftb@think-open.at >

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Table of Contents

EXT: KB TV Content Slide 1

Introduction 1

What does it do? 1

Users manual 1

Sliding an image (or files) 2

Retrieving the content elements from an alternage page 2

Multiple Languages 2

Adminstration 3

Configuration 3

Known problems 3

Intention 3

Credits 3

Changelog 3

Introduction

What does it do?

This extension does the same as the KB Content Slide extension for standard templating but for Templa Voila. If you have a TV Content column (a field in your mapping in which you have set the editing type to “Content Elements”) you can now set that it should show the content it normally contains but if there is no content in the current page in this column it shows the content of the parent page instead. If also the column in the parent page has no content it shows their parent page contents and so on.

Users manual

Just create a TV mapping with a fields editing type set to “Content Elements” or use an already existing DS/TO. Then go to the storage folder containing the DS/TO and click the edit-icon of the DS. You will now see the XML of the DS. Search for your field. It should look like:

<field_openings type="array">
        ...
</field_openings>

If you have found your field have a look for the TS generating the content out of the Content Elements:

10= RECORDS
10.source.current=1
10.tables = tt_content

Now you just have to change the middle line (.source =) to let the content elements get retrieved in a different way. Change the middle line so the complete TS looks like:

10= RECORDS
10.source.postUserFunc = thinkopen_at\KbTvContSlide\SlideController->main
10.source.postUserFunc.field = field_openings
10.source.postUserFunc.table = tt_content
10.tables = tt_content

You have to specify the name of the field from which the content elements shall get retrieved by the line

10.source.postUserFunc.field = field_openings

The called method “tx_kbtvcontslide_pi1->main” wont know about the fieldname in the DS it has to render. So you always have to set the name of the DS field from which the content elements shall get retrieved like shown in the line above - using the “.field” property.

**New in Version 0.4.2** : Since this version it is recommended to set the property “table” to the table from which you are going to fetch records. So “tt_content” in the above example. This is not a must. Without this setting the extension will behave like in previous versions - not fixing the bug about ignoring hidden/deleted records. But when the property “table” is set, hidden and deleted records will be properly ignored when sliding back.

**New in Version 0.5.0** : As this version is solely intended for use with TYPO3 6.2 and above changes to the DS-XML are necessary when upgrading. Prior the “ postUserFunc ” configuration key had to be set to “ tx_kbtvcontslide_pi1->main ” which has changed. This value should get corrected to “ thinkopen_atKbTvContSlideSlideController->main ” in all your DS-XML structures. There is a migration class available which only logs the usage of the deprecated class “tx_kbtvcontslide_pi1”. This migration class will get replaced by a stub throwing an exception in version 0.5.1 of kb_tv_cont_slide. In version 0.5.2 this migration/stub class will get removed altogether.

Sliding an image (or files)

When you have images in your Page-DS Structure and you want to allow them also to slide through the page hierarchy you can easiyl achieve this also with kb_tv_cont_slide.

If you have an image in you page-DS you have a TS similar to the following one:

10 = IMAGE
     10.file.import = uploads/tx_templavoila/
     10.file.import.current = 1
     10.file.import.listNum = 0
     10.file.maxW = 258

Now if you know a bit about TypoScript you will surely know that “import.current = 1” achieves the task of filling the “import” key of “10.file” with the filename of the image - which it get's from the current field.

You can now easily insert TypoScript Code to retrieve the image but rather slide back and check there for an image if none is found on the current page:

   10 = IMAGE
        10.file.import = uploads/tx_templavoila/
*       10.file.import.cObject = TEXT
*       10.file.import.cObject  {
*               postUserFunc = thinkopen_at\KbTvContSlide\SlideController->main
*               postUserFunc    {
*                       field = field_background_image
*                       languageFallback = 0
*               }
*       }
        10.file.import.listNum = 0
        10.file.maxW = 258

The lines marked with an asterisk “*” replace the “.current = 1” line. They render a TEXT cObject which will contain the filename of the images uploaded to the field. In this case the field “field_background_image” get's inspected for an image (content). Of course do no include the “*” itself in your configuration!

Do NOT set the new option “table” in cases you are sliding images, files or other “non-record” kind of data.

Retrieving the content elements from an alternage page

If you would like to retrieve the content elements not from the current root-line there is a way to override this. The current root- line is a list of pages, from the current page, down in the page-tree to the root page. Normally when you use the content slide extension, it searches for content elements on the current page, and goes down the root-line.

Now if you want to retrieve content elements from an alternate page's root-line you can do this by simply setting the “overridePage” property. Using this method you can also simply retrieve content elements from another page - and you could also disable sliding, which means you have a simply way of showing content elements from a specific page/column:

10= RECORDS
10.source.postUserFunc = thinkopen_at\KbTvContSlide\SlideController->main
10.source.postUserFunc.field = field_content
10.source.postUserFunc.table = tt_content
10.source.postUserFunc.overridePage = 123
10.source.postUserFunc.collect = 1
10.tables = tt_content

This script simply shows the content of the DS column “field_content” from page with uid 123. The “collect=1” setting restricts the plugin from sliding down the root-line.

Multiple Languages

You also see another option in use. It's called “languageFallback”. In the above example the value is set simply to “0” meaning: If there is no content in the specified field for the current language also have a look at the same field for the given language-uid (of the language records you created on the root-page). Language Uid 0 means the default language. So the above example would look into “field_background_image” of the current page and language first and if there is no image found it will look in the same field of the default language. When there also is no content found it repeats this procedure (current language/default language(0)) for all parent pages until it finds content.

Adminstration

To install this extension just import it from the TER and install it as you would do with every other extension. There is no installation- time-configuration required.

Configuration

The behaviour of how content elements are retrieved can be controlled by two mechanism at the moment. The “collect” and the “slide” settings. But just see description for the possible properties below:

field

Property

field

Data type

string( stdWrap )

Description

The name of the fields from which the content elements shall get retrieved. This is required.

Default

collect

Property

collect

Data type

integer( stdWrap )

Description

Can get set to the amount of levels which shall get traversed backwards and collect their content. If set to “1” for example only the content of the current page get's collected. When set to “2” the content of the current and parent page get'c collected. You can set it to “-1” which will result in collecting the content of all pages down till the rootlevel. If below “slide” property has been set, and it can cause the extension to abort traversing down the root-line earlier.

Default

slide

Property

slide

Data type

integer( stdWrap )

Description

This property defines how many levels the extension will slide down. When set to “1” only the current page will get checked. If left blank or set to -1 the extension will search down till the root-page. Except if the “collect” property has also been set.

Default

reverse

Property

reverse

Data type

boolean (0/1)( stdWrap )

Description

If set the elements from collected pages will be concatenated in reverse order. Just important if collect = 1

Default

innerReverse

Property

innerReverse

Data type

boolean (0/1)( stdWrap )

Description

If this flag gets set the content elements from each column will get displayed in reverse order. This is true wheter or not collect = 1.

Default

languageFallback

Property

languageFallback

Data type

sys_language_uid list (comma separated)( stdWrap )

Description

A list of comma separated sys_language_uid values (of which 0 means default language) which should get looked for content before checking the parent page for content. This allows to “simulate” the “sys_language_overlay” mode of localized pages.

Default

overridePage

Property

overridePage

Data type

integer( stdWrap )

Description

When this property is set, not the current root-line will get used, but instead the root-line of the page set via this property.

Default

table

Property

table

Data type

string( stdWrap )

Description

If the property “field” points to a Flexform-Field containing records (tt_content if you slide content elments) - then set this property (table) to the table from which you are fetching records.If you do not set this option, hidden/deleted records will not get processed properly.If you slide images or other “non-records” stuff, do not set this field.

Default

Known problems

None at the moment.

Intention

If you like this extension or any other of my extension, you are invited to contribute to my idea of a beautiful world. You could spend money to any non-profit environmental or humanitarian organization like Greenpeace, WWF, Global 2000, Amnesty International, Care, etc.

Credits

  • Thanks to Ünal Aydin for suggesting the “overridePage” property.
  • Thanks to Joerg Wagner and Klaus Weidenbach for informing me about the image-sliding bug.
  • Thanks to the following companies for sponsoring the upgrade of kb_tv_cont_slide to TYPO3 6.2:Salzmann Medien ( www.salzmann- medien.de , Gütersloh, Germany)Cerebrum (Aust) Pty Ltd ( www.cerebrum.com.au , Melbourne, Australia)

Changelog

Version :

Version

Version :

Date

Date :

Changelog

Changelog :

0.0.1

Version

0.0.1

Date

2005-06-07, 12:00 CET

Changelog

Initial release

0.0.2

Version

0.0.2

Date

2005-09-01, 21:30 CET

Changelog

Fixed a bug. Misused t3lib_BEfunc in FE.

0.1.0

Version

0.1.0

Date

2006-09-27, 16:15 CET

Changelog

Updated the extension to the newest TV and T3 version requirements. Created documentation for letting images/files slide and made it multilanguage compatible.

0.1.1

Version

0.1.1

Date

Changelog

Updated broken manual

0.2.0

Version

0.2.0

Date

Changelog

Fixed a missing require_once

0.3.0

Version

0.3.0

Date

2007-07-19

Changelog

Now works with new TYPO3 versions and PHP5.

0.4.0

Version

0.4.0

Date

2009-02-06 11:00 CET

Changelog

* Added a property "overridePage" (Thanks to Ünal Aydin for suggesting this)

* Added a property "slide" for defining the maximal slide level

* Added "stdWrap" to all TS properties

* Fixed a bug: Extension didn't check if a tt_content element is hidden or not

0.4.1

Version

0.4.1

Date

2009-02-06 11:00 CET

Changelog

* Changed description

0.4.2

Version

0.4.2

Date

2009-02-12 11:45 CET

Changelog

* New TypoScript property “table” which fixes a bug when sliding images. For letting previous bug-fix for correctly processing hidden/deleted elements work, this new TypoScript property should get set. See manual.

0.4.3

Version

0.4.3

Date

2009-04-29 20:30 CET

Changelog

Fixed a bug: Slided records were sorted by UID and not by their sorting value.

0.4.4

Version

0.4.4

Date

2011-12-22 15:45 CET

Changelog

Changed documentation section “Intention”

0.5.0

Version

0.5.0

Date

2014-06-02 20:00 CET

Changelog

Upgraded to 6.2 compatibilitySee“New in Version 0.5.0” in documentation for upgrade instructions.

img-1 EXT: KB TV Content Slide - 4