[themes] conditional output based on value of CCK field
Mark Hope
mark at markhope.net
Wed Jul 25 18:39:07 UTC 2007
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
More information about the themes
mailing list