DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

tt_news select configuration

Created:2010-10-13T21:40:33
Changed by:dirk
Changed:2015-09-01T16:05:41
Classification:ttnews_selectconf
Description:Add an andWhere clause to the SQL query of a tt_news. I.e. it is possible to display tt_news items in dependence on the fe_user ownership.
Keywords:tt_news, SQL, select, query, where
Author:Dirk Wildt - Die Netzmacher
Email:http://wildt.at.die-netzmacher.de
Website:http://die-netzmacher.de
Language:en

img-1 img-2 tt_news select configurationttnews_selectconf img-3

tt_news select configuration

Add an andWhere clause to the SQL query of a tt_news. I.e. it is possible to display tt_news items in dependence on the fe_user ownership.

img-4

Version: 3.7.0 - 2015-09-01

Extension Key: ttnews_selectconf

Language: en

Keywords: tt_news, SQL, select, query, where

Copyright 2009-2015, Dirk Wildt - Die Netzmacher, <http://wildt.at .die-netzmacher.de>

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.org

Screenshot

Frame1

Introduction

What does it do?

  • The extension tt_news select configuration enables you to add an andWhere clause to the SQL query of a tt_news. I.e. it is possible to display tt_news items in dependence on the fe_user ownership.
  • The andWhere clause has the stdWrap property.
  • It's possible to configure tt_news select configuration differently per each tt_news plugin.

What do you need?

The extension tt_news.

Installation

Extension Manager

  • Open the extension manager, download the extension named tt_news select configuration (extkey: ttnews_selectconf) and install it.
  • Extend the typoscript of your tt_news with the andWhere clause (see the property "extension" in the reference on page 8).

Samples

Display news of the current day only

The andWhere statement from below will display news only, if they are published today.

plugin.tt_news.extensions.ttnews_selectconf {

andWhere (

tt_news.datetime >= (UNIX_TIMESTAMP() - (UNIX_TIMESTAMP() % 86400) + 7200)

AND tt_news.datetime < (UNIX_TIMESTAMP() - (UNIX_TIMESTAMP() % 86400) - 86400 + 7200)

)

}

Be aware: if you are customising tt_news by TypoScript and nit by a plugin, you have to configure your tt_news within the page object like in the snippet below:

page.10.default.subparts.content.20.extensions.ttnews_selectconf {

...

}

Probably the 7.200 in the snippet above has to do with the properties of the current server. 7.200 seconds are two hours.

Thanks to

Michael Langmedia.design http://www.mediadesign-ffm.de

for the code snippet.

Display latest news only configured for selected plugins

The andWhere statement from below will display latest news only, published from today. The andWhere statement has an effect only for plugins with the uids 791 and 2558.

The andWhere statement is usefull especially for an event calendar.

plugin.tt_news {

extensions {

ttnews_selectconf {

csvPluginsOnly = 2558, 791

andWhere (

tt_news.datetime >= (UNIX_TIMESTAMP() - (UNIX_TIMESTAMP() % 86400) + 7200)

)

}

}

}

Be aware: if you are customising tt_news by TypoScript and nit by a plugin, you have to configure your tt_news within the page object like in the snippet below:

page.10.default.subparts.content.20.extensions.ttnews_selectconf {

...

}

Probably the 7.200 in the snippet above has to do with the properties of the current server. 7.200 seconds are two hours.

Thanks to

Michael Langmedia.design http://www.mediadesign-ffm.de

for the code snippet.

Debug Query

For developers only.

Should delivers the start time of today like 2015-08-30 00:00:00

SELECT FROM_UNIXTIME(UNIX_TIMESTAMP() - ((UNIX_TIMESTAMP() % 86400) + 7200))

Should delivers the start time of tomorrow like 2015-08-31 00:00:00

SELECT FROM_UNIXTIME(UNIX_TIMESTAMP() - ((UNIX_TIMESTAMP() % 86400) - 86400 + 7200))

Reference

Extensions.ttnews-selectConf

Property

Extensions.ttnews-selectConf

Data type

Array (select)

Description

Configuration by overriding (or manipulating with stdWrap) any of the clauses described below in the selectsection.

Add the extension array to the typoscript of the array plugin.tt_news.

Configure the andWhere value.

The example below effects that only tt_news items will be displayed which are ownde by the fe_user with the id 85.

Example:

plugin.tt_news {
  extensions {
    ttnews_selectconf {
      andWhere = tt_news.crfeuser_id = 85
    }
  }
}

In the following example only news items which is older than field_date will be shown – but only as long as field_specific is not set. When field_specific is set, only news items from a list of uids of field_specific will be displayed.

