displaying 2 slots from many pages in one page (something like list of pages with slot instead of just titles)

2 views
Skip to first unread message

Piotr

unread,
Dec 16, 2009, 6:43:35 PM12/16/09
to pkcont...@googlegroups.com
Hm.. Im wondering.
In one page i want to display some slots (exactly - 2 slots, one richtext and one image - i know slot names) from couple of pages.
Now Im doing this by something like:

$current = pkContextCMSTools::getCurrentPage();
foreach($pages as $p)
{
   pkContextCMSTools::setCurrentPage($p);
   echo pk_context_cms_slot(.....)
}
pkContextCMS::setCurrentPage($current);


I didn't readed all methods because of not having many time in last days, so i don't know - there's any better way?


--
regards,
Piotr 'maur' Cichosz

Tom Boutell

unread,
Dec 16, 2009, 7:10:38 PM12/16/09
to pkcont...@googlegroups.com
That is probably the best way to do precisely as you described.

Sometimes the kind of thing you're trying to do is better accomplished
by using an engine page with many "subpages" actually driven by
Symfony routes, and using creatively named slots where the slot names
contain dynamic information like IDs in a table.

See my next message for a response I sent to another user that you
might find interesting.

> --
>
> You received this message because you are subscribed to the Google Groups
> "pkcontextcms" group.
> To post to this group, send email to pkcont...@googlegroups.com.
> To unsubscribe from this group, send email to
> pkcontextcms...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pkcontextcms?hl=en.
>

--
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

Piotr

unread,
Dec 16, 2009, 9:07:27 PM12/16/09
to pkcont...@googlegroups.com
Yes, definitely your next message is interesting.:)
For now it's too much refactoring, but after finish application I will change my way into engines.

Thanks. :-)


2009/12/17 Tom Boutell <t...@punkave.com>
That is probably the best way to do precisely as you described.

Sometimes the kind of thing you're trying to do is better accomplished
by using an engine page with many "subpages" actually driven by
Symfony routes, and using creatively named slots where the slot names
contain dynamic information like IDs in a table.

See my next message for a response I sent to another user that you
might find interesting.

--
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

--

You received this message because you are subscribed to the Google Groups "pkcontextcms" group.
To post to this group, send email to pkcont...@googlegroups.com.
To unsubscribe from this group, send email to pkcontextcms...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pkcontextcms?hl=en.





--
pozdrawiam,
Piotr 'maur' Cichosz

Piotr

unread,
Dec 16, 2009, 10:06:24 PM12/16/09
to pkcont...@googlegroups.com
One notice.. When Im using pkContextCMSTools::setCurrentPage and then displaying slots i see first version of them.
Because of line: $areaVersion = $area->AreaVersions[0]; in method: populateSlotCache
I have only one question: This is a bug or feature? ;-)

Tom Boutell

unread,
Dec 16, 2009, 10:32:43 PM12/16/09
to pkcont...@googlegroups.com
How did you get those pages?

You need to use pkContextCMSPageTable::retrieveById,
pkContextCMSPageTable::retrieveBySlug, or the query-building methods
they rely on (probably that last choice since it will allow you to
write a query that pulls more than one page and yet still gets the
proper areas).

$area->AreaVersions[0] gets the first version that is part of what the
query returned, not the first version that exists. But if your query
never specified versions, you do get them all - not desirable in
practice.

Reply all
Reply to author
Forward
0 new messages