2012-06-13, 00:27:52
Hi there,
I want to build an image gallery dynamically depending on the filled customs field. This code does not work. Using firebug shows that the surrounding DIV element stays clear, DEBUG MODE does not show any errors.
Any I ideas whats' wrong?
Thanks, Carsten
<code>
<?php
$ARTICLE_IMAGE_1 = return_custom_field('articleimage1');
$ARTICLE_IMAGE_2 = return_custom_field('articleimage2');
$ARTICLE_IMAGE_3 = return_custom_field('articleimage3');
$ARTICLE_IMAGE_4 = return_custom_field('articleimage4');
$ARTICLE_GALLERY = null;
if( !empty($ARTICLE_IMAGE_1) ||
!empty($ARTICLE_IMAGE_2) ||
!empty($ARTICLE_IMAGE_3) ||
!empty($ARTICLE_IMAGE_4)){
$ARTICLE_GALLERY = '<ul id="article_gallery">';} else {}
if(!empty($ARTICLE_IMAGE_1)){
$ARTICLE_GALLERY .= '<li><img class="" src="' . $ARTICLE_IMAGE_1 . '" /></li>';} else {}
if(!empty($ARTICLE_IMAGE_2)){
$ARTICLE_GALLERY .= '<li><img class="" src="' . $ARTICLE_IMAGE_2 . '" /></li>';} else {}
if(!empty($ARTICLE_IMAGE_3)){
$ARTICLE_GALLERY .= '<li><img class="" src="' . $ARTICLE_IMAGE_3 . '" /></li>';} else {}
if(!empty($ARTICLE_IMAGE_4)){
$ARTICLE_GALLERY .= '<li><img class="" src="' . $ARTICLE_IMAGE_4 . '" /></li>';} else {}
if( !empty($ARTICLE_IMAGE_1) ||
!empty($ARTICLE_IMAGE_2) ||
!empty($ARTICLE_IMAGE_3) ||
!empty($ARTICLE_IMAGE_4)){
$ARTICLE_GALLERY .= '</ul>';} else {}
echo $ARTICLE_GALLERY;
?>
</code>
I want to build an image gallery dynamically depending on the filled customs field. This code does not work. Using firebug shows that the surrounding DIV element stays clear, DEBUG MODE does not show any errors.
Any I ideas whats' wrong?
Thanks, Carsten
<code>
<?php
$ARTICLE_IMAGE_1 = return_custom_field('articleimage1');
$ARTICLE_IMAGE_2 = return_custom_field('articleimage2');
$ARTICLE_IMAGE_3 = return_custom_field('articleimage3');
$ARTICLE_IMAGE_4 = return_custom_field('articleimage4');
$ARTICLE_GALLERY = null;
if( !empty($ARTICLE_IMAGE_1) ||
!empty($ARTICLE_IMAGE_2) ||
!empty($ARTICLE_IMAGE_3) ||
!empty($ARTICLE_IMAGE_4)){
$ARTICLE_GALLERY = '<ul id="article_gallery">';} else {}
if(!empty($ARTICLE_IMAGE_1)){
$ARTICLE_GALLERY .= '<li><img class="" src="' . $ARTICLE_IMAGE_1 . '" /></li>';} else {}
if(!empty($ARTICLE_IMAGE_2)){
$ARTICLE_GALLERY .= '<li><img class="" src="' . $ARTICLE_IMAGE_2 . '" /></li>';} else {}
if(!empty($ARTICLE_IMAGE_3)){
$ARTICLE_GALLERY .= '<li><img class="" src="' . $ARTICLE_IMAGE_3 . '" /></li>';} else {}
if(!empty($ARTICLE_IMAGE_4)){
$ARTICLE_GALLERY .= '<li><img class="" src="' . $ARTICLE_IMAGE_4 . '" /></li>';} else {}
if( !empty($ARTICLE_IMAGE_1) ||
!empty($ARTICLE_IMAGE_2) ||
!empty($ARTICLE_IMAGE_3) ||
!empty($ARTICLE_IMAGE_4)){
$ARTICLE_GALLERY .= '</ul>';} else {}
echo $ARTICLE_GALLERY;
?>
</code>