PHP what can it do? Where can i learn?

Hi I am new to php and see it is essential if I want to take web development to the next stage.

I have used Wordpress and general HTML/CSS to generate websites in the past. I notice that all wordpress themes are generated using PHP.

Where is the best place to learn PHP, essentially how to design Wordpress themes using PHP?

Thanks in advance

I don’t work for SitePoint but I’d happily endorse their books. Buy a book from them. Better than anything “for Dummies”. There’s also the PHP manual. You can also expect web searches to return many good results on almost any PHP-related topic. The search term “tutorial” is probably particularly useful to you.

Thanks for the advice, have seen their books but never seen reviews.

Just ordered Jump Start PHP as it looks exactly what I’m looking for

Thanks

Another good place to start (Learnable – owned by Sitepoint)

Then of course, if you are interested in a few articles to read

I’ll put my two cents in… :slight_smile:

It really depends what you want to do and what is your current level.

Do you have any other experience with programming? Do you know about basic programming stuff such as loops, variables, etc.?

Second, what do you know about web development and databases? Could you make a form in plain PHP (without WordPress) that saves a text entered by a user into the database?

Some other questions:

How to design Wordpress themes using PHP

What do you mean by “design”? Do you want to start from 0 or an existing PSD? Or maybe you’ll already have all the HTML/CSS somewhere?

I don’t have any experience with programming, I have looked at the code to generate wordpress themes such as the twenty twelve/thriteen/fourteen ones and can understand the basic lines of code. But this has made we want to learn PHP so I can create my own wordpress themes.

Thus far I have only created websites using HTML and CSS, but then moved onto wordpress themes and tinkering with the CSS myself.

Second, what do you know about web development and databases? Could you make a form in plain PHP (without WordPress) that saves a text entered by a user into the database?

I couldn’t do this at this stage as I have never used PHP. I have just purchased the “Jump Start PHP” book from sitepoint http://www.sitepoint.com/store/jump-start-php/ I see this as a good place to start?

Some other questions:

What do you mean by “design”? Do you want to start from 0 or an existing PSD? Or maybe you’ll already have all the HTML/CSS somewhere?

Sorry this is me being a newbie to web design. I meant create, not design. Ultimately I want to be building my own wordpress themes using php, html and css. Am I right in saying learning php will help me achieve this or are there many other factors?

@cpradio Thanks for the links I have found some useful stuff on there

This is where those articles I linked you to (or rather the search results) will greatly help you. Narrow them down to Wordpress Theme topics and you’ll pick up a lot in a short time.

This is a good book to start learning PHP. It won’t necessarily help you in your endeavor with Wordpress Themes though. You’ll at least start to understand the syntax, the functions, and figure out what it is doing, but Wordpress has its own template system that has books related to it on its own.

The book (if you have the means to get it) Build your own Wicked Wordpress Themes may be something you’ll want to invest in. I’ve skimmed it a bit to make sure it is still relevant and it seems to be (although it was written in 2010, so some things may have changed). The book states it was intended for the following audience.

Who Should Read This Book

This book is aimed at front-end web designers looking to branch out from building static sites or simple PHP-based projects into the world of WordPress theme development.

You should already have at least intermediate knowledge of HTML and CSS, as those technologies are as important to WordPress themes as they are to static websites. We’ll also assume that you know a little bit of PHP; while there’s no requirement for you to be a programming whiz, you should at least understand concepts such as if statements, loops, functions and variables, and the way PHP generates HTML for output. While you can certainly customize a theme without using any PHP, the more advanced features shown in the second half of the book require some familiarity with these basics.

PHP will definitely help when you need to do advanced tasks in your theme, so learning the basics will ultimately help you build better themes, of which the book you already bought will be of great value.

Funnily enough I had a look at that “Wicked Wordpress” book whilst perusing through the links and thought this would be quite useful. My logical plan is to get through the jump start PHP book, then when I have an understanding of PHP I am going to delve into the wordpress book.

I bought this book last year http://www.bookdepository.co.uk/book/9781449319267?redirected=true&viewCountry=UK&selectCurrency=GBP&gclid=CKmLxPfy_bwCFYQfwwodgm4AEg

But i have found it very hard to follow, I feel that the sitepoint book will be a bit more up to date and easier to follow, well fingers crossed anyway!

Ah yes. That is because there is too much grouped together. JavaScript and CSS should not be part of any PHP/MySQL book. It is an entirely separate entity and should be treated as such. When you combine two separate entities together, you quickly get a very complicated/hard to follow book. I’ve bought similar books way back when and learned my lesson the hard way too. :slight_smile: Now-a-days, I go to a local library (or book store) and see if they have the book I’m interested in and I read a chapter or two there before buying it.

They each had their own respective chapters, but it was just very hard to follow and nothing like I have come across in web design in the last 18 months. I feel PHP is the next logical step in the learning process.

I’m sure to research a book before I buy it now, or ask on a forum like here as people on here have done it before

Again, my 2 cents :stuck_out_tongue:

Lets say that building a PHP app is like building a house. WordPress would be an almost complete 3 bedroom house model, already done for you. It just needs the paint and you have a house where you can live in.

Now, if you paint that 3 bedroom house 100 times, you’ll be an expert at painting this kind of house model. It won’t help you much into building a houses. And painting other model of houses would be a different task.

