Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Directory Listing Script (need help)
Old 01-17-2007, 05:56 AM Directory Listing Script (need help)
Extreme Talker

Posts: 189
Trades: 0
i modified a script to show all the images from a folder but i need to make a set width and other things.

here is my code

PHP Code:
<?

/**
 * Change the path to your folder.
 *
 * This must be the full path from the root of your
 * web space. If you're not sure what it is, ask your host.
 *
 * Name this file index.php and place in the directory.
 */

    // Define the full path to your folder from root
    
$path "/TMO/siggies/";

    
// Open the folder
    
$dir_handle = @opendir($path) or die("Unable to open $path");

    
// Loop through the files
    
while ($file readdir($dir_handle)) {

    if(
$file == "." || $file == ".." || $file == "siggies.php" )

        continue;
        echo 
"<img src=\"siggies/$file\"><br> <br> ";

    }

    
// Close
    
closedir($dir_handle);

?>

and here is the textarea code i want beneath each picture.

Code:
  <textarea name="textarea">&lt;img src=&quot;<!--  same place as where the picture is//-->&quot; &gt; </textarea>
also i need a set width of 350 (all my images widths are 400)
simster is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-17-2007, 08:23 AM Re: Directory Listing Script (need help)
Kirtan's Avatar
Who Am I?

Posts: 376
Name: Venkat Raj
Location: Salem, South India
Trades: 3
I am not sure what you are looking for.. (It seems very easy question, so i think this is not you are llooking for)
PHP Code:
echo "<textarea name=\" textarea \" > <img src=\"siggies/$file\" width=\"350\"></textarea>"
__________________
All the Buddhas of all the ages have been telling you a very simple fact: Be -- don't try to become.

Last edited by Kirtan; 01-17-2007 at 08:24 AM.. Reason: missing quote
Kirtan is offline
Reply With Quote
View Public Profile Visit Kirtan's homepage!
 
Old 01-17-2007, 09:36 PM Re: Directory Listing Script (need help)
Extreme Talker

Posts: 189
Trades: 0
yes it was thank you my script is now this

PHP Code:
<?php

/**
 * Change the path to your folder.
 *
 * This must be the full path from the root of your
 * web space. If you're not sure what it is, ask your host.
 *
 * Name this file index.php and place in the directory.
 */

    // Define the full path to your folder from root
    
$path "/TMO/siggies/";

    
// Open the folder
    
$dir_handle = @opendir($path) or die("Unable to open $path");

    
// Loop through the files
    
while ($file readdir($dir_handle)) {

    if(
$file == "." || $file == ".." || $file == "siggies.php" )

        continue;
        echo 
"<img src=\"siggies/$file\" width=\"300\"><br> <br> ";
        echo 
"<textarea name=\"$file\" > <img src=\"siggies/$file\"></textarea> <br> <br> <br>";  
    }

    
// Close
    
closedir($dir_handle);

?>


how can i make it show 4 a page and then have a next butten that has the next 4 and that one has a previous and next button etc.



basically i want to make it show 4 a page with pagination
simster is offline
Reply With Quote
View Public Profile
 
Old 01-18-2007, 11:32 PM Re: Directory Listing Script (need help)
Extreme Talker

Posts: 189
Trades: 0
any one
simster is offline
Reply With Quote
View Public Profile
 
Old 01-21-2007, 12:31 AM Re: Directory Listing Script (need help)
Extreme Talker

Posts: 189
Trades: 0
any body
simster is offline
Reply With Quote
View Public Profile
 
Old 01-21-2007, 02:12 AM Re: Directory Listing Script (need help)
Kirtan's Avatar
Who Am I?

Posts: 376
Name: Venkat Raj
Location: Salem, South India
Trades: 3
use global variable to count no of images displayed. use $_SERVER['php-self'] in previous and next busttons. read 4 images (already displayed + or - 4, using while loop) and display it.
__________________
All the Buddhas of all the ages have been telling you a very simple fact: Be -- don't try to become.
Kirtan is offline
Reply With Quote
View Public Profile Visit Kirtan's homepage!
 
Old 01-21-2007, 02:36 AM Re: Directory Listing Script (need help)
Extreme Talker

Posts: 189
Trades: 0
how???

can you post me a link to a tutorial of something
simster is offline
Reply With Quote
View Public Profile
 
Old 01-21-2007, 06:58 PM Re: Directory Listing Script (need help)
Extreme Talker

Posts: 189
Trades: 0
can someone post me a link to a tutorial or give me the code
simster is offline
Reply With Quote
View Public Profile
 
Old 01-21-2007, 10:15 PM Re: Directory Listing Script (need help)
Ultra Talker

Posts: 256
Location: Auckland, New Zealand
Trades: 0
This will be similar to what you require:

http://www.webmaster-talk.com/php-fo...tml#post274485

However I wrote it for Praveen at the time, so it's basically setup how Praveen wanted it. If you're comfortable with PHP you should have no problems adapting this, if you're not.

Then just outline your requirements and I can rewrite the script to suit you, give me time though, I'm quite busy.

Cheers,

MC
__________________
#------------------------------signature---------------------------------------------------------------------------------#
Quote:
I am well recognised for what I don't do than what I do. Chores are just one of those things.
mastercomputers is offline
Reply With Quote
View Public Profile Visit mastercomputers's homepage!
 
Old 01-22-2007, 12:33 AM Re: Directory Listing Script (need help)
Extreme Talker

Posts: 189
Trades: 0
it doesnt work its saying it couldnt open the directory


basically all i want it to do is show do its while loop 4 times and have a next button and when you press it shows the last 4 (i have 8 images in there) with a previous button.


but i will try to edit it so it will work i will post here saying if it works of dosent.

Last edited by simster; 01-22-2007 at 05:06 AM..
simster is offline
Reply With Quote
View Public Profile
 
Old 01-29-2007, 03:47 AM Re: Directory Listing Script (need help)
Extreme Talker

Posts: 189
Trades: 0
i cant make it work



bump
simster is offline
Reply With Quote
View Public Profile
 
Old 01-29-2007, 04:36 AM Re: Directory Listing Script (need help)
Novice Talker

Posts: 8
Name: Matt
Trades: 0
Code:
<?php

/**
 * Change the path to your folder.
 *
 * This must be the full path from the root of your
 * web space. If you're not sure what it is, ask your host.
 *
 * Name this file index.php and place in the directory.
 */

    // Define the full path to your folder from root
    $path = "/TMO/siggies/";

    // Open the folder
    $dir_handle = @opendir($path) or die("Unable to open $path");

    $num=0;
    $page=$_GET['p'];
    if ($page=="") {$page=1;}
    $num=$page*4;
    $num2=$num-4;
    $num3=$num+1;
    $prev=$page-1;
    $next=$page+1;
    $i=1;

    // Loop through the files
    while ($file = readdir($dir_handle)) {if ($i>$num2&&$i<$num3) {

    if($file == "." || $file == ".." || $file == "siggies.php" )

        continue;
        echo "<img src=\"siggies/$file\" width=\"300\"><br> <br> ";
        echo "<textarea name=\"$file\" > <img src=\"siggies/$file\"></textarea> <br> <br> <br>";} $i++;  
    } echo "<br /><br /><a href=\"?p=".$prev."\">Previous</a> <a href=\"?p=".$next."\">Next</a>";

    // Close
    closedir($dir_handle);

?>
Devourer09 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Directory Listing Script (need help)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.44088 seconds with 12 queries