[solved] Possible to test for Content Type?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
Cerulean
Forum Members
Forum Members
Posts: 172
Joined: Mon Nov 01, 2010 8:56 am
Location: New Zealand

[solved] Possible to test for Content Type?

Post 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?
Last edited by Cerulean on Sun Jun 23, 2013 1:54 am, edited 1 time in total.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Possible to test for Content Type?

Post by Rolf »

The Custom Content module has this feature.

Code: Select all

{if $ccuser->loggedin()}
   ** DO SECRET STUFF **     
{/if}
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Possible to test for Content Type?

Post 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...
uniqu3

Re: Possible to test for Content Type?

Post 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
Cerulean
Forum Members
Forum Members
Posts: 172
Joined: Mon Nov 01, 2010 8:56 am
Location: New Zealand

Re: Possible to test for Content Type?

Post 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}
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Possible to test for Content Type?

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Post Reply

Return to “CMSMS Core”