[TYPO3-german] TemplaVoila - Inhaltselement unter bestimmten Bedingungen nicht anzeigen

Martin Wunderlich martin.wunderlich at netresearch.de
Thu Jun 14 10:13:52 CEST 2012


Hallo,

es ist zwar nicht eine so ganz optimale Lösung, aber für Spezialfälle 
kann folgendes gehen:

Es gibt eine Extension, mit der man TS-Schnipsel als Contentelemente 
anlegen kann (typoscript_code). Dort kann man beliebig Bedingungen 
definieren und dann mittels RECORDS Element ein bestimmtes Element unter 
bestimmter Bedingung an der Stelle einfügen.

Am 13.06.2012 15:01, schrieb Kay Strobach:
> Hi Laxander,
>
> ich denke das geht.
>
> Variante 1: Hook in TV finden und dort das rendering ändern.
> Variante 2: postUserFunc des page objectes nutzen und mit einem
> preg_replace das fce entfernen ;)
>
> includeLibs.EXT = EXT:EXT/Classes/Hook/StdWrap.php
>
> stdWrap.postUserFunc  = tx_EXT_Hook_StdWrap->processReplacement
>
> <?php
>
> class tx_EXT_Hook_StdWrap {
> 	/**
> 	 * Processes ordered replacements on content data.
> 	 *
> 	 * @param	string		$content: The content to be processed
> 	 * @param	array		$configuration: The TypoScript configuration for
> stdWrap.replacement
> 	 * @return	string		The processed content data
> 	 */
> 	public function processReplacement($content) {
> 		$configuration = array(
> 			'10.' =>  array(
> 				'search' =>  '<div class="right"><input type="submit"',
> 				'replace' =>  '</fieldset><div class="submit"><input type="submit"',
> 			)
> 		);
>
> 		foreach ($configuration as $index =>  $action) {
> 				// Checks whether we have an valid action and a numeric key ending
> with a dot ("10."):
> 			if (is_array($action)&&  substr($index, -1) === '.'&&
> t3lib_div::testInt(substr($index, 0, -1))) {
> 				$content = $this->processReplacementAction($content, $action);
> 			}
> 		}
> 		return $content;
> 	}
>
> 	/**
> 	 * Processes a single search/replace on content data.
> 	 *
> 	 * @author Markus Günther:
> http://azubi-medienblog.de/2011/12/06/typo3-4-5-um-stdwrap-replacement-erweitern/
> 	 *
> 	 * @param	string		$content: The content to be processed
> 	 * @param	array		$configuration: The TypoScript of the search/replace
> action to be processed
> 	 * @return	string		The processed content data
> 	 */
> 	protected function processReplacementAction($content, array
> $configuration) {
> 		if ((isset($configuration['search']) || isset($configuration['search.']))
> 		&&  (isset($configuration['replace']) ||
> isset($configuration['replace.']))) {
>
> 			// Gets the search needle:
> 			$search = tslib_cObj::stdWrap($configuration['search'],
> $configuration['search.']);
> 			// Determines whether regular expression shall be used:
> 			if (isset($configuration['useRegExp']) || $configuration['useRegExp.']) {
> 				$useRegularExpression =
> tslib_cObj::stdWrap($configuration['useRegExp'],
> $configuration['useRegExp.']);
> 			}
> 			// Performs a replacement by preg_replace():
> 			if ($useRegularExpression) {
> 				$replace = tslib_cObj::stdWrap($configuration['replace'],
> $configuration['replace.']);
> 				$content = preg_replace($search, $replace, $content);
> 				// Checks whether the search needle is part of the content:
> 			} elseif (strpos($content, $search) !== false) {
> 				$replace = tslib_cObj::stdWrap($configuration['replace'],
> $configuration['replace.']);
> 				$content = str_replace($search, $replace, $content);
> 			}
> 		}
> 		return $content;
> 	}
> }
>
> Grüße
> Kay
>
> Am 13.06.2012 14:11, schrieb JCL - Johannes C. Laxander:
>> Hi Kay,
>>
>> ok jetzt seh' ich klarer! Ich glaube da hab' ich mich bei meiner Problemschilderung ungenau ausgedrückt.
>> Es geht mir nicht darum, diese im Backend auszublenden, sondern im Frontend nicht anzuzeigen!
>>
>> Es handelt sich um angelegte und anzeigbare Inhaltselemente, die unter bestimmten Bedingungen eben (doch) nicht im FE angezeigt werden sollen. Ich müsste die Ausgabe dieser CEs also per TypoScript unterbinden!
>>
>> Dazu eine Idee?
>>
>> Gruß, Johannes.
>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: typo3-german-bounces at lists.typo3.org
>>> [mailto:typo3-german-bounces at lists.typo3.org] Im Auftrag von
>>> Kay Strobach
>>> Gesendet: Mittwoch, 13. Juni 2012 13:57
>>> An: typo3-german at lists.typo3.org
>>> Betreff: Re: [TYPO3-german] TemplaVoila - Inhaltselement
>>> unter bestimmten Bedingungen nicht anzeigen
>>>
>>> Hi Johannes,
>>>
>>> TCEFORM.tt_content.tx_templavoila_ds {
>>>       removeItems = uid list (comma)
>>> }
>>>
>>> TCEFORM.tt_content.tx_templavoila_to {
>>>       removeItems = uid list (comma)
>>> }
>>>
>>> Das geht auch für die Tabelle "pages".
>>> Der obige Code ist nicht getestet, klappt aber sonst bei
>>> nahezu allen Feldern.
>>>
>>> Grüße
>>> Kay
>>>
>>> Am 13.06.2012 13:50, schrieb JCL - Johannes C. Laxander:
>>>> Hallo Kay,
>>>>
>>>> bei mir scheint heute wirklich einer auf der Leitung zu
>>> stehen - ich
>>>> versteh' nämlich nicht was du meinst? Sorry - aber erstmal
>>> danke dafür
>>>> ;-)
>>>>
>>>> Johannes
>>>>
>>>>> Kay Strobach
>>>>> Gesendet: Mittwoch, 13. Juni 2012 13:41
>>>>>
>>>>> Hi,
>>>>>
>>>>> du könntest im Pagets die option für das jeweilige template
>>>>> ausblenden.
>>>>>
>>>>> Grüße
>>>>> Kay
>>>>>
>>>>>
>>>>> Am 13.06.2012 13:35, schrieb JCL - Johannes C. Laxander:
>>>>>> Hallo,
>>>>>>
>>>>>> ich habe unter TemplaVoila in einer Seite mehrere
>>>>> Inhaltselemente (Text / Text m Bild).
>>>>>>
>>>>>> Unter bestimmten Bedingungen sollen einige dieser
>>>>> Inhaltselemente nicht angezeigt werden. im müsste also das
>>>>> entsprechende Object löschen. Nur habe ich im Moment n'Brett vorm
>>>>> Kopf, weil mir nicht einfallen will, wie ich Zugriff auf ein
>>>>> bestimmtes Inhaltselement bekomme.
>>>>>>
>>>>>> Wer kann mir bitte weiterhelfen?
>>>>>>
>>>>>> Gruß Johannes.
>>>
>>> --
>>> http://www.kay-strobach.de - Open Source Rocks
>>>
>>> TYPO3 .... inspiring people to share!
>>> Get involved: http://typo3.org
>>>
>>> Answer was useful - feel free to donate:
>>>    -
>>> https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_but
>> ton_id=KPM9NAV73VDF2
>>>    - https://flattr.com/profile/kaystrobach
>>>
>>>
>>>
>>> _______________________________________________
>>> TYPO3-german mailing list
>>> TYPO3-german at lists.typo3.org
>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german
>>>
>


-- 
Viele Grüße
Martin Wunderlich

Developer

Netresearch GmbH&  Co. KG
-----------------------------------------------
Nonnenstraße 11d - 04229 Leipzig
T: +49 341 47842 18
-----------------------------------------------
http://www.netresearch.de - info at netresearch.de

++++++++++++++
Netresearch - Passion for eCommerce


++++++++++++++
http://www.netresearch.de/blog
http://www.facebook.com/netresearch
http://twitter.com/netresearch

-----------------------------------------------
Registergericht: AG Leipzig HRA 15614
Komplementär: Netresearch Beteiligungs GmbH, AG Leipzig HRB 17018
Geschäftsführer: Michael Ablass, Thomas Fleck





More information about the TYPO3-german mailing list