| View previous topic :: View next topic |
| Author |
Message |
freelinuxusa
Joined: Thu Aug 26, 2010 8:35 pm Posts: 1
|
Posted: Thu Aug 26, 2010 8:47 pm Post subject: Coding Academy |
|
|
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 |
|
 |
EvilD@ve
Joined: Tue Oct 05, 2010 11:39 pm Posts: 2 Location: Rockford IL USA
|
Posted: Wed Oct 06, 2010 1:03 am Post subject: |
|
|
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 |
|
 |
bobthebob1234 LXF regular

Joined: Thu Jan 03, 2008 9:38 pm Posts: 1360 Location: A hole in a field
|
Posted: Wed Oct 06, 2010 8:44 am Post subject: |
|
|
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 |
|
 |
Ram LXF regular

Joined: Thu Apr 07, 2005 10:44 pm Posts: 1569 Location: Guisborough
|
Posted: Thu Oct 07, 2010 11:52 pm Post subject: |
|
|
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(".");
?> |
_________________
Ubuntu LXDE 12.04 running on AMD Phenom II*4; ASUS Crosshair III Formula MB; 4 GB Ram.....
|
|
| Back to top |
|
 |
bobthebob1234 LXF regular

Joined: Thu Jan 03, 2008 9:38 pm Posts: 1360 Location: A hole in a field
|
Posted: Fri Oct 08, 2010 12:30 pm Post subject: |
|
|
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 |
|
 |
EvilD@ve
Joined: Tue Oct 05, 2010 11:39 pm Posts: 2 Location: Rockford IL USA
|
Posted: Mon Oct 11, 2010 2:45 am Post subject: |
|
|
| 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 previous topic :: View next topic |
|