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.

error page

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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -