Disable a php code only in homepage -
i want add php code in cms site's header, dont want run in homepage. because causes errors!!
already tried code, somehow still runs code , shows error
<?php $homepage = "/"; $currentpage = $_server['request_uri']; if($homepage==$currentpage) { } else {code} ?>
it not error, if php code run in home page header , call database query, home page not assigned work for. trying add additional feature.
this code
<?php $item = the_item(); $imgsd = 'store_avatar( ( !empty( $item->image2 ) ? $item->image2 : store_avatar( $item->store_img ) ) )'; ?>
try more (might work):
<?php $homepage = array("/","/index.html","/index.php"); $currentpage = strtolower($_server['request_uri']); if(!in_array($currentpage, $homepage)) { //code goes here } ?>
p.s. : try indent code when post on internet.
Comments
Post a Comment