slaterino Posted January 19, 2009 Share Posted January 19, 2009 Hi, I have a php script which should show the contents of a directory. However, when I go to that page all coding is in a block of text with some of the actual code missing. The page title for this page is: Directory Listing of <?=dirname($_SERVER['PHP_SELF']).'/'.$leadon;?> This is an example of some of the code appears: */ error_reporting(0); if(!function_exists('imagecreatetruecolor')) $showthumbnails = false; $leadon = $startdir; if($leadon=='.') $leadon = ''; if((substr($leadon, -1, 1)!='/') && $leadon!='') $leadon = $leadon . '/'; $startdir = $leadon; Could this be something to do with my .htaccess file. The contents of which are: <IfModule mod_ssl.c> RewriteBase /thghosting.co.uk/ </IfModule> <IfModule !mod_ssl.c> RewriteBase / </IfModule> RewriteEngine On RewriteRule ^([^a-zA-Z\.]*)$ index.cgi/$1 [L,NE] RewriteEngine On RewriteRule ^([^a-zA-Z\.]*)$ index.cgi/$1 [L] Quote Link to comment https://forums.phpfreaks.com/topic/141525-solved-php-page-has-title-directory-listing-and-showing-code-incorrectly/ Share on other sites More sharing options...
trq Posted January 19, 2009 Share Posted January 19, 2009 Seems you don't have short tags enabled. Change.... Directory Listing of <?=dirname($_SERVER['PHP_SELF']).'/'.$leadon;?> to.... Directory Listing of <?php echo dirname($_SERVER['PHP_SELF']).'/'.$leadon;?> and use <?php instead of <? Quote Link to comment https://forums.phpfreaks.com/topic/141525-solved-php-page-has-title-directory-listing-and-showing-code-incorrectly/#findComment-740786 Share on other sites More sharing options...
slaterino Posted January 19, 2009 Author Share Posted January 19, 2009 Cheers man, Changed all the short tags like you suggested and problem solved! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/141525-solved-php-page-has-title-directory-listing-and-showing-code-incorrectly/#findComment-740798 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.