+ Post New Thread
Results 1 to 11 of 11
Coding Thread, I want to be a programmer in Coding and Web Development; I work with Moodle quite a bit both at work and as a personal interest but Im not a programmer. ...
  1. #1

    Join Date
    Apr 2006
    Location
    UK
    Posts
    939
    Thank Post
    39
    Thanked 70 Times in 54 Posts
    Rep Power
    30

    I want to be a programmer

    I work with Moodle quite a bit both at work and as a personal interest but Im not a programmer.

    What I want to be able to do is build some admin tools to aid the use of Moodle to admins who either can be trusted with direct DB access or dont have the skills to create some decent queries to pull out the relevant details.

    So really Im looking to introduce myslf to PHP programming while hooking into a (mysql) database while specifically looking into Moodle dev.

    Does anyone have any pointers for me, using PHP libraries and existing PHP functions, calling those functions or adapting them, using API's what ever they are?

  2. #2
    mattmoo's Avatar
    Join Date
    Jun 2008
    Location
    Leicester
    Posts
    124
    Thank Post
    5
    Thanked 8 Times in 7 Posts
    Rep Power
    15
    Hey Dan, google is obviosuly your friend here but i would also say grab yourself a good book or two (an ebook would be great, pm me for a good source of information) and just give it a go.
    There is plenty of ebooks focused on moodle development and PHP really isnt a difficult langauge to learn its just getting used to OOP that takes a little getting used to.

    I always use forums / blogs as good sources of information and finding a good PHP forum that has a lot of active members will be a great help

    Matt

  3. #3

    Join Date
    Oct 2008
    Location
    Gosport
    Posts
    64
    Thank Post
    1
    Thanked 18 Times in 13 Posts
    Rep Power
    16
    My advice:

    Have a small and simple task that you need to do and figure out how to do it, then move on to something a bit bigger, etc, etc. Starting off with writing stuff to slot into the Moodle framework might be a bit much for a first jaunt, so just try making a simple page with a form that you can process and pull data from a db with. Nothing fancy, just enough that you can get your feet wet while holding it all in your head.

    PHP: Hypertext Preprocessor is your friend. The documentation and examples there are excellent.

    Hello
    :-Dave

    P.S. I have a couple of files of php that I uses as a simple programming test for applicants to a job assisting my php dev job that I could send over to you if you want. includes basically what I just said there and scope for more if you want to extend it. PM me for more them.
    Last edited by lightinthedark; 26th January 2009 at 10:32 PM.

  4. #4

    dhicks's Avatar
    Join Date
    Aug 2005
    Location
    Knightsbridge
    Posts
    5,772
    Thank Post
    1,308
    Thanked 804 Times in 698 Posts
    Rep Power
    247
    Quote Originally Posted by danIT View Post
    Does anyone have any pointers for me
    Sure - 0x3A28213A, 0x6339392C, 0x7363682E...

    using PHP libraries and existing PHP functions, calling those functions or adapting them, using API's what ever they are?
    Moodle might not be the best place to start, some of the code is pretty hairy. You'll also find that no SQL database access is done directly (or, at least, that's the intention...), there's an abstracted API of some kind (ADOdb, I think, but maybe they had their own bits in there, too). Get a couple of smaller one-page bits written before you go wading into Moodle, just so you get the hang of things.

    --
    David Hicks

  5. #5

    tmcd35's Avatar
    Join Date
    Jul 2005
    Location
    Norfolk
    Posts
    6,069
    Thank Post
    902
    Thanked 1,013 Times in 825 Posts
    Blog Entries
    9
    Rep Power
    350
    Does anyone have any pointers for me
    Quote Originally Posted by dhicks View Post
    Sure - 0x3A28213A, 0x6339392C, 0x7363682E...
    --
    David Hicks
    Have you no shame? You should be shot a dawn for that one!

  6. #6


    Join Date
    Feb 2007
    Location
    Northamptonshire
    Posts
    4,706
    Thank Post
    354
    Thanked 807 Times in 722 Posts
    Rep Power
    348
    [Badly timed humour]
    Doesn't this thread title remind you of "I wanna a hippy and I wanna get stoned now!"
    [/Badly timed humour]

    I love how PHP: Manual Quick Reference works for near on everything.

    I agree entirely with what everyone's said and can fully vouch for the "find a problem, and develop a solution" idea that David suggested as I recently used it to figure out arrays in bash and then perl, and finally php. (Was writing a simple rsync back up script).

    Good luck!

  7. #7

    witch's Avatar
    Join Date
    Nov 2005
    Location
    Dorset
    Posts
    11,521
    Thank Post
    1,532
    Thanked 2,639 Times in 1,827 Posts
    Rep Power
    814

    PHP website

    Tutorial & reference information can be found here

    PHP: Hypertext Preprocessor

    wITch partner

  8. #8

    Join Date
    Dec 2005
    Location
    Midlands
    Posts
    130
    Thank Post
    2
    Thanked 12 Times in 12 Posts
    Rep Power
    21
    [ame=http://www.amazon.co.uk/PHP-MySQL-Development-Developers-Library/dp/0672329166/ref=sr_1_1?ie=UTF8&s=books&qid=1234127453&sr=8-1]PHP and MySQL Web Development (Developer's Library): Luke Welling, Laura Thomson: Amazon.co.uk: Books[/ame]

    this is the updated version of the core text book when i learnt PHP and MYSQL at uni, it was one of the few books at the time that taught OO PHP from the start rather than getting to the last chapter and saying oh by the way you can do it this way as well.

  9. #9
    Friez's Avatar
    Join Date
    Dec 2006
    Posts
    839
    Thank Post
    22
    Thanked 22 Times in 21 Posts
    Rep Power
    24
    My advice:

    Get a nice clean LAMP (Linux, Apache, MySQL, PHP) or WAMP (Guess) setup and start typing:

    index.php
    PHP Code:

    <?php 
    echo "HELLO"
    ?>
    &nbsp;<i>World</i>
    Step one is to learn about breaking in/out of PHP and regular HTML as highlighted above. Then visit PHP: Hypertext Preprocessor and start doing stuff.

    General programming things to learn (before you even touch database stuff) should be as follows:
    • Variables ( Storing data for use later ) and Types ( There IS a difference between an Integer, Float and Strings, but PHP makes it quite transparent.
    • Arrays (Lots of variables stored in 'one variable' as a sort of list)
    • Operators (Bitwise, Logical and Mathematical e.g. comparing variables or adding things)
    • Loops: for, while, foreach
    • Functions ( Segments of code that can be re-called over and over ).


    For what it's worth, I'm SOLID at PHP but I never ever picked up a book on it but you should learn to walk before you can run

    Doing is more important than reading because the MORE you do it, the more you learn, much faster than reading books (php.net is the ultimate reference for the language, better than any book IMO). So sit down and start coding.

    Below is a little tutorial PHP I wrote for a colleague, you can work on that to learn some basic programming stuff if you need direction. It has a few things wrong with it, and has tasks to do. It's worth reading the code over to get a feel for it, it's not too hectic, but does have a few gotchas.

    users.csv
    Code:
    bob,geoff,david,jane,jill,peter,adrian,robert,sarah,brian,lucy
    index.php
    PHP Code:
    <?php

    // TASK! figure out why the PHP program doesnt work!


    function get_file($filename)
    {
        
    // TASK!
        // what if the file didn't exist?
        // could we check if it did first?
        // think about the function at
        // [url]http://us3.php.net/manual/en/function.file-exists.php[/url]
        // if the file doesn't exist, kick up an error message    
        
        
    $filehandle fopen($filename,"r"); // opens the file for reading

        
    $filecontents ""// empty text
        
        // use a while loop to keep grabbing data from the file
        
    while(!feof($filehandle) ) // feof() checks to see if we're at the end of the file, what do you think the ! operator is for?
        
    {
            
    $filecontents .= fgets($filehandle); // gets a line from the file. What do you think .= does in regards to strings?
        
    }    
        
        
    fclose($filehandle); // close the file
        
        
    return $filecontents// return to the calling function the text we have loaded
    }



    function 
    read_csv($filename)
    {
        
    $csvdata get_file($filename); // call the above function to get the CSV data
        
    $data_array split(","$csvdata); // split the data up using , as a delimiter
        
    return $data_array;
    }


    // TASK!! 
    // using temporary variables and loops
    // try sorting the data into alphabetical order
    // try following a bubble sort algorithm to do this
    // [url]http://en.wikipedia.org/wiki/Bubble_sort[/url]
    // below has been started for you
    // try to finish it off
    // this function may help you:
    // [url]http://us3.php.net/manual/en/function.strcmp.php[/url]

    // comment this function describing what each bit does
    // so you understand how the sort works.

    // DO NOT use PHP's in-built sorting functions to do this! 
    // this will teach you the process of structuring data and moving it around.
    function BubbleSort( &$items 
    {
        
    $temp "";
        
    $size count$items );
        for( 
    $i 0$i $size-1$i++ ) 
        {
             for( 
    $j 0$j $size $i$j++ ) 
             {
               
    //   if( ... ) 
               //   {
               //          ...
               //   }
             
    }
        }
    }

    // ADVANCED!!
    // in BubbleSort( &$items )
    // any idea what the & is used for?
    // think about the data, and the fact that we don't
    // return any values in BubbleSort
    // how do you think the memory is being accessed?
    // the following may give you an idea:
    //
    // [url]http://en.wikipedia.org/wiki/Pointer[/url]
    // [url]http://en.wikipedia.org/wiki/Reference_%28C%2B%2B%29[/url]



    ////////////// PROGRAM STARTS HERE!! ///////////////////

    $data read_csv("users.doc"); // get the data from the CSV file

    // count() returns the number of elements in an array
    // any ideas what this loop does?
    for($i=0;$i<count($data);$i++)
    {
        echo 
    $data[$i] . "<br>";        
    }


    // output the sorted data
    echo "<h2>Sorted Data</h2>";

    BubbleSort($data);
    for(
    $i=0;$i<count($data);$i++)
    {
        echo 
    $data[$i] . "<br>";        
    }



    // Super-Advanced!!!
    // implement a quicksort algorithm in order to
    // speed up processing time!
    //
    // what are the up-sides and down-sides of both algorithms?


    ?>
    Let us know how you get on and if you need any tips :P
    Last edited by Friez; 13th February 2009 at 11:09 AM.

  10. #10

    Join Date
    Feb 2008
    Location
    Stevenage, Hertfordshire
    Posts
    111
    Thank Post
    3
    Thanked 8 Times in 5 Posts
    Rep Power
    15
    once again, i plug my good friend(who i don't know, but he sounds like a really nice bloke!)

    PHP Video Tutorials - Like to watch the video instead of reading the book?

    yes, he offers paid videos, but i learnt the majority of my stuff from his free videos(the old ones i prefer over the new!)

    have a look, its free, and if your anything like me, video tutorials are for learning, written tutorials are for CnP'ing hehe.

  11. #11
    Sandman's Avatar
    Join Date
    Apr 2009
    Location
    London,UK/New York,USA
    Posts
    133
    Thank Post
    2
    Thanked 16 Times in 15 Posts
    Rep Power
    14
    I'd recommend learning HTML before moving to PHP.

    My advice is go online and find some tutorials or a good book with tutorials.

    I'm self taught in every language I can write.



SHARE:
+ Post New Thread

Similar Threads

  1. Programmer?
    By crazy in forum Coding
    Replies: 2
    Last Post: 6th March 2008, 08:25 PM
  2. Programmer or Serial Killer?
    By Gatt in forum Jokes/Interweb Things
    Replies: 25
    Last Post: 5th February 2008, 05:14 PM
  3. Does anyone have a Willem Eprom programmer?
    By plexer in forum General Chat
    Replies: 1
    Last Post: 12th October 2007, 09:04 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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