[TYPO3-ttnews] OT Re: pagebrowser question.

Kay Strobach typo3 at kay-strobach.de
Thu Jul 5 17:41:47 CEST 2012


> rofl, I haven't used tt_news for years, sorry ;)

hi Georg - thanks anyway :=) migrating big sites with many users is
hard. ;=)

For all interested ;) - it's a bit of magic :) but all doable thanks to
stdWrap :)

Regards
Kay

+++++ SOME TS +++++++++++++

		includeLibs.userPageBrowserFunc =
EXT:tt_news/res/example_userPageBrowserFunc.php

	includeLibs.news_navigation = EXT:pbext/Classes/Navigation/PageBrowser.php

	# call user function
	#plugin.tt_news.userPageBrowserFunc = user_substPageBrowser2
	plugin.tt_news {
		stdWrap.postUserFunc = tx_pbext_Navigation_PageBrowser->main
		_LOCAL_LANG.default {
			pi_list_browseresults_first = <img
src="{$layoutBaseUri}symbole/start.gif" width="16" height="12" alt="">erste
			pi_list_browseresults_prev  = <img
src="{$layoutBaseUri}symbole/zur.gif" width="16" height="12" alt="">vorige
			pi_list_browseresults_next  = nächste<img
src="{$layoutBaseUri}symbole/vor.gif" width="16" height="12" alt="">
			pi_list_browseresults_last  = letzte<img
src="{$layoutBaseUri}symbole/ende.gif" width="16" height="12" alt="">
		}
		pageBrowser {
			browseBoxWrap          = <div class="ergebnisse">|</div>
			browseLinksWrap        = |
			activeLinkWrap         = <strong>|</strong>
			disabledLinkWrap       = <span>|</span>
			hscText = 0
			alwaysPrev = 1
			maxPages = 3
			# set this to '0' if you want the pagebrowser to display only numbers
			showPBrowserText = 0
			tableParams = cellpadding=2
			showResultCount = 0
		}
		displayList {
			subheader_stdWrap.append >
		}
		displayLatest {
			subheader_stdWrap.append >
		}
	}


+++++ SOME PHP +++++++++++++


<?php

class tx_pbext_Navigation_PageBrowser {
	function main($content, $conf) {
		$xml = new DOMDocument();
		$xml->loadHTML('<?xml encoding="UTF-8">' . $content);

		$allDivs = $xml->getElementsByTagName('div');
		$pageBrowser = $allDivs->item($allDivs->length-1);

		if($pageBrowser && $pageBrowser->getAttribute('class') == 'ergebnisse') {
			$wrapper = $xml->createElement('div');
			$wrapper->setAttribute('class', 'ergebnisse');

			$backward = $xml->createElement('div');
			$backward->setAttribute('class', 'backward');
			$backward->appendChild($pageBrowser->childNodes->item(0));
			$backward->appendChild($xml->createTextNode('                     '));
			$backward->appendChild($pageBrowser->childNodes->item(1));

			$wrapper->appendChild($backward);

			for($i = 2; $i < $pageBrowser->childNodes->length - 3; $i++) {
				$wrapper->appendChild($pageBrowser->childNodes->item($i));
				if($i !== $pageBrowser->childNodes->length - 4) {
					$wrapper->appendChild($xml->createTextNode(' | '));
				}
			}

			$forward = $xml->createElement('div');
			$forward->setAttribute('class', 'forward');
		
$forward->appendChild($pageBrowser->childNodes->item($pageBrowser->childNodes->length
- 3));
			$forward->appendChild($xml->createTextNode('                     '));
		
$forward->appendChild($pageBrowser->childNodes->item($pageBrowser->childNodes->length
- 1));

			$wrapper->appendChild($forward);

			$pageBrowser->parentNode->replaceChild($wrapper, $pageBrowser);

			return $xml->saveHTML();
		}


		return $xml->saveHTML();
		return $content;
	}
}

-- 
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_button_id=KPM9NAV73VDF2
  - https://flattr.com/profile/kaystrobach





More information about the TYPO3-project-tt-news mailing list