Sten
Mar 25 2008, 12:46 AM
As some of you may know, I'm not exactly the worlds greates at PHP, infact I don't know much at all. I mainly like to design websites (the graphical side of it), not code any scripts. I only know x/html and css. So... I've decided to take a go at learning PHP, because as you also might know, I love Joomla and I want to start making components and that for it, I have the basic idea of how it all works, but I've only ever made templates for it before. I have this book here, I borrowed off a friend about a year ago and I'm not sure if he hinted I can just have it or what, lol. Today I've learned how to pass values from forms or something like that, $user = $_POST['name']; something like that, am I right? I also know basics like variables and ifs, elseifs and else and that (oh and echo/print) but I can't do anything advanced. I don't have trouble understanding it, I just have trouble remembering it and know where to shove things and how to shove things in somewhere. So basically, what do you think is the best way to learn PHP? I'm finding the book good but as I said above, I need to get it into my head. I've been trying like writing it straight out of the book, then re-writing it changing bits and then re-writing it again with the book closed, it seems to work if I do it about 5 times, but I was told it's not a good way, so what else should I try? So how should I go about learning it and how long should it take to be able to get started on making Joomla components? I want to make a forms component where people just select what type of field they want, and add the properties and that since I've never actually seen one like that. I also want to make a comments component.
Reply
Umar Shah
Mar 25 2008, 09:01 PM
all you need to know in php can be found on the site: php.net you just need to have an idea of what you want to do and the term to find the appropriate function.
Reply
sparkx
Mar 26 2008, 02:29 PM
Well I have recently made a site (and de-bugging it now) that sounds similar to Joomla. Basically it allows users to make very advanced dynamic websites without knowing any PHP and just HTML, however I don't know if this is a site for you, because it is aimed towards programmers that don't want/need to learn PHP and just want to get lots of stuff done at once easily. Anyway after my "project" I found that I was able to program PHP very well. Maybe you should think about a project or projects to do on your own. In my opinion it is way harder to work of someone else’s code (Joomla est.) while you are learning to program then it is to make your own. After that you should know PHP well. By now you are probably thinking something like "well I want it to be part of Joomla" or "how will making my own project(s) help?" Well first of once you know PHP you can do work on Joomla. Making your own project makes your learn a lot faster then trying to copy someone else’s things 5 times, because you need to actually think about it rather then keep focused on copying it down. I would suggest that you learn the basics from a book/website (as in basics I mean individual strings not all at once because you will get confused with all that stuff that doesn't apply to you). Here is an example:<br> CODE //My example book code <?php $var=$_GET['var']; if(is_numeric($var)){//Number if($var==1){//Check Value echo('var is 1!'); }else{//If value is not 1 echo('var is not 1! It is: '.$var); } }else{//Value is not a number at all. echo('var is not a number!'); } ?> This may be what you copy down but how much of it do you learn? You just learn to copy that’s all. The best way to learn would be to break down the code on your own for example if you want to learn how to echo a var simple type: CODE <?php $var=$_GET['var']; echo('var is not 1! It is: '.$var); ?> Now mess around with it a bit and you soon find that you can add .' That was the variable' just before the ); and your script will echo the last part also. You may also notice you can type {$var} rather then '.$var.' This is a basic example but do you get what I am saying? From this you are not just copying stuff down you are actually learning PHP. For a big list of function visit php.net Once you master a few function simply tie them together and see how they. Keep at it and you will be programming in PHP in no time. Good luck  and hope this helps, Sparkx
Reply
Mr. Matt
Mar 26 2008, 05:25 PM
I think the best way to learn anything is exactly the way you're doing it: hands-on. Most of us who shun the whole go-to-college wave for technical education find the same knowledge accessible on the Internet. You will seldom retain everything you've read regardless of how many times through you read a book. A better approach to this would be to take anywhere from half of a chapter (if you must use a book) to a full chapter in your PHP learning material. Don't study and don't read it. Type out the code yourself in the code listings (don't copy/paste). Use common sense to understand why what you're typing must be done in the outlined structure. By the time you get it loaded onto a PHP supported server and view it in your web browser, you will have understood what you're typing did, why it did and things you can do to modify your results and tailor it to your specific needs. These findings are the endless paragraph explanations you'll only read about but never find out for yourself if all you do is read the book. Bottom line being, you'll learn more by applying a little about PHP than reading a lot about PHP. There's an unlimited number of tutorials for any programming language, trade or profession if you just keep an eye out. For beginners, I would highly recommend W3Schools (PHP): http://www.w3schools.com/php/default.aspAlso, a few other tips to keep the overall learning process easy! Use plenty of whitespace. This will help you to logically understand your own PHP code. I personally wouldn't write code so close together when the amount of whitespace being used between assignments, etc won't affect what you're trying to write. For example, a rewrite of sparkx's code would be: <?php // Get the contents of var query string (http://domain.com/filename.php?var=CONTENTS) $var = $_GET['var'];
// Is it numeric? if(is_numeric($var)) {
// Does it have a value of 1? if($var == 1){ echo('var is 1!'); } else { echo('var is not 1! It is: ' . $var); } } else { echo('var is not a number!'); } ?>You will be doing yourself a favor in the interim by generously spacing out your code and documenting them. Also, find yourself a good text editor that supports syntax highlighting for PHP code. My favorite to use on Windows platforms is Notepad++ which is an Open Source Software (OSS) you can download by searching with Google or Sourceforge.net. Here's another example for accepting and printing form input: <?php
// // Check if form has been submitted //
if(isset($_POST)) {
// // Collect data from POST variables // $get_fname = $_POST['first_name']; $get_lname = $_POST['last_name']; $get_bio = $_POST['biography']; // // Print a summary of posted data // print " <h1>Summary</h1> <p> First Name: {$get_fname}<br /> Last Name: {$get_lname}<br /> Biography:<br /> {$get_bio} </p> "; } ?> <!-- The action specified in this form element uses $_SERVER['PHP_SELF']. This is the equivalent as the filename of this script. --> <form action="<?php print $_SERVER['PHP_SELF']; ?>" method="post"> <p> First Name:<br /> <input type="text" name="first_name" /> </p>
<p> First Name:<br /> <input type="text" name="first_name" /> </p>
<p> Biography:<br /> <textarea cols="75" rows="7" name="biography" /> </p>
<p><input type="submit" value="Submit" /></p> </form>This PHP script is fairly easy to understand if you use some common sense when reading PHP functions. How do we find if the $_POST variable (or any of its variables) are set? Let's ask the same question using PHP. // Is the $_POST variable set? isset($_POST);If it is, then let's do something! if(isset($_POST)) { // Code to be executed if the $_POST variable is set }Also, keep in mind that while using any conditional statements, loops or functions that require the use of brackets, try to indent them on the level they're used to make it easier for you to read and go back to troubleshoot if you should run into problems. // // Conditional statements indented on a single level //
if($condition) { // Execute these statements }
// // Conditional statements indented on multiple level //
if($condition) { // Execute these statements if($condition) { // Execute these statements if($condition) { // Execute these statements } } if($condition) { // Execute these statements if($condition) { // Execute these statements } } if($condition) { // Execute these statements if($condition) { // Execute these statements } } }Let me know if that helps any!
Reply
Miles
Mar 26 2008, 06:35 PM
The best and easiest route to learning a language I have found, computer or vocal lanugage, is to just look over it a lot. Do tutorials. Do them a few times and look at your coding a lot. Eventually it'll stick in your head. By the way, http://www.w3schools.com/php/default.asp (w3schools) is a good site for tutorials, as well as tizag. Both I used when learning PHP.
Reply
Similar Topics
Keywords : learning, php
- Good Book For Learning Xhtml & Css
(2)
Learning C++
(1) CODE // Program to check whether the given string is palindrome or not using library functions
#include<iostream.h> #include<string.h> int main() { char
str[80],temp[80]; cout<<"Enter string to check \n";
cin>>str; strcpy(temp,str); strrev(temp);
if(strcmp(str,temp)==0) cout<<"\n Given string is
palindrome"; else cout<<"\n Given string is not
palindrome"; ....
Learning Php/sql Basics
Want to learn CSS, PHP and create a website (17) Hello, I've been wanting to learn to create websites for a long time. I'm not sure how hard
it will be and how long it will take to learn enough to make my own database-driven website. I
studied SQL, basic programming, worked with databases and am familiar with HTML tags, but this all
was for work, university and I never paid a lot of attention to details. In the past few days I read
beginner's tutorials on PHP/SQL, CSS and even HTML. Now I want to create a simple database with
some tables to practice with PHP scripts for a website, write and read database i....
Learning To Use The Pen Tool In Photoshop
(0) The Pen Tool is a great utility that everyone who wants to use Photoshop well should know about. In
this tutorial I will cover a few things: 1. Basics 2. Things to Remember About the Pen Tool 3.
Cutting Out an Object (1) Basics: Ok, so some people can use it, and others can't, but
nevertheless it is a very useful tool that I find myself using every time I use Photoshop. It makes
very nice curves and is much more flexible and useful than any of the marquee tools. To begin,
select the pen tool from the bottom left of the third section of the left toolbar. Nex....
How To Learn A Programming Language
overview of the best way to go about learning a programming language. (0) How to Learn a Programming Language 1. Choose a programming language. Pythonand Turtle
Graphics are good starter languages. they are very straightforward and easy to learn. Also, there is
a module called Pygame available that makes handling windows a breeze. Another programming language
for a beginner to try is Kids Programming Language, or KPL's new version, called Phrogram.
Don't be put off by KPL's name! Once you learn the basic concepts of programming, you
can then take those ideas into any programming language you choose. Be aware however....
I Think A Good Programming Learning Steps Would Be...
(5) Firstly PHP, secondly C, thirdly assembly. PHP has a lot of features in a close relationship with C
and assembly will give you more of machine-level understanding required for programming. PHP fits
more of network related job handling, C is good for general programming regardless the architectures
while assembly gives almost close - and almost as it is - to architecture specific job when the
speed is in demand. PHP will give the ease to the learner to get familiar with C and as well as
other languages with C and C will give more understanding of the computer machine r....
Just Learning Perl
(6) Okay so I've decided to learn PERL. As I am VERY burned out on PHP after making an online
hacking game in it and working on it for a month after release. Now that its almost done other than
maintenance. I'm VERY good at php now. However I tried to do C and quickly thew my hands up
(maybe too quickly). So I decided to learn PERL just to learn it. I'm curious, what are some
practical uses for PERL (online. but more importantly offline/background/not used by public), does
perl use the same if, else, while and the like as PHP? Thanks....
Learning Php
(7) I have decided to start learning php as I think it is essential if you want to make a good site. I
have a book which is good for starters but it doesnt have much advanced stuff. Would anyone happen
to know a good site I can learn from? While im on the topic, i cant get PHP to install on apache. So
i still cant use php on my computer anyway :l....
Best Way Of Learning A Scripting Language?
(6) I was going to wonder what is the best way to learn a scripting language. I mean there are tons of
different ways including buying Books on internet of that langauge. You can also take tech
classes,or even internet classes, or best way to just learn by yourlself? Ive been messing alot
lately with Macromedia MX director. Ive been learning its scripting language called Lingo, but ive
just been learning from messing with source codes and server scripts. Is the best way trial and
error and repeat?....
Best Places To Start Learning PHP
(7) best places to start learning PHP,good resources http://www.php.net/ http://www.sitepoint.com/
http://hotwired.lycos.com/webmonkey/ http://www.devshed.com/ ....
Learning Java
(0) Thisi is a good place to learn java for beginner Here is one. http://java.sun.com/docs/ From the
official site /biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif' /> The
Java API here : http://www.ii.uam.es/~poo/java_doc/docs/api/index.html (it my university's
webpage for Java Documentation). It contains all methods and objects predefined in Java. But before
that, it could be useful for you to know some basic conceps of the Object Oriented Programming
style, and what is it useful for. Javascript and Java aren't the same thing....
Where To Start Learning Programming
Please advise me on which language to (16) I am a beginer to programming i wish to know from which language should i start programming C, C++
Is there any problem if i jump directly to vb or like please respond where can i find good beginer
tutorials Thank you....
Two Serious Learning Tools
landmarkcases.org and gallica.bnf.fr (5) I don't expect the Net to replace libraries as a tool for serious learners in my lifetime, but
occasionally one can find some serious learning tools on it. Here are two of my candidates:
http://gallica.bnf.fr/ Interesting editions of the complete texts of classics of French literature
(in French), for download, with background articles. They use an interesting technology to create
the PDFs on the fly. Unfortunately, these are image-based PDFs, which can be inconvenient.
http://www.landmarkcases.org/ Discussions of important cases which came before the Unit....
How Can I Start Learning Linux
(12) can someone give some tutor or website to me??? and i want to know what i need to learn first and
which version is easiler to learn.......
Having Little Time For Learning
Visual Basic? C/C++? Java? (3) Hello all. I'm a 15 year old sophomore in an international school located in a Southeast Asian
country called Thailand. The technology is very limited here and almost all pieces of equipment is
imported. However, it's difficult to find programmers or computer experts who can help you for
free. There are several popular computer / development centers where they teach you for a fee. And
with this poor country's economy affecting the population, which is divided into rich and poor,
with no in-between, it's difficult to find a good amount of money. Thus, I h....
Linux User Needs Help Learning Freebsd
(7) Recently, i decided that FreeBSD was somthing i wasnted to be able to say i could use, and afdmin
comfortably. I was reading several comparasons between GNU/Linux (what i currently use) and
f'BSD. Apart from the differences in the Licences, and they way they were developed, and of
cource the history, they were very very similar. Ive used and become comfortable with several Linux
distro's inclusing Linux From Scratch, Slackware, Gentoo Mandrake, Fedora/Redhat, and maybe a
few others, LOL. After becomming comfortable with linux, i started university, where i use....
Languages Worth Learning
What languages should I learn? (21) Hello all. Right now I'm a Computer Science major in college. After I graduate (hopefully in
three years) I'm wanting to get a job programming. At the moment I'm not too picky about
the type of job, as long as it involves programming. So what I'm wanting to know is what
languages would be worth learning while I'm in college. There are a lot of languages out there,
and I'm not sure which ones are extensively used. I'm wondering what languages any
programmers out there use at your job or have heard of people using. I want to be sure to ha....
Huge Problem>> Learning Flash
(3) Flash does not deserve to get the negative vibe that it has been getting. ie flash sucks. I have
done a movie in my mind now if I can just get these programs to behave. My main problem is I am
useing way to many programs and my brain is going to explode. I know you should learn one and learn
it well but my problem is liking different ones for different things. I have noticed that people
like Corel draw and I have never used it. Problem is with graphics that all the programs work
differently. PSP 8 is my fav but I have an old program that I like much better for cropping e....
Learning Programming: Which Language To Start
which language to start on (11) Okay i have a basic knoledge of programming and am starting to learn it in more detail, my only
problem is i dont know which language would be best to start on a book i brought suggested starting
on Visual Basic, some old posts tha came up on searches said QBasic and a friend who does program
says i should start on C or Pascal wha do you all think i should start on?....
Microsoft Learning
(1) Visit Microsoft Learning and Microsoft Skill Assessment to test ur skills. I scored 22/30 in
the first Win XP test and 25/30 in the second. U can also use this thread to post your scores.
Once again wrong forum. Kindly be a little extra careful next time as to where your posts are
heading for. The forum descriptions are always there to help you figure it out. ....
Some Of My 3D Models
im still learning.. (25) sorry if this is the wrong forum,its 3d but not animation. forum description was a little confusing.
well, ive been trying to model for a long time, but just a couple weeks ago i really got into
learning to model in 3ds max, and its just suddenly started to click. this is a brick of C4, im
redoing the wires. the only primitive i used was the chamfered box ( the tan one) everything was
extruded from the original primitive. this next one is a concept shuriken (throwing star). i
started with just a tube, then extruded and tapered the first spike, then used symmetry an....
Learning Css
(8) Is there a good site that teaches how to use CSS? I would really like to master it.....
Learning How To Network?
(5) Hey guys, I really have no idea about networking. Can someone please give a quick intro or maybe a
link to some tutorial that could get me started. I really wanna learn how to network computers. I
also need it for my studies. Thanks in advanced guys and Merry Christmas to you all /smile.gif'
border='0' style='vertical-align:middle' alt='smile.gif' /> ....
Learning Php
(7) Okay, I was goin to start learning php...hopefully this free service will support php so I can test
my code and such b/c I have it on my pc to test...but it seems to have problems running. Maybe I
didn't enable some of the right things. Seems a bity hard to setup if you don't know what
you're doing. Anyways I was wondering if they're any certain things that can improve my php
skills. I'm familiar with setup of the language b/c I am very familiar with c++ syntax. So the
syntax isn't a problem. The variables are a little different...dynamic or....
Learning MySQL
(9) Hello I want to learn about MySql Database. Do any one know about free rescorces for learning it.
Also a tutor for DreamWeaver MX I will be very thanful. Sohail Ahmed sohail4@msn.com....
Learning PHP
(18) I'm interested in learning PHP, but I fear that I would have no time to learn the language and
master it. How long would it take to develop good competence in PHP? I think I'm going to learn
using technical books.....
Looking for learning, php
|
|
Searching Video's for learning, php
|
advertisement
|
|