You could also decide that you want to add a room and a bathroom to your “house model”. Do that 100 times, and you’re an expert at customizing this kind of “house model” to add a room and a bathroom. If it’s want you want to do, that’s fine.

But, it won’t make you an expert at building houses. And you won’t really know how that “house model” is built from the ground up. Sure, you could learn how some parts are made, but knowing everything about an already constructed house is kinda difficult. And what if the “some parts” you learn about are not done well anyway? What will happen when you’ll try to build your own house from the ground up?

Then, if you want to build a gym and just know how to customize that kind of “house model”, well… It’ll be possible to customize it to a gym, but probably inefficient. It would be like building a boat out of a truck.

Also, if you want to learn how to better customize your house, you should learn how to build a house from the ground up. The foundation frist. Then the wall, etc. Then, if you go back to your “house model”, you’ll know what’s good and what’s wrong with it. You’ll also know when you should use it and when you shouldn’t (like if you want to make a gym).

If we go back to WordPress:
Adding themes to WordPress can be a viable hobby and even a business, but it won’t make you a PHP programmer.

And just “coding” with WordPress will give you the view on how WordPress is done, but it’s not a “normal” web application, it’s a blogging platform. It’s good at making blogs, not other kind of web apps. You can make other kind of web apps, but it wasn’t built for that in the first place. Yea, WordPress have a lot of plugins and you can even make a membership site out of it, but it’ll be like building a boat out of a car. You’ll either get a really ugly boat, or it’ll take a lot of time to turn that car into a boat. It would be more efficient to start from scratch. (Don’t get me wrong, WordPress is a really nice prodduct)

If you want to build other kind of PHP applications, you need to start at the beginning:

  • Learn general programming concepts (you can try codeacademy for example)
  • Learn the HTTP protocol (seems complicated but it’s not, shouldn’t take you more than 2 hours for the first read) : http://www.jmarshall.com/easy/http/
  • Learn the basics of website development (HTML, CSS and a little bit of JavaScript). You already know HTML and CSS, that’s good. Just try some JavaScript, it’s crucial that you understand what you can do with JavaScript and Ajax VS what you can do on the server-side with PHP. It’ll help you with WP theme development too.
  • Then, go with PHP (a beginner book)
  • Try to build 2-3 really small apps… like a contact form, something that writes stuff into a file, etc.
  • Then, you can try some PHP frameworks like Laravel, CodeIgniter, etc.
  • Then you can go with mySQL, a noSQL database, etc.

That’s the path I would recommend if you want to make advanced and efficient web applications or become really, really good with WordPress development (not just themes but plugins also).

@xMog Thanks very much for that analogy, it’s really helped me understand how each area of PHP and Wordpress fit into the creation or edition of wordpress themes.

I will follow those steps you have suggested there, are there any particular areas you would suggest to focus on in “code academy”? I will crack on with these, then I can move onto the beginners PHP book I have ordered.

I have a vague understanding of what Javascript can offer, in terms of slide shows, animation of web pages etc. Is there anywhere you would suggest the best place to learn this would be. As I have done a few youtube tutorials in the past, but they have jumped from one subject to the next…allowing me to become easily confused!

Thanks for your help on this, it has given me a great insight into PHP

@ontargett : I’m really glad it helped you!

For code academy, you could start with JavaScript, for example. The goal here is to understand the basics of programming. Variables, loops, control structures, etc.
An even better tip would be to search “programming basics” on Google and read what you find interesting.

When you’ll know the basics, you’ll probably understand a little bit more what you already did when you customized WP themes.

If you already understand how JS works and what it can offer, you don’t need to go into the details right now. One thing you should understand well is the concept of server side VS client side. And also what Ajax (which is made with JavaScript) can offer to a web page.

Also, be careful when you start developing with PHP. Every beginners do that and that’s normal, but being aware of it is a good thing. So, you’ll learn about basic programming and PHP. Then you’ll use your knowledge to create php pages that blends code with HTML all over the place. And you’ll probably also write difficult to maintain code. That’s just normal for beginners. But, when you feel like it, look on Google (or ask questions here) about how you can make your PHP code more maintainable, if there are security problems with your code, how you can improve your code, etc.

Would the code be difficult to maintain as it is mixed in with HTML?

Well, there will always be a minimum of a mix between HTML and PHP somewhere, except if you use a “template engine” (like Smarty).
But you should keep it to a minimum. The more split up your HTML is in your PHP code, the more it’ll be difficult to maintain.

For example, if one page is made up from 21 PHP files that all outputs HTML to this page, it’s kinda hard to find where a specific part of HTML comes from.

Compare that with a code like:

<html>
  <head>
    <title><?= $this->title; ?><title/>
  </head>
  <body>
    <div id='left'><? $this->leftMenu->render(); ?></div>
    <div id='center'><? $this->centerContent->render(); ?></div>
  </body>
</html>

Which is: Easy to read. All your HTML is at the same place. Your PHP code that displays this HTML will be clean (no HTML mixed in).

I took the example from this page: http://stackoverflow.com/questions/62617/whats-the-best-way-to-separate-php-code-and-html

But if you’re working with WordPress, well, you’re stuck on how WordPress works, but there are ways to minimize the mixup between PHP and HTML.