Forums / Setup & design / Conditional data view
Andrew Vorobyov
Thursday 02 June 2005 2:23:42 am
There is an object "Person" - it has 2 fields - name and nickname..
I want to be able to show "name" for all Anonymous and "nickname" ONLY for logged in "Guests"..
"Person" is located in section for members only... so i can't fetch it by fetch("content","list") funcs if anonimous is browsing.
Please advise where to dig for solutions...
Thanks,Andrew
Łukasz Serwatka
Thursday 02 June 2005 3:24:36 am
Hi Andrew,
You can use simple fetch
{def $user=fetch( user, current_user )} {* if Anonymous show the name *} {if eq( $user.contentobject.id, 10 )} {$user.contentobject.name} {else} {$user.contentobject.data_map.nickname.data_text} {/if}
Should works if nickname is text line datatype. For < 3.6 you should use section insted of if and let insted of def
Personal website -> http://serwatka.net Blog (about eZ Publish) -> http://serwatka.net/blog
Thursday 02 June 2005 3:52:52 am
Thanks Lukasz..
but it means to share "content","read","Section(Memebers)" role for anonymous, right?
I don't want it!..
Because objects will be vurnerable for /content/view/full/plain/{node} /content/view/full/full/{node}/content/view/full/pdf/{node}
and who-knows-how-many variations to read object...
So my question now sounds like that:
<b>Any other options how to fetch fields from the objects with some kind special "admin_fetch('content'...)"
Only share section with "content","read" permission for anonymous group?</b>
maybe any other ideas how to arrange sections?