| | |||||
| ||||||||
| Webmaster Tutorials Instructional webmaster-related how-to's and tutorials. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: Jun 2004 Location: Iowa City
Posts: 703
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | PHP Beginners Guide PHP is a server side language, and its not like javascript which is a client side language. Section I - Using PHP You can run PHP in basically 4 differen't ways. <% // Code in here %> <script language="php"> // Code in here </script> <? // Code in here ?> <?php // Code in here ?> I prefer the last method "<?php". You also may see "<?" be called shorttags. Section II - Comments There are bascically two ways that I do comments within the PHP code, they are: ????: NamePros.com http://www.namepros.com/webmaster-tutorials/38763-php-beginners-guide.html <?php // This is a comment ?> <?php /* Comment Line 1 Comment Line 2 */ ?> As you probably can tell, the /* */ combo provides a multi line commenting system, while // privides a single line comment. Section III - Display HTML There are two very common ways to display text/html onto the webpage, print and echo. I prefer echo over print. Example Usage: print "<b>This is my bold text</b>"; echo "<b>This is my bold text</b>"; You might notice the ; symbol after those lines, its required after every line that you process data. Section IV - Variables Heres an example of giving a variable a value: $name = "Jon"; And using what you learned earier try making it say on the screen: Your name is Jon To display variables in echo's or print's do this: echo "Your name is $name"; or echo "Your name is " . $name; Thanks for reading and I hope it helps. Please remember that this is only a Beginning Guide to some simple features of PHP. Stay tuned in the future for Tutorial #2 that will have how to do some more features.
Last edited by nick; 07-14-2004 at 04:00 PM.
|
| |
| | #2 (permalink) |
| Sheriff Of Nothing Join Date: Apr 2004 Location: Florida
Posts: 220
![]() | Quick to the point, nice job.
__________________ Lowter.com - Webmaster eZine and Community Interactive eZine, Articles, Blogs, and More Norics.com | Cascading Design | Blue Programming |
| |
| | #4 (permalink) | ||||
| NamePros Member Join Date: Dec 2003
Posts: 171
![]() |
????: NamePros.com http://www.namepros.com/showthread.php?t=38763 echo "Your name is ".$name; echo "Your name is ",$name; If you must I suggest the comma as it's marginaly faster than the period. But echo "Your name is $name"; works fastest. Thought this would be good to add. | ||||
| |
| | #5 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,074
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | just a quick note regarding the following style tags <% // Code in here %> <script language="php"> // Code in here </script> these may not necessarily as they have to be enabled first however <?php ?> should always work.
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |