Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Coding Academy

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Magazine and coverdiscs
View previous topic :: View next topic  
Author Message
freelinuxusa



Joined: Thu Aug 26, 2010 8:35 pm
Posts: 1

PostPosted: Thu Aug 26, 2010 8:47 pm    Post subject: Coding Academy Reply with quote

I recently purchased LXF135, which contained a booklet called Paul Hudson's PHP Coding Academy. The booklet provided installation instructions, which I found confusing and therefore, I am asking for help.
I would like to get familiar with coding and want to complete the things mentioned in the booklet. However it mentions loading php5-mysql, Apache using "Mark for instillation", which seems straight forward. However, it later mentions installing php5.cll and php5.gd manually. Aren't they part of php5? How do you load them manually?

Respectfully,
Vincent
Back to top
View user's profile Send private message
EvilD@ve



Joined: Tue Oct 05, 2010 11:39 pm
Posts: 2
Location: Rockford IL USA

PostPosted: Wed Oct 06, 2010 1:03 am    Post subject: Reply with quote

I also have LXF 135 with Paul Hudson's PHP Coding Academy booklet, and the part your having trouble with just means to enter "php5.cli" and "php5.gd" into the search box the way you did with "php5-mysql" , and "Apache"

My problem with Paul's PHP Coding Academy is on page 22 when I entered in the code for the loop to list all the dir and the subdir I recieved a syntac error on line 7. Now you'd think I typed something in incorrectly, but after several failed attempts to find my typo I shut the computer off for the night and went to bed when I got up the next day to try again I loaded the program and ran it again it ran with no error messages but didn't create any output either. So after messing with that for awhile with no success, I went to the next step in the booklet and successfully created the output file but it to was empty.

Can we say HUH?????

Now we all know I've type something in wrong but for the life of me, I can't find it. So I'm using copy and paste to put my code in here if you see my misstake I'd really be grateful.

Code:
<?php

function subdir_scan($dir){
   $files=scandir($dir);
   foreach($files as $file){
      if($file == ".") continue;
      if($file == "..") continue;
         
      print "$dir/$file\n";

      if(is_dir("$dir/$file")){
         subdir_scan("$dir/$file");
      }
   }
}

?>



I'll check back if anyone wishes to exchange idea's

Note: Edited by ollie to put "code" tags around the PHP snippet.
Back to top
View user's profile Send private message
bobthebob1234
LXF regular


Joined: Thu Jan 03, 2008 9:38 pm
Posts: 1369
Location: A hole in a field

PostPosted: Wed Oct 06, 2010 8:44 am    Post subject: Reply with quote

you've made a function that (to me) looks ok, however you don't run /call that function. So you've told it how to subdir_scan, but you never ask it to subdir_scan!
_________________
For certain you have to be lost to find the places that can't be found. Elseways, everyone would know where it was
Back to top
View user's profile Send private message
Ram
LXF regular


Joined: Thu Apr 07, 2005 10:44 pm
Posts: 1672
Location: Guisborough

PostPosted: Thu Oct 07, 2010 11:52 pm    Post subject: Reply with quote

Page 23

"Once we've defined our own custom function, we can use it like any other PHP function. So, put this at the bottom of project1.php:"

subdir_scan(".");

Code:
<?php

function subdir_scan($dir){
   $files=scandir($dir);
   foreach($files as $file){
      if($file == ".") continue;
      if($file == "..") continue;
         
      print "$dir/$file\n";

      if(is_dir("$dir/$file")){
         subdir_scan("$dir/$file");
      }
   }
}

subdir_scan(".");

?>

_________________

lubuntu LXDE 13.10 running on AMD Phenom II*4; ASUS Crosshair III Formula MB; 4 GB Ram.....
Back to top
View user's profile Send private message MSN Messenger
bobthebob1234
LXF regular


Joined: Thu Jan 03, 2008 9:38 pm
Posts: 1369
Location: A hole in a field

PostPosted: Fri Oct 08, 2010 12:30 pm    Post subject: Reply with quote

so I was right. Yay.
_________________
For certain you have to be lost to find the places that can't be found. Elseways, everyone would know where it was
Back to top
View user's profile Send private message
EvilD@ve



Joined: Tue Oct 05, 2010 11:39 pm
Posts: 2
Location: Rockford IL USA

PostPosted: Mon Oct 11, 2010 2:45 am    Post subject: Reply with quote

I just want to thank everyone for their response I missed that part in the book when I went back and read it again I notice my mistake thanks to everyone pointing it out.
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Magazine and coverdiscs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast