Jump to content

[SOLVED] obtain files that have cetain format using GLOB ?


jasonc

Recommended Posts

<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

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"));

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.