[themes] conditional output based on value of CCK field

Victor Kane victorkane at gmail.com
Wed Jul 25 21:17:32 UTC 2007


Mark,

Perhaps you are not familiar with the Drupal Dojo group, which has an
ongoing series of lessons covering these and other interesting stuff, just
the thing for people getting more involved in intermediate and advanced
Drupal fine tuning and more.

The group: http://groups.drupal.org/drupal-dojo

Special group site with lesson roundups: http://drupaldojo.com

Class notes on theming lesson that was broadcast (you can download the notes
and the code from the class, and maybe even the old video podcast):

1.  notes:  http://groups.drupal.org/node/2764
2.  more references on the same lesson:
http://drupaldojo.com/lesson/theming-and-the-themer-pack

saludos,

Victor Kane
http://awebfactory.com.ar

On 7/25/07, Mark Hope <mark at markhope.net> wrote:
>
>
> On 25 Jul 2007, at 19:27, puregin wrote:
>
> > Hi Mark,
> >
> >      i'd suggest that you install Content Template (contemplate)
> > module, and Developer Module.
>
> Never had much success with contemplate but will look again at devel.
>
> > These will help you to discover the way to reference the fields you
> > need.
> > For example, you will probably need to examine
> >
> >     $node->field_news_type[0]['value']
> >
> > or something to that effect.
> >
> > Also, php.net is a good source of information for basic PHP syntax.
> >
> > Using these resources, you'll find your code probably looks something
> > like this:
> >
> > switch ($node->field_news_type[0]['value'] == 'Retail Week Teaser') {
> >      case 'Teaser Article':
> >        // do something
> >        break;
> >      case 'Editorial':
> >         // do something else
> >         break;
> >      case 'Full News Article':
> >         // handle this case
> >         break;
> > }
> >
> > Hope this sets you off in the right direction.
> >
> >      Good luck, Djun
>
> Thanks for the help!
>
>
> >
> >
> > On 25-Jul-2007, at 10:55 AM, Mark Hope wrote:
> >
> >> I've got a CCK content type using a field called 'field_news_type'
> >>
> >> I'm looking to conditionally output some code based on the value of
> >> the CCK field.
> >> The Field has a possible 3 values:
> >>      Editorial
> >>      Full News Article
> >>      Teaser Article
> >>
> >> I need to do something like:
> >>
> >> if $field_news_type = Retail Week Teaser {
> >>   //dothis
> >> }
> >>
> >> Any pointers would be appreciated.
> >>
> >> Thanks
> >> Mark
> >>
> > _______________________________________________
> > themes mailing list
> > themes at drupal.org
> > http://lists.drupal.org/mailman/listinfo/themes
>
> _______________________________________________
> themes mailing list
> themes at drupal.org
> http://lists.drupal.org/mailman/listinfo/themes
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/themes/attachments/20070725/aa06484d/attachment.htm 


More information about the themes mailing list