getThemePath in block behaving very oddly
Permalink
In the power slider lite block, I'm trying to get the themepath:
and in the foreach loop, I have:
The code never returns the themepath unless I force it to throw an error by placing something like this after the foreach:
Because the $vs should be $v, it errors out which somehow allows it to accurately grab the themepath. Otherwise, it just comes out blank each time.
I don't know if this is related to the problem or not, but each time I update the blocks view, I have to load it to the server, go back into edit mode and then reselect the custom template before it will display the new changes.
$v = View::getInstance(); $themePath = $this->getThemePath(); $mobileCheck = strpos($themePath,'Mobile'); $useragent = strtolower($_SERVER['HTTP_USER_AGENT']); $isiPad = false; if(strstr($useragent,'ipad')) { $isiPad = true; }
and in the foreach loop, I have:
<?php if($mobileCheck && $isiPad === false){ // if is a mobile device but not an ipad ?> <img src="<?php echo $ih->getThumbnail($f, 480, 480)->src; ?>"> <?php } else if($isiPad){ // if it is an ipad ?> <img src="<?php echo $ih->getThumbnail($f, 1024, 1024)->src; ?>"> <?php } else { ?> <img src="<?php echo $ih->getThumbnail($f, 1400, 910)->src; ?>" width="640"> <?php } ?>
The code never returns the themepath unless I force it to throw an error by placing something like this after the foreach:
<!--<img src="<?php echo $ih->getThumbnail($f, 1400, 910)->src; ?>" width="640" test="<?php $vs->getThemePath() ?>">-->
Because the $vs should be $v, it errors out which somehow allows it to accurately grab the themepath. Otherwise, it just comes out blank each time.
I don't know if this is related to the problem or not, but each time I update the blocks view, I have to load it to the server, go back into edit mode and then reselect the custom template before it will display the new changes.
That at least works for me.