Example with stdWrap:

plugin.tt_news.extensions.ttnews_selectconf {
  andWhere {
    dataWrap        = tt_news < {field:field_date}
    if.isFalse.data =         field:field_specific
  }
  udInList.data = field:field_specific
}

Default

See the example

select

These are the SQL-select statements which are available. It's important to notice though, that many of them will not be available in every display mode as they are overwritten internally in the tt_news code. Also you might get unexpected results in some situations if you mess too much with the current values. The andWhere statement doesn't seem to be used by tt_news (extensions extending tt_news might), so you can relative safely use this one without worrying if it will be overwritten.

uidInList

Property

uidInList

Data type

list of page_id

/stdWrap

Description

Default

pidInList

Property

pidInList

Data type

list of page_id /stdWrap

Description

Default

recursive

Property

recursive

Data type

int

/stdWrap

Description

Recursive levels for the pidInList

Default

0

(orderBy)

Property

(orderBy)

Data type

SQL-orderBy

/stdWrap

Description

Without "order by"! Eg. "sorting, title"

Notice: Not available in LATEST/LIST/SEARCH/XML mode

Default

(groupBy)

Property

(groupBy)

Data type

SQL-groupBy

/stdWrap

Description

Without "group by"! Eg. "Ctype"

Notice: Not available in LATEST/LIST/SEARCH/XML mode

Default

max

Property

max

Data type

int

/stdWrap

Description

Max records

Special keyword: "total" is substituted with count(*)

Default

begin

Property

begin

Data type

int

/stdWrap

Description

Begin with record number value

Special keyword: "total" is substituted with count(*)

Default

where

Property

where

Data type

SQL-where

/stdWrap

Description

Without "where"!, Eg. " (title LIKE '%SOMETHING%' AND NOT doktype) "

Default

andWhere

Property

andWhere

Data type

SQL-where /stdWrap

Description

Without "AND"!, Eg. "NOT doktype".

Default

languageField

Property

languageField

Data type

string

/stdWrap

Description

If set, this points to the field in the record which holds a reference to a record in sys_language table. And if set, the records returned by the select-function will be selected only if the value of this field matches the $GLOBALS[“TSFE”]->sys_language_uid (which is set by the config.sys_language_uid option)

Default

(selectFields)

Property

(selectFields)

Data type

string

/stdWrap

Description

List of fields to select, or “count(*)”.

Notice: Not available in LATEST/LIST/SEARCH/XML mode

Default

join

Property

join

leftjoin

rightjoin

Data type

string

/stdWrap

Description

Enter tablename for JOIN , LEFT OUTER JOIN and RIGHT OUTER JOIN respectively.

Default

Helpful suggestions and bug reports

New Features and Bug Reports

You are welcome to post any question, bug or code snippet on TYPO3 forge.Here you find feature announcements and bug reports.See

http://forge.typo3.org/projects/extension-ttnewsselectconf

Further Information

Other extensions published by Die Netzmacher

Credits

  • Thanks to Stig Nørgaard Færch (stig.at.8620.dk), who extended the andWhere clause with the stdWrap property.
  • Thanks to Michael Lang from media.design ( http://www.mediadesign- ffm.de ) for the code snippet "Error: Reference source not found" on page Error: Reference source not found Error: Reference source not found.
  • Thanks to Thomas Kakuschke ( http://www.verkon.de ) for supporting the update for tt_news 3.0.x.

Change log

3.7.1 Feature * #i0002: ttnews_selectconf.pluginOnly is moved to ttnews_selectconf.csvPluginsOnly

3.7.0 Feature * #i0001: Enable dependency on the current tt_news plugin.

3.6.0 Feature * #62778: Update for TYPO3 6.2 / tt_news 3.6

0.2.2 Bugfixing * #32334 - Automatic detection of tt_news version fails in some casesby http://herrmann.at.die-netzmacher.de

0.2.1 Bugfixing Misspelled variable nameby http://herrmann.at.die- netzmacher.de

0.2.0: Development compatibility to tt_news 3.0.*by http://herrmann.at.die-netzmacher.de

0.1.2: Sample The manual is extended with the sample "Display news of the current day only"

0.1.1: Development The andWhere clause gots the stdWrap property.

0.0.3: Status : Changing from alpha to stable Bugfixing : ManualCorporate Design: Changing from think visually to Die Netzmacher

0.0.1: Initial release

Illustration Index

Illustration 1: Three tt_news plugins. The thrird one displays only tt_news, which are in the future. It is configured with ttnews_selectconf 3

Alphabetical Index

15