ztealmax Posted June 21, 2007 Share Posted June 21, 2007 Hi this is my code when i read text files, i would like it not to show the whole path before the filename as i use the filename as the title news/Welcome to our new website (i would like it not to show the line thats bold) need help with some code remove searchpath from this code: <?php // set file to read $file = $_GET['text']; // open file $fh = fopen($file, 'r') /*or die('Could not open file!')*/; // read file contents $data = fread($fh, filesize($file)) /*or die('Could not read file!')*/; // close file fclose($fh); // print file contents ?> <pre> </DIV></pre> </DIV> <div class='spacer'> <table cellpadding='0' cellspacing='0'> <tr> <td class='captiontopleft'><img src='".theme."images/blank.gif' width='6' height='30' alt='' style='display: block;' /></td> <td class='captiontopmiddle' style='white-space:nowrap'><? echo $file ;?></td> <td class='captiontopright'><img src='".theme."images/blank.gif' width='6' height='30' alt='' style='display: block;' /></td> </tr> </table> <table cellpadding='0' cellspacing='0'> <tr> <td class='bodyleft'><img src='".theme."images/blank.gif' width='6' height='1' alt='' style='display: block;' /></td> <td class='bodymain'><? echo $data;?><br><br><? echo lan_10 . date ("F d Y H:i:s.", filemtime($file)); ?></td> <td class='bodyright'><img src='".theme."images/blank.gif' width='6' height='1' alt='' style='display: block;' /></td> </tr> </table> <table cellpadding='0' cellspacing='0'> <tr> <td class='bottomleft'><img src='".theme."images/blank.gif' width='6' height='7' alt='' style='display: block;' /></td> <td class='bottommiddle'><img src='".theme."images/blank.gif' width='1' height='7' alt='' style='display: block;' /></td> <td class='bottomright'><img src='".theme."images/blank.gif' width='6' height='7' alt='' style='display: block;' /></td> </tr> </table> </div> So if anyone got any suggestions ideas, please post //Cheers Quote Link to comment https://forums.phpfreaks.com/topic/56574-solved-need-help-with-some-code-remove-searchpath-from-this-code/ Share on other sites More sharing options...
trq Posted June 21, 2007 Share Posted June 21, 2007 Take a look at basename(). Quote Link to comment https://forums.phpfreaks.com/topic/56574-solved-need-help-with-some-code-remove-searchpath-from-this-code/#findComment-279400 Share on other sites More sharing options...
ztealmax Posted June 21, 2007 Author Share Posted June 21, 2007 thanx m8 Quote Link to comment https://forums.phpfreaks.com/topic/56574-solved-need-help-with-some-code-remove-searchpath-from-this-code/#findComment-279402 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.