Jump to content

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


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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.