if a slot has no content, don't display it

1 view
Skip to first unread message

cr0wn3r

unread,
Jan 3, 2010, 7:03:54 PM1/3/10
to pkcontextcms
How do you normally go about checking a slot for content before
displaying it? I have a page layout that should only display certain
elements if content for those elements exists.

So far I have been using getSlot and then checking $slot->value for
content manually in the template before deciding whether to display it
or not. Feels wrong though...

cr0wn3r

unread,
Jan 3, 2010, 7:07:22 PM1/3/10
to pkcontextcms
Also - I have to bybass that logic if the user has admin rights for
the page to make sure that content can still be added, even if it is
currently empty. All in all feels overly complicated and messy in the
template. What would people suggest as a better solution?

Thanks

Tom Boutell

unread,
Jan 4, 2010, 2:57:06 PM1/4/10
to pkcont...@googlegroups.com
So you'd like to be able to avoid displaying any of the surrounding
markup for an empty slot when the user does not have editing
privileges? For some slots? All slots? Slots of a particular custom
type, or slots for which you've specified an option in the template
perhaps?

> --
>
> 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

cr0wn3r

unread,
Jan 4, 2010, 6:05:29 PM1/4/10
to pkcontextcms
Hi Tom

I have a page layout with several standard pk slot rich text areas.
Two of the rich text areas sit as a kind of large box-out - so within
divs creating rounded corners and uneven edging / bordering graphics.

If the corresponding slot has no content then I want to ommit the
entire box from the layout, rather than have it appear as an empty
box.

Normally this isn't an issue as if a slot has no content then the
presence of the pk wrapping divs on the page makes no odds, but in
this case the slot is wrapped in divs which add background grahpics
and formatting that need to be ommitted if the slot has no content.

> > For more options, visit this group athttp://groups.google.com/group/pkcontextcms?hl=en.

Daniel Lohse

unread,
Jan 4, 2010, 6:30:57 PM1/4/10
to pkcont...@googlegroups.com
I don't know if that sounds stupid but maybe adding the concept of "wrapping slots" would be an idea? So that you can actually tell the slot that it has to be wrapped with another partial/component/piece of code? This would solve not only this problem but at the same time make this managed by the CMS as it can only wrap when something is really there. Or maybe it's too late here and I'm too tired and this is just a bad idea. :)

Cheers, Daniel

Tom Boutell

unread,
Jan 5, 2010, 8:29:22 AM1/5/10
to pkcont...@googlegroups.com
You're not the only ones asking about this issue. I think it's
something we'll need to deal with. You might want to open a ticket on
trac.apostrophenow.org about it. (We've soft-launched that site as our
official bug tracker, as you might have noticed in the Symfony plugins
repository.)
Reply all
Reply to author
Forward
0 new messages