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

joel zimmerli baden32 at yahoo.fr
Fri Aug 12 11:42:18 CEST 2011



Hi Bernd,

Thanks for your reply, unfortunately, I cannot get any output.... I think there 
something I do not understand using the split function. To build and debug I 
first try to hard define the Pids I want to get the content from with the 
following code:

temp.info = HTML
temp.info {
    ## here we give a list of the items we want to be working with
    value = 72,51,3
    value {
        split {
            ## the token used to split our original value
            token = ,
            cObjNum = 1
                    
            1{            
                10 = CONTENT
                10 {
                    table = tt_content
                    select {
                        pidInList = current
                        where = (colPos=0)
                        orderBy = sorting
                    }
                }
                20 = TEXT
                20{
                    current = 1
                    wrap = $|!
                }                            
            }
        }
    }
}

The output I get is "only" $72!$51!$3!, so split is working but the pidInList = 
current is not! 


If I replaced pidInList = current with pidInList = 72, I get 3 times the content 
of page 72, so here again the split/loop is ok but the "current" seems to be 
empty.

Hope you can help me.
Thanks,
Bad



________________________________
De : Bernd Wilke <t3ng at pi-phi.tk>
À : typo3-english at lists.typo3.org
Envoyé le : Ven 12 août 2011, 8h 19min 38s
Objet : Re: [TYPO3-english] Re : Function to get content of a page (to be used 
inuserFunc)

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
_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english


More information about the TYPO3-english mailing list