Page 1 of 1

CustomContent Syntax

Posted: Thu Mar 01, 2007 11:48 pm
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}

Re: CustomContent Syntax

Posted: Fri Mar 02, 2007 5:37 am
by cyberman
Have you tried elseif instead else (use else only for the last) ?

Re: CustomContent Syntax

Posted: Wed Mar 14, 2007 9:02 pm
by eleven3
Yes I tried that, this is my second shot.

My apologies for not mentioning that in my problem description.

Re: CustomContent Syntax

Posted: Thu Mar 15, 2007 12:39 am
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.

Re: CustomContent Syntax

Posted: Thu Mar 15, 2007 10:48 pm
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!

Re: CustomContent Syntax

Posted: Thu Mar 15, 2007 11:04 pm
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

Re: CustomContent Syntax

Posted: Fri Mar 16, 2007 8:29 pm
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.

Re: CustomContent Syntax

Posted: Fri Mar 16, 2007 11:25 pm
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.

Re: CustomContent Syntax

Posted: Mon Mar 19, 2007 6:06 pm
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.

Re: CustomContent Syntax

Posted: Tue Mar 20, 2007 6:39 am
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

Re: CustomContent Syntax

Posted: Tue Mar 20, 2007 7:29 am
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