PHP help required :(

This is a discussion on "PHP help required :(" within the PHP Forum section. This forum, and the thread "PHP help required :( are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Aug 12th, 2006, 18:58
Reputable Member
Join Date: May 2006
Location: Scotland
Age: 18
Posts: 228
Thanks: 0
Thanked 0 Times in 0 Posts
PHP help required :(

I am looking for some help on msn or a link to a tutorial or pre built script which i could implement. What I am aiming to do is this. On my website
www.webmaster-files.com/index.php I am looking to have a php script so at the bottom right area where the site stats are shown php automatically detects how many of each type of file are shown on the site and displays that number in the table cell. Any help is much appreciated.

Michael Clarke
mikkaclarke@hotmail.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Aug 12th, 2006, 22:09
Junior Member
Join Date: Apr 2006
Location: UK
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP help required :(

Some more information will help to find a solution. Where are the actual pages / files stored that you want to count? Are they in individual directories for categories (photoshop tuts) or subcategories (photoshop custom shapes) or do they have a naming convention that distinguishes between categories with all the pages in one directory, or are they all kept in a database etc.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Aug 12th, 2006, 22:16
Up'n'Coming Member
Join Date: Jun 2006
Location: Rochester, NY
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP help required :(

automatically detecting is hard to do with files, If each file includes a database entry or a form that uploads the file then its easy to do. I added you on msn, and ill be glad to help you.
__________________
www.MonsterCoding.com - Website Programming and Development Services
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Aug 12th, 2006, 22:55
Reputable Member
Join Date: May 2006
Location: Scotland
Age: 18
Posts: 228
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP help required :(

At the moment they are all in thumbnails directory. I am going to use the images rather than actual download file. They are named according to their type eg template1.bmp. patterns1.bmp etc
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Aug 13th, 2006, 09:39
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,186
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
Re: PHP help required :(

This should be easy possible by looping through a directory object to retrieve the file properties of each file.

Not knowing an awful lot of PHP I'll ask that someone else continue with this.
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Aug 13th, 2006, 13:56
Reputable Member
Join Date: May 2006
Location: Scotland
Age: 18
Posts: 228
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP help required :(

I managed to get this following script to work. The only problem is when it is on my index.php it adds on the previous php scripts number. You can see the example on www.webmaster-files.com at the bottom right it is cumulative and adds the previous ones result to its. I am using the script
Code: Select all
<? include("filecount6.php"); ?>
PHP: Select all

<?php  
$directory 
opendir("Thumbnails/photoshop/");  
while(
$item readdir($directory)){  
if((
$item != ".") && ($item != "..")){  
$files[] = $item;  
echo;  
}  

$sizeofarray count($files); 
echo 
$sizeofarray
?>
I have each directory separate and the files within those directories counted. When I go to the filecount.php file the number it displays is correct therefore it must be somethine to do with them all being on the index file after each other. I am new to php so any help is greatly appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Aug 14th, 2006, 03:37
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP help required :(

if you add
unset($files);
before the final
?>
that should do it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Aug 14th, 2006, 09:38
Reputable Member
Join Date: May 2006
Location: Scotland
Age: 18
Posts: 228
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP help required :(

Thankyou that worked perfectly.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
php, help, required

Thread Tools

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkbox Required WebNinja Starting Out 1 Jan 6th, 2008 00:36
JSP help required ScorpionKing Other Programming Languages 2 Aug 27th, 2007 18:29
Help Required Bradz Web Page Design 11 Nov 24th, 2006 20:10
Script Required asa_carter JavaScript Forum 0 Jan 23rd, 2006 14:23
Help required H_Therapist Web Page Design 3 Nov 9th, 2005 00:09


All times are GMT. The time now is 23:25.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42