Results 1 to 25 of 25
  1. #1
    Super Sh!t Stirrer SSanf's Avatar
    Join Date
    January 18th, 2005
    Posts
    9,944
    Can it be done??
    I am working on a site where a number of people make contributions using FTP.

    Is there some way to make the files in the directory come up like links on a html or htm page? I am hoping to find some answer that will work sort of like server side includes so that the page does not need to be updated every time a contribution is made.

    What I want to include will look something like the contents on a page like
    ftp ://www.some site/some_stupid_directory.

    I don't know if I have made the question clear but anyway, thanks.

    SSanf
    Comments are opinion unless otherwise noted. Remember, pillage first. Then burn. Half of all people in the world have IQs under 100. You best learn to trust ol' SSanf!

  2. #2
    ABW Ambassador Snib's Avatar
    Join Date
    January 18th, 2005
    Location
    Virginia
    Posts
    5,303
    That's certainly possible with PHP. If the FTP files are on a different server from the script you'll need to have the PHP script log into the FTP account and retrieve a directory listing of the files. If the FTP files are on the same server as the PHP script it's as simple as reading the directory and displaying the list of files. Once you've got the list of files you can simply print them out as HTML.

    - Scott
    Hatred stirs up strife, But love covers all transgressions.

  3. #3
    Super Sh!t Stirrer SSanf's Avatar
    Join Date
    January 18th, 2005
    Posts
    9,944
    I do not know how to use PHP.

    I don't need to print them. I want the list to display on the HTML page.

    Thanks.
    Comments are opinion unless otherwise noted. Remember, pillage first. Then burn. Half of all people in the world have IQs under 100. You best learn to trust ol' SSanf!

  4. #4
    Newbie TheHoff's Avatar
    Join Date
    March 5th, 2006
    Posts
    260
    Make your HTML page PHP by naming it with the PHP extension. At the point you want to list the contents, add this:

    Code:
    <?php
    
    $d = dir('./ftpuploads');
    
    while ($entry = $d->read())
    {
    ?>
    
    <a href="http://www.thesite.com/ftpuploads/<?=$entry?>"><?=$entry?></a>
    
    <? } ?>
    Thats off the top of my scalp so no guarantees... change the first line in the code to reflect the directory where ftp uploads land -- same with the link, change that as well.

  5. #5
    Super Sh!t Stirrer SSanf's Avatar
    Join Date
    January 18th, 2005
    Posts
    9,944
    Thank you!

    Do I need to put a ? in the URL somewhere? Or is it enough to just change html to php?

    If this works, you are a big time hero to me!!
    Comments are opinion unless otherwise noted. Remember, pillage first. Then burn. Half of all people in the world have IQs under 100. You best learn to trust ol' SSanf!

  6. #6
    ABW Ambassador Snib's Avatar
    Join Date
    January 18th, 2005
    Location
    Virginia
    Posts
    5,303
    Quote Originally Posted by SSanf
    I do not know how to use PHP.

    I don't need to print them. I want the list to display on the HTML page.

    Thanks.
    Sorry!

    By "print" I mean display the data as HTML. I didn't mean to print as you would with a printer. There's a PHP command that's called "print" or "echo" that displays data in the HTML.

    - Scott
    Hatred stirs up strife, But love covers all transgressions.

  7. #7
    Newbie TheHoff's Avatar
    Join Date
    March 5th, 2006
    Posts
    260
    You do not need the ? -- just change it to .php

    This will be the trickiest line to get right:

    $d = dir('./ftpuploads');

    That line will work if your ftp directory is directly below the HTML directory this script will run from. If it is one directory above and then to the side, the line would be:

    $d = dir('../ftpuploads');

    or up two and over one

    $d = dir('../../ftpuploads');

    It would be more accurate if you put the full server path to the ftpuploads directory so if you can figure that out it would be good too.

  8. #8
    Super Sh!t Stirrer SSanf's Avatar
    Join Date
    January 18th, 2005
    Posts
    9,944
    Thank you! Now that I know, that is tomorrow's project. I am pooped for today because I really did a lot. I will tell you how it works out, for sure!

    Ha! My first foray into the world of PHP. Who knows? Maybe, I will like it!
    Comments are opinion unless otherwise noted. Remember, pillage first. Then burn. Half of all people in the world have IQs under 100. You best learn to trust ol' SSanf!

  9. #9
    general fuq mrbshouse's Avatar
    Join Date
    January 18th, 2005
    Location
    Argieville
    Posts
    1,381
    You might even look into if you can set up a quick wiki, it sounds like your trying to work a project on multiple fronts and wiki's were kinda designed to do that I think ;-)

    If you have fantastico, it should be up and running in just a few clicks, then you'll need to do some slight mods

  10. #10
    Newbie TheHoff's Avatar
    Join Date
    March 5th, 2006
    Posts
    260
    Shoot me a PM if you get stuck on it; good luck.

  11. #11
    Super Sh!t Stirrer SSanf's Avatar
    Join Date
    January 18th, 2005
    Posts
    9,944
    Thank you. I am still checking stuff out.

    I thought I needed CSS as well because I thought it worked like some kind of SSI for PHP. But, it doesn't.

    Dang! I am in whole new territory trying to use this php stuff. I will lose the includes which require .shtml extentions.

    Well, one step at a time, I guess.

    You know, I may just BE PMing you.

    Thanks for the offer!
    Comments are opinion unless otherwise noted. Remember, pillage first. Then burn. Half of all people in the world have IQs under 100. You best learn to trust ol' SSanf!

  12. #12
    Animal Lover
    Join Date
    January 18th, 2005
    Location
    oz
    Posts
    1,210
    You can call a php script using SSIs. I do this with files that have html and shtml extensions.

    Let's say you've named the file that Hoff's created script.php then to call it ie to plonk it in a .shtml file - decide where you want the script displayed then put this

    <!--#include virtual="/script.php" -->

    Works for my sites.

    Oscar
    My DataFeed Scripts - php datafeed scripts for your site
    Shareasale datafeed scripts - to display Shareasale datafeeds
    Linkshare datafeed scripts - for multiple Linkshare merchants

  13. #13
    Super Sh!t Stirrer SSanf's Avatar
    Join Date
    January 18th, 2005
    Posts
    9,944
    Yowsers!!

    That sounds interesting!!!!
    Comments are opinion unless otherwise noted. Remember, pillage first. Then burn. Half of all people in the world have IQs under 100. You best learn to trust ol' SSanf!

  14. #14
    Super Sh!t Stirrer SSanf's Avatar
    Join Date
    January 18th, 2005
    Posts
    9,944
    Oh my Goddess! It works with FRAMES!!!!

    I don't NEED this area of the site to be SE friendly!

    Sometimes, the answer is so simple. Just go back to the basics.

    I feel so silly. Why do things the easy way when the hard way will do?
    Comments are opinion unless otherwise noted. Remember, pillage first. Then burn. Half of all people in the world have IQs under 100. You best learn to trust ol' SSanf!

  15. #15
    Super Sh!t Stirrer SSanf's Avatar
    Join Date
    January 18th, 2005
    Posts
    9,944
    Now, that I am done feeling like an idiot and laughing at myself, THANK YOU for the help and offers of help.

    You have given me some great new ideas to explore. And, I will.

    NOW< I'M MAD!!

    It works FINE on Firefox, asks for a password and then displays the page but gives a page not found in IE!!!!
    Last edited by SSanf; June 1st, 2006 at 02:20 AM.
    Comments are opinion unless otherwise noted. Remember, pillage first. Then burn. Half of all people in the world have IQs under 100. You best learn to trust ol' SSanf!

  16. #16
    Newbie TheHoff's Avatar
    Join Date
    March 5th, 2006
    Posts
    260
    Code example or link? PM them if you want.

  17. #17
    Super Sh!t Stirrer SSanf's Avatar
    Join Date
    January 18th, 2005
    Posts
    9,944
    I can't right now because company is coming. But, I am going to try one more thing. I am using FP editor and it has changed the code I originally wrote. I will try putting MY code back in and see what happens.

    Then, if that does not work I will for sure cry "Uncle"!
    Comments are opinion unless otherwise noted. Remember, pillage first. Then burn. Half of all people in the world have IQs under 100. You best learn to trust ol' SSanf!

  18. #18
    Newbie TheHoff's Avatar
    Join Date
    March 5th, 2006
    Posts
    260
    http://www.editplus.com

    free to try, easily worth the $30

  19. #19
    Super Sh!t Stirrer SSanf's Avatar
    Join Date
    January 18th, 2005
    Posts
    9,944
    What does this mean? I got it from a tutorial.

    Let us say you want to save precious bandwidth and develop locally. In this case, you will want to install a web server, such as Apache, and of course PHP. You will most likely want to install a database as well, such as MySQL.
    It says something about developing locally. Is this something I need to install on my computer or the host computer or what?
    Comments are opinion unless otherwise noted. Remember, pillage first. Then burn. Half of all people in the world have IQs under 100. You best learn to trust ol' SSanf!

  20. #20
    Newbie TheHoff's Avatar
    Join Date
    March 5th, 2006
    Posts
    260
    The easiest way to get started is with a text editor like notepad / editplus / textpad and an FTP program. Write the scripts, upload to your remote web server, run the script in your browser to test. Eventually you might want to setup a local web server and dev environment on your machine, but you can get by with the editor and FTP for quite a while.

  21. #21
    ABW Ambassador Snib's Avatar
    Join Date
    January 18th, 2005
    Location
    Virginia
    Posts
    5,303
    Quote Originally Posted by SSanf
    What does this mean? I got it from a tutorial.

    It says something about developing locally. Is this something I need to install on my computer or the host computer or what?
    This means you can test your site on your computer before you FTP it over to your web server. I do all of my development this way and it's a *huge* time saver. It's so much better than sending the files over to your server to test them. You can also spend a lot of time completely redoing your site without affecting your traffic on the live server. If you're a Windows user I recommend Apache2 Triad:

    http://sourceforge.net/project/showf...group_id=93507

    It will install Apache, PHP, mySQL and anything else you might need to convert your computer into a test web server. The installation is a breeze and you just put your PHP scripts in the c:\apache2\htdocs folder (I may be wrong on the exact folder name). Once you've done that you can run http://localhost through your web browser and it'll run any PHP code you throw at it.

    Good luck!
    - Scott
    Hatred stirs up strife, But love covers all transgressions.

  22. #22
    Super Sh!t Stirrer SSanf's Avatar
    Join Date
    January 18th, 2005
    Posts
    9,944
    OK, the problem IS my copy of the IE browser! She can see the site just fine on hers and I did solve the problem with an inline frame. While I was waiting for her to get back to me on it, I looked at the PHP stuff.

    Honestly, I see where they are going with some of the code because I did study Fortran way back when Fortran was the computer language. (Yeah, I came across with the covered wagons, too!) I understand if statements and all. I also had a smattering of introductory VB and C++. But, I fail to understand just what it is I am supposed to use php for. What's the end goal? What's the overview.

    Some of it IS confusing if you don't have the basic vocabulary. For instance, you don't know what a compiler is if you have never had, used or even seen a complier. Without knowing that, C++ is just gobbeldy gook.The tutorials I have found assume vocabulary. And, that makes it hard to follow. I know my computer can be a server. I also know the host has a server. They don't make it clear what they mean in much of the tutorials.

    I see a lot of coding language but so what's with that?

    Hello world! (If you know what I mean. Some things never change!)

    Is there such a thing as a php editor?
    Last edited by SSanf; June 4th, 2006 at 07:52 AM.
    Comments are opinion unless otherwise noted. Remember, pillage first. Then burn. Half of all people in the world have IQs under 100. You best learn to trust ol' SSanf!

  23. #23
    Newbie TheHoff's Avatar
    Join Date
    March 5th, 2006
    Posts
    260
    >>Is there such a thing as a php editor?

    There are PHP environments but most everyone just uses a text editor-- www.editplus.com is my choice. All you need is color coding.

    >>I fail to understand just what it is I am supposed to use php for. What's the end goal?

    Any sort of decision making that needs to happen server side. It can be as simple as a guestbook (a form, a form processor, and a way to store the information) or as complicated as a price comparison engine. PHP took over Perl's reign as the choice for server-side languages if that makes it any easier to grasp where it stands.

    Any HTML file can be turned into PHP by simply renaming it with a .php extension. The web server (remote or local) will process it on the fly as PHP. So if you have a normal HTML file and you want to print out the current server time on it, you would leave it as it was except for adding one line

    <?php echo "The current time is " . time(); ?>

    Now what you do beyond that is limitless. This forum itself is written fully in PHP.

  24. #24
    Super Sh!t Stirrer SSanf's Avatar
    Join Date
    January 18th, 2005
    Posts
    9,944
    Thank you! I may look into this more on a non-emergency basis now that the current flap is over.

    You know, over a year ago, I contacted every single institution of higher education or adult continuing education in the area to find a class, teacher or tutor for php. And, I followed every single lead anyone mentioned. There is not even one person that teaches this that I could find. I could hardly even find one person in the field of education that even knew what php is. Apparently, around here, not even one course covers it or even touches on the subject. And, we have a LOT of universities here!
    Comments are opinion unless otherwise noted. Remember, pillage first. Then burn. Half of all people in the world have IQs under 100. You best learn to trust ol' SSanf!

  25. #25
    Newbie TheHoff's Avatar
    Join Date
    March 5th, 2006
    Posts
    260
    I think most people end up learning it online. Google for Kevin Yank's database tutorial to get started; it is a good step by step intro.

  26. Newsletter Signup

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •