[TYPO3-english] Re : Function to get content of a page (to be used inuserFunc)

Bernd Wilke t3ng at pi-phi.tk
Fri Aug 12 08:19:38 CEST 2011


On 08/11/2011 04:31 PM, joel zimmerli wrote:
> Hi Victor,
> Thank you for your reply and tips. Maybe I'm doing something wrong but the TS
> code you gave does not return the element in the right order.
> If I take your exeample, I would expect to get bloc contents of page 3, then
> contents of page 87 and finally 24.
>
> Of course block for each page should be returned in the order defined on each
> page.
>
> I tried to add sorting=pid,sorting but in this case, the order of the page (3,
> 87, 24) is not respected...

you may modify your sorting to

	field(uid,"3,87,24"),sorting

or you can modify the TypoScript to a COA:

lib.all_content = COA
lib.all_content {
	10 = CONTENT
	10 {
		table = tt_content
		select {
			pidInList = 3
			where = (colPos=0)
			orderBy = sorting
		}
	}
	20 < .10
	20.select.pidInList = 87
	30 < .10
	30.select.pidInList = 24
}



> By the way, the page id to extract content should be transmitted to my "extract"
> page using a webform. How it is possible to build the pidInList = accoring to
> the POST info?

you may use a split on the POST-Var.
maybe something like this:

lib.all_content = TEXT
lib.all_content {
	data = global : HTTP_POST_VARS | myPageIds
	split {
		token = ,
	        cObjNum = 1
		1 = CONTENT
		1 {
			table = tt_content
			select {
				pidInList = current
				where = (colPos=0)
				orderBy = sorting
			}
		}
	}
}
(untested, please respond your working solution)


> Thanks in advance for your help.
> JZ
>
>
>
>
>
> ________________________________
> De : Victor Livakovsky<v-tyok at mail.ru>
> À : typo3-english at lists.typo3.org
> Envoyé le : Jeu 11 août 2011, 10h 20min 25s
> Objet : Re: [TYPO3-english] Function to get content of a page (to be used
> inuserFunc)
>
> Hi, Joel.
>
> Surely, you can do it with TS:
> lib.all_content = CONTENT
> lib.all_content {
> table = tt_content
> select {
>     pidInList = 3,87,24
>     where = (colPos=0)
>     orderBy = sorting
> }
> }
>
> At 'pidInList ' you can provide your comma-separated list of page ids.
>
> If you want to do it with userFunc, also not a big deal - done with simple SQL:
> SELECT * FROM 'tt_content' WHERE pid IN (3,87,24) AND NOT hidden AND NOT deleted
> Surely, you should do it with $GLOBALS['TYPO3_DB'] methods, which you can find
> at class t3lib_DB
> Or you can do it with 'cObjGetSingle' method of class tslib_cObj, and then TYPO3
> will do everything by itself - you'll just need to provide TS code above to this
> method.
>
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>


-- 
http://www.pi-phi.de/cheatsheet.html


More information about the TYPO3-english mailing list