We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: List Contents

Development and Programming

Brad Street's avatar
Brad Street
239 posts
17 years ago
Brad Street's avatar Brad Street

This is my first plugin, written in response to this post. This plugin allows you to specify a path (NOT FULL URL) and it will iterate over the contents and print an ordered or unordered list of the files. It can optionally filter out various filetypes as well as create links to the files. It also allows CSS customization, as classes can be passed in for the list, list items and anchor tags. Of course, please let me know of any bugs you find.

*File updated to version 1.1 12/20/08 - Added ability to sort links using optional parameter of sort=”asc” or sort=”desc”.

       
jeremydouglas's avatar
jeremydouglas
292 posts
17 years ago
jeremydouglas's avatar jeremydouglas

Nice work!

Another thought, this would be neat to have as a custom field in the CP. For example, some sites I built need to have large mp3’s uploaded through ftp. The person updating the site could then make a weblog post and select the file they posted from a list (this could save them making a typo).

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hi Brad,

Nice little plugin there, well done. I was trying to get it working like this though :

{exp:list_contents folder_url="{site_url}images/site/layout/" links="on" list_type="ol"}

Seems that won’t work as it comes up with :

Not a valid directory path:/usr/local/psa/home/vhosts/example.com/httpdocshttp://www.example.com/images/site/layout/

Not too sure why it does that or what you would have to do to fix that but would be nice if it could work with the (as yet undocumented 😉 ) {site_url} variable.

Great addition though.

Best wishes,

Mark

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen
Nice work! Another thought, this would be neat to have as a custom field in the CP. For example, some sites I built need to have large mp3’s uploaded through ftp. The person updating the site could then make a weblog post and select the file they posted from a list (this could save them making a typo).

That is a nice thought. Would make things really easy for clients and we all know that they need every little bit of help they can get with things!! 😉

Best wishes,

Mark

       
Brad Street's avatar
Brad Street
239 posts
17 years ago
Brad Street's avatar Brad Street

Thanks for the great suggestion, Jeremy. I haven’t attempted to do anything witht he CP yet, but will look into it.

Mark - looking into the {site_url} issue now.

Thanks!

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Well no - thank you!! 😊

If you can’t get {site_url} to work then no worries as it doesn’t matter about having to hard-code that bit into the template. Jeremy’s suggestion is a great one though so if you want to forget mine then please do 😉

Best wishes,

Mark

       
Brad Street's avatar
Brad Street
239 posts
17 years ago
Brad Street's avatar Brad Street

Ok, plugin updated to accept file path - no URL required. Give that a go - new download is available at start of this thread.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Neat! Although I think you have some echoing code coming out where it shouldn’t be perhaps?

I am seeing this code :

Array
(
    [path] => /images/site/layout/
)

on my page before all the links.

Best wishes,

Mark

       
Brad Street's avatar
Brad Street
239 posts
17 years ago
Brad Street's avatar Brad Street

Thanks Mark - darned debugging code. New file posted at top of thread, or u can comment out line 26 of yours.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hi Brad,

Yep found that in the code and un-commented already but thanks for looking into that. Using this in the CP really would be excellent if you can get that working 😉

Great job though, brilliant!

Best wishes,

Mark

       
Brad Street's avatar
Brad Street
239 posts
17 years ago
Brad Street's avatar Brad Street

I’ll take a closer look at this when I get home tonight. At the moment I don’t know where I’d begin to make this a custom field in CP. But hey, how hard could it be?

       
ms's avatar
ms
274 posts
17 years ago
ms's avatar ms

Brad, thanks for this - but honestly I lost track of your versions already. Could you use a numbering scheme for the file? I’m in another time zone and really don’t now it I visited the thread before or after 1:30pm EST 😉

       
Brad Street's avatar
Brad Street
239 posts
17 years ago
Brad Street's avatar Brad Street

Markus,

Haha - sorry about that. The newest version is at the top of this thread, and was from 1:30pm EST (-5 GMT). At any rate - will increment version from here on out.

       
e-man's avatar
e-man
1,816 posts
16 years ago
e-man's avatar e-man

Just wanna say thanks for an incredibly useful plugin 😊

       
Brad Street's avatar
Brad Street
239 posts
16 years ago
Brad Street's avatar Brad Street

Thanks eman,

I’m really glad that you found this useful. I answered a related thread earlier where someone had commented on it - and I had all but forgotten about this (as most of the time I code directly in PHP (now with CI) as opposed to EE. At any rate, just wanted to say thanks for trying it out and finding a use for it. 😊

       
1 2

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.