-
- 884 Posts
I want to tidy the path from the results of using @DIRECTORY binding. anyone have something like this handy maybe?
-
- 2,877 Posts
-
- 2,877 Posts
-
- 24,544 Posts
Can you give some examples of what you want and what you get?
-
- 884 Posts
I’m trying to setup a files list for clients to download. Manager user will tick the boxes of relevant filenames in backend. using @DIRECTORY and delimited list let’s me *almost* get it but the files appears with full path and extra / in the path.
When I try @DIRECTORY with the hyperlink widget it comes out clickable and valid but I have to set the display name, and that part I want to be the file name. If I use [*product_files*] I get PHx memory error.
will take any ideas that you have on that.
-
- 24,544 Posts
Ah, I thought you were in the front end. Another case where @SNIPPET would come in handy.
You could do it with a monster @EVAL using readdir(). You could create the code in a snippet in the front end to test it before pasting it into the TV.
Can you give an example of what the Input Options string would look like?
BTW, there is a System Event called OnTVFormPrerender so you might be able to do what you want with a plugin.
-
- 4,213 Posts
Here’s a phx modifier that returns file name from path.
<?php
$path = pathinfo($output);
return $path['basename'];
?>
See
pathinfo in php docs.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
-
- 24,544 Posts
Quote from: doze at Aug 31, 2009, 06:58 AM
Here’s a phx modifier that returns file name from path.
<?php
$path = pathinfo($output);
return $path['basename'];
?>
See pathinfo in php docs.
Very nice. I was looking for pathinfo() but couldn’t remember what it was called in PHP.
-
- 24,544 Posts
Quote from: BobRay at Aug 31, 2009, 07:03 AM
Quote from: doze at Aug 31, 2009, 06:58 AM
Here’s a phx modifier that returns file name from path.
<?php
$path = pathinfo($output);
return $path['basename'];
?>
See pathinfo in php docs.
Very nice. I was looking for pathinfo() but couldn’t remember what it was called in PHP.
BTW, I think this will do it also:
return $basename($output);