I have a seleciton list in CCK:
temp|Temporary
full|Full
I want to output the Temporary one. How?
foreach ((array) $node->field_job_length as $item) {
$job[] = $item['view'];
}
This only gets me the temp.
Help
I have a seleciton list in CCK:
temp|Temporary
full|Full
I want to output the Temporary one. How?
foreach ((array) $node->field_job_length as $item) {
$job[] = $item['view'];
}
This only gets me the temp.
Help
Comments
Comment #1
yched commentedWhere are you using this code ? in a node template ?
If your display is using the default formatter, you *should* get the aliased values...
Comment #2
billnbell commentedI am doing it in a custom template: -search-result.tpl.php
It always returns "temp". I got the Temporary to output by doing the following.
tpl.php:
$job = array();
foreach ((array) $node->field_job_length as $item) {
$job[] = content_format("field_job_length", $item);
}
$hrs = array();
foreach ((array) $node->field_job_hours as $item) {
$hrs[] = content_format("field_job_hours", $item);
}
print implode(",", $hrs) . ' - ' . implode(",", $job);
My theme() call: $output .= theme('hiho_search_result', $node, $row['distance'], 0.0, $links, new content_profile_theme_variables($node->uid));
Comment #3
billnbell commentedyched: I guess most people have selection lists that have the same name and value.
|
content_format("field_job_hours", $item);
Is definately the way to get it to work.... FYI for others.