AjaxFileListing.fwactionb.zip (2012-05-08) (Downloaded 74 times)
Contains:
Compatible: Pro 4, Pro 5, and Pro 5.5
AjaxFileListing.fwactionb.zip (2012-05-05) (Downloaded 0 times)
Contains:
Compatible: Pro 4, Pro 5, and Pro 5.5
AjaxFileListing.fwactionb.zip (2011-12-12) (Downloaded 3 times)
Contains:
Compatible: Pro 4, Pro 5, and Pro 5.5
AjaxFileListing.fwactionb.zip (2010-11-02) (Downloaded 0 times)
Contains:
Compatible: Pro 4 and Pro 5
AjaxFileListing.fwactionb.zip (2010-06-05) (Downloaded 0 times)
Contains:
Compatible: Pro 4 and Pro 5
Author: Walter Davis
prototype forms content management
Create a linked list of files from a directory on your server using this Action. Requires PHP on your server and JavaScript in the browser, but falls back gracefully if JavaScript is disabled.
Draw an instance of this Action on the page where you want the list to appear, or insert one as an inline element within another HTML item on the page.
Enter the relative path to your files directory from the current page. So if your list is in the root directory of your site, and you want to list the files directory, you would enter ‘files’ in the path field.
Choose a “loading” message, either the text ‘Loading…’ or a 16px or 32px animated GIF, eerily similar to the loading animation used in most Mac OS X applications.
Press the Make Index File button, and generate the index.php
file you will need for this whole thing to work. You will need to upload this file separately, so put this file somewhere meaningful on your hard drive. You will only need to generate this file once – the index file itself never changes, so you could even re-use it in another folder if you wanted to list more than one directory on your server.
Upload your site to the server, then use an FTP application like Transmit to connect to your server space. Create the files folder (call it what you like) and put all your files in it. Then add the index.php file you created with the Action to this same folder. Remember – this folder must be in a publicly visible location (so inside your public Web directory somewhere) and must have permissions set to allow anyone to browse it (775), or else the links will not work.
Browse to the page you just created, and you should see a momentary flash of the loading indicator, then the list of files from that folder.
Later, if you want to update the list of items on your page, all you need to do is upload or delete files from within that folder. Each time someone visits your page, a new list of links is generated and displayed, so this list will always reflect the contents of your server.
You can use CSS to style the list as you like. The list has the classname dirlist
, and each item in the list will either have the class even
or odd
. If you set a different background-color for each of those styles, you will be able to show alternating stripes like a Finder list view or iTunes.
Dan Jasker
Sounds cool, I'll have to try it.
Peter Morlock
I have applied it to our website www.mv-neuhausen.de/Archiv Could you help me with a short tutorial how to apply the css you mentioned. I am really interested to show the list entries in different background colours. Is there a chance to use css for the name of the folder?
Walter Davis
If you make styles in the Styles palette with
.even
or.odd
in the Tag field and nothing at all in the Name field, then they will apply automatically to these list elements. If you create another style with the tag.dirlist
, you can use that to style the list itself. For example, to style the list so that any bullets are hidden, you would make a style called.dirlist li
and use the Extended dialog to add a name: value pair oflist-style-type: none
.Tobias Eichner
Would be nice to have not only PHP supported, but also Perl.
Noah Moreland
This is really great but I'm not familiar with PHP and have no idea where to start with editing the style. Do you think there will be an update where you can at least change the link color?
Walter Davis
Click on the box that holds the list, and edit the link styles using the Inspector. If you want to change the list style (remove the bullets, maybe) then note the name of the box, and create a set of styles in the style palette to change that. This is all just CSS, not PHP.
Porter Boras
This action is pretty cool and worked until I applied a style. When I go to upload my site I get the error "listing.CLASS.substring is not a function" Any advice? This does not happen when a style is not applied.
Thanks
Walter Davis
You have to apply all styles using the Edit Styles dialog, as Tag-only styles. You cannot directly apply a style to the box itself.
Porter Boras
Im not sure what you mean? I created a style named X for example and created the action instance and then opened the inspector > styles > clicked the + under the action instances name from the list > and selected style X. Is this what you are saying is using the style dialog? I understand how to change the link colors via the inspector pane but beyond that I get this error.
Thank you for your time. I've searched the knowledge base for this action as well as the terms you just gave me on how to use tag-only styles with no luck.
Porter Boras
I have figured it out!
Walter Davis
If you create a matching tag-only style, you won't (and should not ever) apply it to anything. It will just magically work. Read the comments above for more examples.
Walter Davis
Here's an example for you: http://scripty.walterdavisstudio.com/afl/
The box on the right had its name changed to 'styled' in the Inspector, and the tag-only styles were added to the page. That was the complete extent of changes made between the box on the left and the box on the right. You don't touch anything else, and it just works. Note that the word 'styled' has no specific meaning here – that's the name of the box I drew with the Action. You can also replace the word
#styled
with the word.afl
in the CSS styles (this makes them class-based rather than id-based styles) and then one set of styles will apply to all instances of the AFL Action on the entire page.Eric Gossler
I had this working fine, and now it fell apart. Get the following error:
Error 404 - Not Found
The document you are looking for may have been removed or re-named. Please contact the web site owner for further assistance.
Not sure what's happening. Have the index.php file in the same directory where the Action page is running. Also have a directory of files simply called "files" at the root where that Action is pointing. Any ideas?
http://o-pspecialists.com/education/resources.html
Walter Davis
Index.php goes inside the folder with the files (don't worry – it won't list itself). Then make sure that you configure the relative path to that folder in the Action interface. If you're on file_listing.html (with the Action) and you have a folder named files in the same parent folder as that html file, you would simply enter
files
in the Action.Eric Gossler
— Update I have moved the Ajax Action page to http://o-pspecialists.com/education/resources2.html
Walter Davis
What is that iframe doing in the middle of the page? That's throwing a big error, can't see any instance of the Action on the rest of this page.
Eric Gossler
— Take that back. It is at it's original location at http://o-pspecialists.com/education/resources.html
index.php was recreated and added to the "files" directory — which is at the root of the parent directory public_html/o-pspecialists/files
Still no go. Any other thoughts?
Walter Davis
Ok, then change the link location in the Action to /files rather than files. The leading slash means "go up to the site root and follow the rest of the URL". Alternatively, if you move the files directory into the education directory, then the URL you entered will be correct.
Eric Gossler
BIG THANK YOU!
I really appreciate your Action and the fact that you helped me get through this.
Eric Gossler
Is there any way to show directories within the files location as subfolders — perhaps with expanding arrows — and not just clickable items?
Peter ELSEA
Is this working in Freeway 6? All I'm getting is a partial listing of the index.php file pqe
Walter Davis
It works, as long as you have enabled PHP on your server. You will never be able to see this working in a local preview, because you have to run the PHP script through a PHP server. Upload it to your server, and see if it works there.
Peter ELSEA
That's what I have been doing- I'm running it on Hurricane electric. I'll inquire about php operations there, although it's on their list of standard services.
Peter ELSEA
Hurricane electric has just confirmed that php is enabled for that site. To see what is happening, look at http://peterelsea.com/maxtutorials.html Perhaps it is an AppleScript problem? That machine is running Mountain Lion. I have heard that there have been some security changes.
Walter Davis
Browsing to this location: http://peterelsea.com/Maxtuts/index.php results in a file download of the full (uninterpreted) PHP source. This categorically indicates that PHP is not enabled on this server, or is enabled but is not correctly configured. You must be able to see the interpreted output from a PHP file, rather than its source, if you are to be able to use PHP on your server. Try putting the following line in a text file named test.php, and upload it to your server:
Browse to http://peterelsea.com/test.php and see what you see. If you only see that text (or a download) then PHP is broken on your server. If you see a large table full of descriptive data about your server, then PHP is working correctly. In either case, delete that file from your server after you run this test – it is not safe to leave it there.
Peter ELSEA
Thank you- I managed to get my ISP to actually turn php on rather than just claim it was on. It's working fine now.
Walter Davis
This is a test of <script> injection.
Pj Bonito
Hi, I'm wondering if there is anyway to get the links to open in a new window? I have the list in an ifame on my site and when you click on a file it opens in that frame. Other than that this is a super slick action so thanks for making it!
Sign In or to comment.