jasonc Posted October 1, 2009 Share Posted October 1, 2009 <ul class="latestnews"> <? $files = glob($dir . 'agendas/*.htm'); $urlname = date('j M Y',strtotime(basename($files[0],".htm"))); $url = date('Ymd',strtotime(basename($files[0],".htm"))); ?><li><a href="?a=<?=$url;?>"><? if (strlen(date('j',strtotime(basename($files[0],".htm")))) == 1) { ?> <? } ?><strong><?=$urlname;?></strong></a></li> </ul> currently this works only if the file names have the format... 2009-07-29.htm but need to have the file names in this format instead..... ABC - 21-09-2009 - Agenda.htm how can i correctly get the files to show if following this format. this format is always going to be like this.... three letters space dash space date(dd-mm-yyyy) space dash doctype(agenda or minutes) dot htm Link to comment https://forums.phpfreaks.com/topic/176184-solved-obtain-files-that-have-cetain-format-using-glob/ Share on other sites More sharing options...
jasonc Posted October 1, 2009 Author Share Posted October 1, 2009 SOLVED Link to comment https://forums.phpfreaks.com/topic/176184-solved-obtain-files-that-have-cetain-format-using-glob/#findComment-928479 Share on other sites More sharing options...
Maq Posted October 1, 2009 Share Posted October 1, 2009 Do you mind sharing the solution so that others can reference? NOTE: There is a "Topic Solved" button in the bottom left. Link to comment https://forums.phpfreaks.com/topic/176184-solved-obtain-files-that-have-cetain-format-using-glob/#findComment-928526 Share on other sites More sharing options...
jasonc Posted October 2, 2009 Author Share Posted October 2, 2009 oh, the text is not there i thought it pasted ok when i posted the reply to show how i done it... here is the answer... i replaced $urlname = date('j M Y',strtotime(basename($files[0],".htm"))); with $urlname = strtotime(basename(substr($files[0], 14, 10),".pdf")); Link to comment https://forums.phpfreaks.com/topic/176184-solved-obtain-files-that-have-cetain-format-using-glob/#findComment-929087 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.