(Using ModX 1.0.5)
When I execute my current snippet (see snippet below), it seems to completely ignore the if(empty())
checks.
I have also tried with if($promoX == )
, also no luck.
<?php
$promo1 = [*sidepromotop*] ; // assets/images/promo1.jpg
$promo2 = [*sidepromobot*] ; // this variable is empty.
if(empty($promo1) && empty($promo2)){
echo [!Ditto? &startID=`92` &depth=`1` &display=`2` &randomize=`1` &tpl=`Promo-Block-Styles`!] ;
}else{
if(empty($promo1)){
echo [!Ditto? &startID=`92` &depth=`1` &display=`1` &randomize=`1` &tpl=`Promo-Block-Styles`!] ;
}else{
echo <div class="promo"><img src=" .$promo1. " alt="" /></div> ;
}
if(empty($promo2)){
echo [!Ditto? &startID=`92` &depth=`1` &display=`1` &randomize=`1` &tpl=`Promo-Block-Styles`!] ;
}else{
echo <div class="promo"><img src=" .$promo2. " alt="" /></div> ;
}
}
?>
以上准则出于某种原因将显示如下:
<div class="promo">
<img src="assets/images/promo1.jpg" alt="">
</div>
<div class="promo">
<img src="" alt="">
</div>
你可以看到,即使变量是空的,在我通过我的法典管理这一变量时,它显然仍然认为它不是空洞的。
我真的希望能看到这方面的一些见解,因为我是新鲜的,我是这样一位头脑!
感谢!