I want to learn enough php to:

- theme drupal beyond just style.css
- repair small bugs in unmaintained, downloaded modules
- write very simple, basic drupal modules from scratch
- understand the main security holes in php and prevent them in any script I write

I have no experience whatsoever in any programming or scripting - I don't know anything at all.
Nor do I know anything about SQL, beyond setting up a database in cpanel.

My question is, how many hours should I set aside to attain the above level of skill? Just a very rough ballpark.

If I spent an hour a week dedicated PHP study from online tutorials or a book, and a handful of hours a week experimenting and learning drupal, could I do it within two years (that would be about 100 dedicated php hours plus 400-600 hours experimenting with drupal and building test sites)? I'm not a total dunce, but I don't think I've got very much flare for it either (otherwise I think I would have picked up something by now).

Thanks.

Comments

styro’s picture

You'll pick stuff up piece by piece, and you'll be able to do some things easily with a few of those pieces, while other things will require more pieces. It will be an upward curve where you'll be able to do something simple early on and more complex things later. Things you learn will make things you kinda half learned earlier on make more sense later - it's an iterative process.

Programming skill and confidence is just something that gradually grows rather than passing a threshold. There is no set path or rate anyone learns either. Some people might struggle in one area, while others struggle elsewhere or not at all. If you get stuck on something, put it aside for a while and learn something else instead as lots of things build on other knowledge.

In terms of Drupal PHP stuff, you can get quite a long way (especially if you just stick to theming) with just:

* Understanding what a variable is, and what the different types of variables are (eg strings, booleans, integers etc)
* Basic PHP syntax - ie where to put your dollar signs, braces, parentheses and semicolons etc
* Expressions - eg how checking if something is equal/not equal/less than/greater than something else results in a true/false value (a boolean).
* Decisions based on the result of an expression (ie if - then - else blocks)
* Arrays (used a lot in Drupal) - eg what they are, how to create them, how to pull values out of them. What array keys are, and what an associative array is.
* Looping - eg over all the values in an array.
* Functions - what they do, how to call them, how to create them etc

That's a basic list of vanilla PHP stuff, and most of it should be able to be picked up within a few hours if you find good tutorials or books. It is also important to try out writing your own code rather than just reading about it.

After that, you'll need to learn some Drupal specific stuff. This would probably take a bit longer depending on how much you already know. eg:

* How the Drupal theme layer works at a basic level
* The naming conventions Drupal uses for theme functions and template hints etc
* How to look for stuff on http://api.drupal.org and what the docs actually mean.
* Then just slowly getting more and more familiar with the functionality included in the Drupal API.

The key to learning how to program for a complete newbie is to realise that computers are extremely stupid things and will only do exactly what you tell them to - no more, no less. You can't assume it 'knows' something unless you've explicitly told it so.

Another important aspect is looking at snippets of code and trying to work out what they do and how they work.

Good luck - you'll find a whole new world of Drupal understanding and possibilities open up to you with even just some simple PHP knowledge.

--
Anton

dvessel’s picture

Listen to this man. This is how I learned. When I started with Drupal, I had no prior knowledge of programing whatsoever. It has been about 2 years now, and I didn't get serious about the back end until about 6 months in.

It's something you gotta love to do. I've always been frustrated that I couldn't solve my theming problems but knowing a decent amount of PHP now opened doors for me. This freed me and allowed me to explore and programming challenges are quite fun IMO.

Everyone's learning style is different so you have to know where you need to be to hit your stride. For me, it was just having the great examples in core. api.drupal.org in tandem with php.net has taught me a great deal. But understand the basics as styro listed and keep building on top of that.

joon park
www.dvessel.com

Nick Lewis’s picture

It took me a week of study to begin understanding control structures and variables in php. It took me about a month to understand functions. It took me a year to understand how functions should work together. It took me 4 years to be able to translate ideas into code without having to lookup function references at php.net.

Now, I'm working on translating my ideas into code that is coherent...

Its a long journey. However, I'd say that 400-600 hours well spent should get you a lot farther than you may think. There's no hard and fast formula, though.

--
"I'm not concerned about all hell breaking loose, but that a PART of hell will break loose... it'll be much harder to detect." - George Carlin
--
Personal: http://www.nicklewis.org
Work: http://www.onnetworks.com

--
"I'm not concerned about all hell breaking loose, but that a PART of hell will break loose... it'll be much harder to detect." - George Carlin
--
Personal: http://www.nicklewis.org
Work: http://www.zivtech.com

mm167’s picture

2 years later ......

