| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Member Join Date: Sep 2004
Posts: 170
![]() | PHP Help First of all I'm new to php and I need some text to be centered using php code. How do I go aobut doing that? Thanx in advance.
__________________ One Thing I [I as in you] Have Learned | Share one of your life lessons. Experiencing College | A walk through of my first college experience. |
| |
| | #2 (permalink) |
| New Member Join Date: May 2007
Posts: 13
![]() | Welcome to PHP ![]() You wouldn't center text in PHP, it would still be done in HTML, just being sent to the browser using the php print() construct: PHP Code: |
| |
| | #3 (permalink) |
| NamePros Regular Join Date: Jul 2005 Location: Tucson, AZ
Posts: 689
![]() | Don't count on using style attributes inside div tags; not all platforms support this (think IE on pocket PC for one). It won't validate as anything but html 4.01 transitional or lower, but you can use this: PHP Code: |
| |
| | #4 (permalink) | ||||
| Senior Member Join Date: Aug 2005 Location: Uk, South Yorkshire
Posts: 1,225
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() PHP Code:
__________________ Cueburst - Support System - FAQ Knowledge Base, Tickets and more. | ||||
| |
| | #5 (permalink) | ||||
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Try it and see the following is perfectly valid php:- PHP Code: | ||||
| |
| | #6 (permalink) |
| NamePros Regular Join Date: May 2004 Location: NYC
Posts: 236
![]() ![]() ![]() | I'll do ya one better If all you're doing is printing something out and you're using short tags (as you are above), you can also dispense with print/echo and just use the '=' character:PHP Code: |
| |
| | #7 (permalink) |
| Buy my domains. Join Date: Feb 2006
Posts: 2,796
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Or you could just use: PHP Code: |
| |
| | #11 (permalink) | ||||
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
And you are correct extra processing time will be taken up if you have non php in php tags as it will go through the php engine for no reason. ????: NamePros.com http://www.namepros.com/showthread.php?t=325332 Regarding the ; it is not necessary in the above example as the ?> comes directly after the command (I double checked and it worked 100%). However of course best practice always dictates the use of it. | ||||
| |