[themes] conditional output based on value of CCK field
puregin
puregin at puregin.org
Wed Jul 25 18:27:28 UTC 2007
Hi Mark,
i'd suggest that you install Content Template (contemplate)
module, and Developer Module.
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
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
>
More information about the themes
mailing list