Page 1 of 1

[solved] Possible to test for Content Type?

Posted: Wed Jun 05, 2013 7:37 am
by Cerulean
I'm wondering if it's possible to test for the "Content Type" attribute in a template, specifically the "Protected Content" type added by the Frontend Users module.

Some sort of test like...

{if content_type == "Protected Content"}
...display something...
{/if}

Anyone know how to do this?

Re: Possible to test for Content Type?

Posted: Wed Jun 05, 2013 11:04 am
by Rolf
The Custom Content module has this feature.

Code: Select all

{if $ccuser->loggedin()}
   ** DO SECRET STUFF **     
{/if}

Re: Possible to test for Content Type?

Posted: Wed Jun 05, 2013 3:40 pm
by Dr.CSS
I think if it is Protected content type it won't show the page in the menu or anywhere else until someone logs in and if they know the URL it most likely will show the log in form or redirect to it, so that wouldn't do anything...

Re: Possible to test for Content Type?

Posted: Wed Jun 05, 2013 7:21 pm
by uniqu3
You can try with

Code: Select all

{if $content_obj->FriendlyName() == 'Protected Content'}
    do something
{/if}
See http://apidoc.cmsmadesimple.org/CMS/Con ... iendlyName

Re: Possible to test for Content Type?

Posted: Wed Jun 05, 2013 8:59 pm
by Cerulean
Thanks for the replies.
uniqu3 wrote:You can try with

Code: Select all

{if $content_obj->FriendlyName() == 'Protected Content'}
    do something
{/if}
See http://apidoc.cmsmadesimple.org/CMS/Con ... iendlyName
This worked well.

For what I needed to achieve I also had success with:

Code: Select all

{if $feu_page}
    do something
{/if}

Re: Possible to test for Content Type?

Posted: Sat Jun 22, 2013 9:56 pm
by Rolf