1 of 2
1
Plugin: List Contents
Posted: 13 May 2008 09:34 AM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  251
Joined  02-27-2008

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”.

File Attachments
pi.list_contents.zip  (File Size: 2KB - Downloads: 198)
Profile
 
 
Posted: 13 May 2008 09:49 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  343
Joined  01-23-2006

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).

 Signature 

jeremy douglas media design | twitter

Profile
 
 
Posted: 13 May 2008 09:51 AM   [ Ignore ]   [ # 2 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10829
Joined  04-15-2006

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 wink ) {site_url} variable.

Great addition though.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 13 May 2008 09:53 AM   [ Ignore ]   [ # 3 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10829
Joined  04-15-2006
jez777 - 13 May 2008 09:49 AM

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!! wink

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 13 May 2008 10:03 AM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  251
Joined  02-27-2008

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!

Profile
 
 
Posted: 13 May 2008 10:17 AM   [ Ignore ]   [ # 5 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10829
Joined  04-15-2006

Well no - thank you!! grin

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 wink

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 13 May 2008 10:23 AM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  251
Joined  02-27-2008

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

Profile
 
 
Posted: 13 May 2008 10:33 AM   [ Ignore ]   [ # 7 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10829
Joined  04-15-2006

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

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 13 May 2008 12:30 PM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  251
Joined  02-27-2008

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

Profile
 
 
Posted: 13 May 2008 12:47 PM   [ Ignore ]   [ # 9 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10829
Joined  04-15-2006

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 wink

Great job though, brilliant!

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 13 May 2008 12:52 PM   [ Ignore ]   [ # 10 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  251
Joined  02-27-2008

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?

Profile
 
 
Posted: 13 May 2008 06:54 PM   [ Ignore ]   [ # 11 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  814
Joined  03-16-2002

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 wink

Profile
 
 
Posted: 13 May 2008 09:41 PM   [ Ignore ]   [ # 12 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  251
Joined  02-27-2008

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.

Profile
 
 
Posted: 09 September 2008 07:30 AM   [ Ignore ]   [ # 13 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2062
Joined  09-16-2004

Just wanna say thanks for an incredibly useful plugin smile

 Signature 

Peace, e-man.
stookstudio.com, websites built with care and web standards. LinkedIn profile

Profile
 
 
Posted: 09 September 2008 12:35 PM   [ Ignore ]   [ # 14 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  251
Joined  02-27-2008

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.  smile

Profile
 
 
Posted: 20 December 2008 02:39 PM   [ Ignore ]   [ # 15 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  272
Joined  11-22-2006

Is there any way to sort the order in which they are displayed?

It looks random and I can’t work out the sequence to influence it.
It doesn’t seem to be alpha, date or file type.

I’m not a PHP guru to be able to hack the plugin code without help.

 Signature 

pfweb.co.uk

Profile
 
 
Posted: 20 December 2008 05:45 PM   [ Ignore ]   [ # 16 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  251
Joined  02-27-2008

Paul,

Updated the plugin per your request to now accept a sort parameter, such as sort=“asc” for ascending or sort=“desc” for descending. If the sort parameter isn’t passed, it will display links in the same order as they are within the folder.

The updated file is available via link in the first post of this thread.

Enjoy!

Profile
 
 
Posted: 20 December 2008 06:58 PM   [ Ignore ]   [ # 17 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  272
Joined  11-22-2006

Thank you very much.

I never cease to be amazed by the EE community and it’s support.
Only 3 hours after I made a request and a modified version is posted!

I’ve uploaded the new version and it’s working perfectly.

Listening to your music as I type this, I like it!

 Signature 

pfweb.co.uk

Profile
 
 
Posted: 21 December 2008 02:48 AM   [ Ignore ]   [ # 18 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  251
Joined  02-27-2008

Thanks for using the plugin and your kind comments about my music. Glad you found the module useful. I too am always impressed by the community surrounding EE.

This plugin was my first attempt at enhancing EE, and hadn’t been touched in quite some time. Needless to say, I ended up rewriting the code for this when I had a chance to open it up and look at it again. Anyways, happy to help. Let me know if you think of any other ways to make this plugin better.

Profile
 
 
   
1 of 2
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1743, on December 02, 2009 03:47 PM
Total Registered Members: 120427 Total Logged-in Users: 60
Total Topics: 126522 Total Anonymous Users: 33
Total Replies: 665284 Total Guests: 328
Total Posts: 791806    
Members ( View Memberlist )