sinbad Reply #1, 2 years, 8 months ago
I want to tidy the path from the results of using @DIRECTORY binding. anyone have something like this handy maybe?
$url = "http://www.domain.com/path/to/file/filename.php";
$filename = basename($url);
echo $filename; //filename.php
<?php $path = pathinfo($output); return $path['basename']; ?>
Here's a phx modifier that returns file name from path.Very nice. I was looking for pathinfo() but couldn't remember what it was called in PHP.
<?php $path = pathinfo($output); return $path['basename']; ?>
See pathinfo in php docs.
Quote from: doze at Aug 31, 2009, 01:58 AMHere's a phx modifier that returns file name from path.Very nice. I was looking for pathinfo() but couldn't remember what it was called in PHP.
<?php $path = pathinfo($output); return $path['basename']; ?>
See pathinfo in php docs.
BTW, I think this will do it also:
return $basename($output);