beginner question

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
eddie21leeds
Forum Newbie
Posts: 1
Joined: Tue Nov 25, 2008 3:23 pm

beginner question

Post by eddie21leeds »

hi to all from sunny leeds! my name is eddie and ive been getting in to php for a few months now... im a web designer and so far i've learned to use includes and scripted a form to mail script as well as messing about with a few framework tutorials. what i want to know is: what is the next logical step from here from a web designers point of view? - what do i learn next? are there any other tricks such as includes and the mail function that will be of use to me in the future? thanks for reading. eddie.
robincanaday
Forum Newbie
Posts: 14
Joined: Thu Nov 20, 2008 12:25 am
Location: Portland Oregon USA

Re: beginner question

Post by robincanaday »

As a fellow newbie, I recommend these books:

PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide
PHP 5 Advanced: Visual QuickPro Guide

Or anything else by Larry Ullman. He has a great support forum for his books, a better place to ask newbie questions than here.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: beginner question

Post by califdon »

Welcome to the forum, Eddie (also robincanady). Wow, that's opening up a huge subject. PHP is such a general purpose language that you can do almost anything that's logical at the server end. Forms and databases come to mind. Then things like guest books, user registration, customizable pages (dependent on being a registered user, or on your geographic location, as derived from the IP address), and so much more.

The two online treasure troves are:
http://php.net/ and
http://w3schools.com/
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: beginner question

Post by alex.barylski »

are there any other tricks such as includes and the mail function that will be of use to me in the future? thanks for reading. eddie.
Tricks? Millions...whether they are useful to anyone other than you is the more important question...

Don't write code only you will understand...even if you are the only one who will *ever* work on it...the logic is simple...if someone finds it difficult to comprehend your code...chances are so will you when you leave something and come back to in 6 months time.

Learn as many best practices as you can...confirm them for your self...unfortunately this takes years of experience as you cannot possibly make many mistakes in a single day...

Time and experience is the only trick I know of thats truly undisputable...everything else is subjective but I won't start that debate again. :P

Here are some cool "tricks":

1. Instead of using

Code: Select all

if($a == $b){
  echo 'Me';
}
else{
  echo 'You';
}
While this is typically prefered construct when writing code...when writing templates with tons of HTML it sometimes helps to use the ternary operator and do the same thing in one line of code:

Code: Select all

echo ($a == $b ? 'Me' : 'You');
2. Alternate row colors using a simple binary trick as opposed to manually testing for odd or even row numbers

Code: Select all

$bgcolor = ($count & 1 ? '#FFEEFF' : '#EEFFEE');
3. Use PHP alternative syntax when writing code in your templates...I hate seeingstandard syntax in anything but pure PHP class files, modules, etc

4. Don't use double quoted strings unless you actually have a need for it...

5. Validate everything, use proper escaping routines, filter any non-essentials charactcers and lastly use htmlentities() when echo'ing to your templates to avoid embarising XSS exploits.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: beginner question

Post by onion2k »

eddie21leeds wrote:hi to all from sunny leeds!
I was in Leeds the other day, drinking at The Swan. It wasn't sunny though.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: beginner question

Post by califdon »

onion2k wrote:
eddie21leeds wrote:hi to all from sunny leeds!
I was in Leeds the other day, drinking at The Swan. It wasn't sunny though.
It never is, inside a pub, now is it? :wink:
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: beginner question

Post by onion2k »

califdon wrote:
onion2k wrote:
eddie21leeds wrote:hi to all from sunny leeds!
I was in Leeds the other day, drinking at The Swan. It wasn't sunny though.
It never is, inside a pub, now is it? :wink:
We were sitting outside. HA! HAAAAA! I WIN!!

:drunk:
Post Reply