php display a multiple-line variable
Permalink
Hello,
I have a multiple-line text variable called "Short itinerary" but am having problems returning it on the page.
The following code works fine when "Short itinerary" is a single line of short text. But when "Short itinerary" is multiple-line text nothing is returned. I think it's something to do with multiple-line text being an array, but I'm not sure how this should be coded in the php.
Help very much very welcome!! :)
[code]
<?php
$shortitins = $tour->xpath('custom_fields/field[name="Short itinerary"]/value');
foreach($shortitins as $shortitin) {
print $shortitin;
}
?>
I have a multiple-line text variable called "Short itinerary" but am having problems returning it on the page.
The following code works fine when "Short itinerary" is a single line of short text. But when "Short itinerary" is multiple-line text nothing is returned. I think it's something to do with multiple-line text being an array, but I'm not sure how this should be coded in the php.
Help very much very welcome!! :)
[code]
<?php
$shortitins = $tour->xpath('custom_fields/field[name="Short itinerary"]/value');
foreach($shortitins as $shortitin) {
print $shortitin;
}
?>
Are you familiar with using var_dump() to debug your PHP?
http://php.net/manual/en/function.var-dump.php...
It can help provide more information about your variables.
Example:
- check the value of $shortitins when you know it is a single line of text
- check the value of $shortitins when you know it is multiple lines of text