when u learn php(5), people will be using php(7) ...;-(

styro’s picture

Things don't move that quickly.

PHP 4 has been out for over 8 years. PHP 5 has been out for 4 years, and still hasn't fully taken over from PHP 4. Who knows when PHP 6 will be released.

--
Anton

auctionteamster’s picture

As an novice programmer who himself only took limited programming in college years ago -- I will say that although the Drupal learning curve may be high -- it is worth it. Drupal has done all the heavy lifting -- you dont have to be an expert in php or the other languages available for use with Drupal to have a functioning viable Web site. Although the more knowledge you gain the more of course you can do.

I recommend you build a site for yourself first -- here are some sources that I have found helpful.

There are plenty of sources for you to call on (depending in what direction you want to go with your Web site) -- books, seminars, pod cast, etc. -- The key is finding out which ones are best for you -- as far as books -- something that should be in any programmers reach i recommend for learning drupal the following:

http://search.barnesandnoble.com/booksearch/results.asp?WRD=Pro+Drupal+D...

http://www.packtpub.com/drupal-6-create-powerful-websites/book

http://www.packtpub.com/drupal-6-themes/book

http://www.packtpub.com/drupal-6-module-development/book

http://www.packtpub.com/search

Pact Publishing has some excellent books on various aspects of Drupal

Also you should stay abreast of the drupal site for recommended books and seminars.

I also find the folks over at lullobot helpful -- they have great podcast -- you should join their mailing list. You can find them on the web at: http://www.lullabot.com/podcast

Also sometimes overlooked source is your local networks -- meetup is a great source -- just search for various programming groups -- you can find them on the web and join for free at: http://www.meetup.com/

That should be enough to get you started -- main thing is -- dont give up -- and also finally -- use this forum -- and after your up to speed -- contribute. God's speed to you.

davidlark’s picture

They've shown a commitment to getting it right in V5, continuing to add features in minor versions. New programming paradigms will trigger V6.

On other topics:
The fact that there are many frequent posters who aren't real programmers negates the argument that you have to be a geek to do Drupal.
Surely the 24 hours & 21 days books aren't total BS. To do things elegantly might take a lifetime, just like it helps for a winemaker to grow up in a winemaking family, but the original idea of PHP is that you do things as you need to, however you know how to.
Baby steps.

gforce301’s picture

If you have little to no programming experience I would buy a good book. There are more than a few php books out there. The main thing about a good programming book is it will not only help you learn the language but it will also introduce you to the concepts of program and algorithm design, good coding practices and provide a lot of sample programs and codes snipets.

-Anti-’s picture

Thanks for the comprehensive range of answers, advice and links.
This has given me a rough idea of what to time scale to expect.

Cheers.

kippert’s picture

Any kind of programming shouldnt be rushed, you should just take your time in my opinion and settle in slowly. The way that i learnt was by setting projects. I started at school with a simple website, this developed html and css,
and then i started on a variety of rebuilds of that website, changing the design playing around, and meeting php for the first time.
Then I developed a website for my folks to document there wildlife pictures on using mysql and php, each project was a huge stepping stone for me, there were many mini projects besides, however they have fallen to the way side when i realised there was a much better way of doing it (and then just not returning to them to finish them) My current project is making my website completely object orientated and having html embeded in php as opposed to the other way round.
some books that i found incredibly useful for this include
http://www.amazon.co.uk/Build-Database-Driven-Website-Using/dp/097524021...

http://www.amazon.co.uk/PHP-MySQL-Teach-Yourself-McGraw-Hill/dp/00714615...

Some websites that might be of particular help with general php are
http://www.hudzilla.org/php/
That is a fairly well documented website that i found after i learnt about php but is incredibly useful imho

the books cost money, but that website is free to my current knowledge.

hope this is of some useful help
Kevin

Programming is like writing a symphony.
http://www.kwebd.co.uk/

Paul.CW’s picture

Can Delphi for PHP be used in place of coding in straight PHP, in places where PHP code is necessary in developing Drupal modules, and page layout or style sheet? (I realize "page" may not be a Drupal term)

Is D for PHP useful for stand alone applications running under Drupal?
Basically, how and where would D for PHP intergrate with Drupal, if at all.

I'm in the same spot as Anti, wanting to learn Drupal, PHP and what else is necessary.
If I'm going to learn to program in PHP I thought that D for PHP would make it easier.
Would D for PHP be useful at all?

Thanks,
Paul.cw

styro’s picture

after a quick look at what Delphi for PHP actually is - no don't bother. And I'm not sure it will actually work in a Drupal module development environment anyway - it looks a bit like it will use its own libraries to operate on rather than integrate into the Drupal API.

I also find tools like that (anything that promises drag and drop programming) get in the way of actually understanding whats happening.

I'd recommend a coders text editor like Komodo Edit instead - it is cross platform, free, and can do PHP syntax highlighting and syntax checking etc. But you are still writing the code yourself and it doesn't get in the way. PHP files are just text, you can edit them anywhere and on anything.

Although it seems daunting and scary at first, PHP isn't a hard language to learn, and I reckon you are better off actually learning the language itself rather than relying on expensive complex tools.

--
Anton