CustomContent Syntax

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.
Locked
eleven3

CustomContent Syntax

Post by eleven3 »

Hi All,

I am trying to show different content depending on if a user is loggedin and whether or not they are a member of four different groups.  To start I test if the user is logged in, and then through a series of nested if statements, I check to see if they are a member of one of the other groups, if they are it displays the content.

Only problem I am having is that this method doesn't work at all.  Is there another way to do this?

Thanks a bunch!

{cms_module module=CustomContent}


{content block="Platinum"}


{content block="Gold"}


{content block="Silver"}

{content block="Simple"}




{content}
cyberman

Re: CustomContent Syntax

Post by cyberman »

Have you tried elseif instead else (use else only for the last) ?
eleven3

Re: CustomContent Syntax

Post by eleven3 »

Yes I tried that, this is my second shot.

My apologies for not mentioning that in my problem description.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: CustomContent Syntax

Post by calguy1000 »

the comment syntax is very primitive, and doesn't support elseif, or even nested queries, etc.

use the smarty syntax for advanced logic.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
eleven3

Re: CustomContent Syntax

Post by eleven3 »

Calguy - Thanks for clarifying.

I'm really unfamiliar with smarty logic, is there anywhere you can point me to for getting started.  Thanks!
Zoorlat

Re: CustomContent Syntax

Post by Zoorlat »

Perhaps this thred can help: http://forum.cmsmadesimple.org/index.php?topic=9478.0

There you'll also find links to other resources concerning Smarty.

/Z
eleven3

Re: CustomContent Syntax

Post by eleven3 »

I got it working.  Thanks to all that helped, here is my solution in case anyone runs into the same problem.

{cms_module module=CustomContent} 
{if $customcontent_memberof_Platinum}   
Platinum Content
{elseif $customcontent_memberof_Gold}
Gold Content
{elseif $customcontent_memberof_Silver}
Silver Content 
{elseif $customcontent_memberof_Simple} 
Content
{else} Not logged in {/if}

Message me if you have any questions.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: CustomContent Syntax

Post by calguy1000 »

Code: Select all

{cms_module module=CustomContent}
You don't need this content........

if smarty is installed, it is available.  and it works.  especially if you're using the smarty syntax.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
eleven3

Re: CustomContent Syntax

Post by eleven3 »

Calguy,

It turns out the code I posted above doesn't work (even with your edit).  Upon logging in, it redirects to a page that should display content based on member level.  It doesn't, it just shows the content from the last else statement.

Any thoughts?

I'm going to keep tweaking it, and will post here if I figure it out.

Thanks.
alby

Re: CustomContent Syntax

Post by alby »

eleven3 wrote: Calguy,

It turns out the code I posted above doesn't work (even with your edit).  Upon logging in, it redirects to a page that should display content based on member level.  It doesn't, it just shows the content from the last else statement.

Any thoughts?

I'm going to keep tweaking it, and will post here if I figure it out.

Thanks.
Try with plugin: get_template_vars and watch if your variables

Alby
KO
Power Poster
Power Poster
Posts: 562
Joined: Mon Nov 06, 2006 7:55 pm

Re: CustomContent Syntax

Post by KO »

Maybe this "else" does not work. You could try:


  {content block="Platinum"}



      {content block="Gold"}


I tried this once and did not need this at all.

Keijo
Locked

Return to “CMSMS Core”