Thrill Posted December 12, 2010 Posted December 12, 2010 Just doing a very basic PHP tutorial. PHP is a 'scripting' language, that's used on the internet. Our forum is written in PHP which connects to a MySQL backend. PHP allows us to create dynamic websites, rather than your basic HTML webpage. What you'll need: # Webserver of some kind, that has PHP installed. # Notepad/Dreamweaver/'Website Maker' # The ability to follow instructions. Let's get started, first of all open up your piece of software. For me it's Dreamweaver, open up a basic HTML document which looks like this: Our next step is to add the PHP code tags just before the </body> tag. So it would look like this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php ?> </body> </html> As you can see the PHP tags are: [b]<?php ?>[/b] . Now we're going to add a little bit of text, to do this we use the echo function and place that in between our PHP tags. so it would look like this The echo function is used by simply writing this within the PHP tags; echo "https://forums.prodjex.com/ is the best!"; This will look like this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php echo "<b>Geeksoup.net is the best!</b>"; ?> </body> </html> Notice the " and the ;, they are very important. PHP works very well with the basic HTML, so HTML is welcome within the PHP tags. So let's put that to the test. Within your echo line of code, surround your text with the bold html tags, so it would look like this: echo "<b>https://forums.prodjex.com/ is the best!</b>"; That would bold your text, just like it does in HTML. Click <a href="http://www.w3schools.com">here</a> to visit W3 schools, where you can find a list of HTML tags, which will help you customise your writing and layout and other cool things Now we've done a bit of PHP, save the file as Something.php and upload it your webserver. The end result should look like <a href="http://www.geeksoup.net/phpguide.php">this.</a> This is obviously, just a very very basic guide of PHP. You can build websites in PHP, which takes a much more amount of knowledge than adding just a little bit of text. A few tips: # Make sure your webserver supports PHP, if not it won't work. # Make sure to open and close tags correctly, if not it will give out an error when you go to access the page. # Make sure to follow the instructions carefully. # Enjoy! Marc 1 Quote
kreso93 Posted March 19, 2012 Posted March 19, 2012 Wow man, I am surprised that you got no replies. Personally, I am starting to learn PHP cause I need it for web site designing, at this is a great way to start and get a hang of it. Nice work man, keep it up ) Quote
TheMightyEddy Posted March 20, 2012 Posted March 20, 2012 Wow this is actually a very good tutorial to be honest. I've never seen anyone like this before. Though the images does make it up. Good job! Quote
GOKuCommander Posted April 27, 2012 Posted April 27, 2012 Very nice tutorial, very useful. I have been having trouble with PHP but this makes it seem pretty simple. Even to me. Quote
Thomas Posted April 28, 2012 Posted April 28, 2012 Everyone always rights the first page of a tutorial but they never finish it off. It makes me sad Quote
LosAngelesLover Posted April 28, 2012 Posted April 28, 2012 Great read! You definitely know your way around the software! The part about it working with HTML - I actually never know about that before, and its very valuable to the site I'm creating, and this certainly has fixed some things up for the forums section of the site, at the moment I have tons of bugs, but I think you've cleared some of them out! Great read, great tutorial, and keep up the good work! Quote
Administrators Nathan Posted April 28, 2012 Administrators Posted April 28, 2012 Everyone always rights the first page of a tutorial but they never finish it off. It makes me sad What else are you looking to do? I've started to learn PHP and the best way is by trying to fix a problem. Let me know and I may work on it. Quote
Thomas Posted April 28, 2012 Posted April 28, 2012 What else are you looking to do? I've started to learn PHP and the best way is by trying to fix a problem. Let me know and I may work on it. I've been doing small parts every now and again with PHP although normally I don't finish anything. I was more making a statement about Guides. Hardly anyone finishes guides after the start. Quote
DarkGizmo Posted May 14, 2012 Posted May 14, 2012 A great tutorial for PHP Beginners. Thanks for sharing. I'm looking into learning more PHP this summer when I have time. Quote
ljepilo Posted May 15, 2012 Posted May 15, 2012 This is a really nice Guide , I simply adore it.It will be very helpful for me since im a starter in php ! Quote
psufootball Posted May 15, 2012 Posted May 15, 2012 Very nice tutorial, and PHP is towards the top of my "to-learn" list. However, do you really recommend Dreamweaver for basic users like the general audience you'll attract to this thread? Seems almost like showing the fine features of Photoshop to someone who's never used MS Paint before lol, or maybe that's just me. Quote
Thomas Posted May 16, 2012 Posted May 16, 2012 Very nice tutorial, and PHP is towards the top of my "to-learn" list. However, do you really recommend Dreamweaver for basic users like the general audience you'll attract to this thread? Seems almost like showing the fine features of Photoshop to someone who's never used MS Paint before lol, or maybe that's just me. Please have mixed opinions with regards to Notepad/Notepad++ VS Dreamweaver as some people are of the opinion that Dreamweaver is just for designing however I personally use Dreamweaver as it allows me to see the code, work with it and see how it looks like. You really just need to be sure you set up your websites properly. Quote
SwitchCase Posted June 18, 2012 Posted June 18, 2012 Nice guide! Thank you so much for this. This will be handy in the near future. I'm planning to self study PHP few days from now. Quote
JHTech100 Posted June 20, 2012 Posted June 20, 2012 This is a really good start. It shows some syntax and other stuff. Well done! Quote
ridwan sameer Posted June 20, 2012 Posted June 20, 2012 Good stuff mate. IF anyone's looking to further their knowledge.... Their's always "thenewboston" Quote
ALGirl Posted January 12, 2013 Posted January 12, 2013 Everyone should also remember that you get help on syntax if you type http://www.php.net/{command} So, for example, if you know you need to use the PHP date command but can't remember the correct syntax, what it returns, what parameters it takes, etc., then you would type http://www.php.net/date Quote
themdno Posted January 13, 2013 Posted January 13, 2013 Great guide, and thanks for writing it all out for us. One thing that I would like to add, is that it is not always necessary to use the closing php tag, the ?>. It's is not actually required, even though many think that it is. I had always thought, yeah, but it's still good form to include it, but I have heard that there are advantages to not using it, and it can save some headaches later. Quote
Victor Leigh Posted January 13, 2013 Posted January 13, 2013 That's a good tutorial. Now if only we have a section dedicated to tutorials. That would be a useful resource to have on this forum, wouldn't it? How about it, Nathan? DarkGizmo 1 Quote
DarkGizmo Posted January 13, 2013 Posted January 13, 2013 That's a realy good idea Vic. There should be a tutorial section for programming tutorials based on language...it'd be a great resource for people to learn how to program in that respectable language. Think we can get something like this going on here, Nate? Quote
Administrators Nathan Posted January 13, 2013 Administrators Posted January 13, 2013 That's a good tutorial. Now if only we have a section dedicated to tutorials. That would be a useful resource to have on this forum, wouldn't it? How about it, Nathan? Yeah it would if there were more of them out there. Hate to create a new board for it to sit mostly empty. Quote
Thomas Posted January 13, 2013 Posted January 13, 2013 I feel like a Thomas spam attack coming on! Quote
Victor Leigh Posted January 14, 2013 Posted January 14, 2013 (edited) Yeah it would if there were more of them out there. Hate to create a new board for it to sit mostly empty.You can motivate the members to write howto articles by letting them earn DD$ from writing them. How about that? The virtual currency thing is still in the works, right? Or you can do it this way. Don't start the section yet. Tell the members how many DD$ they can earn for each howto article they write. Then let the howto articles be posted in the existing sections. Then when you feel that there are enough howto articles to warrant a separate section, start one. You can even sweeten the deal by offering XXX bonus DD$ if there are XXX number of howto articles posted within XXX days. I think 100 howto articles would be a great target. There are so many members here who are knowledgeable about stuff like that. Provided you give them the right motivation to write howto articles for this forum. Edited January 14, 2013 by Victor Leigh Quote
simplysidy Posted January 14, 2013 Posted January 14, 2013 Please have mixed opinions with regards to Notepad/Notepad++ VS Dreamweaver as some people are of the opinion that Dreamweaver is just for designing however I personally use Dreamweaver as it allows me to see the code, work with it and see how it looks like. You really just need to be sure you set up your websites properly. I would recommend the netbeans for PHP which is completely free, and is much better than the Notepad or even Notepad++. The Dreamweaver is expensive unless of course you are downloading a one month free trial. The Netbeans allows you to write code easily quite same like Dreamweaver. The Notepad++ needs you to download some extra plugins to allow it add better support for PHP. Quote
johnthomas1433 Posted January 15, 2013 Posted January 15, 2013 Rather than installing the PHP yourselves, I suggest you install some IDE like Xampp, or Wamp, and they does make your job easier. Also do not try coding in Dreamweaver, as they shall generate the code most of the times with drag and drop, and that is not good. Better use Notepad++ like the rest of us. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.