|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Php code in html
is it possible? i know next to nothing about php, i only started dabbling with web publishing three weeks ago.
i read somewhere about something called a cPanel having to do with this. :confused: thanks alot! |
|
#2
|
||||
|
||||
|
It was mentioned in this thread as being possible via an htaccess edit.
http://forums.seochat.com/google-optimization-7/html-to-php-67018.html I have not tried it yet though. It causes the server to parse every HTML page for PHP which is a performance hit.
__________________
BidRank Automated Pay-Per-Click Bid Management Software for Yahoo! SM (Overture), Google, MIVA and other PPC search engines. |
|
#3
|
||||
|
||||
|
I use an htaccess line (rather like an ssi directive) which allows me to parse my html pages with php...
addtype application/x-httpd-php .html It works a treat for me (running on apache/unix)
__________________
ClickyB "The quality of the visitor is more important than the volume".. Egol 22nd Feb 2008
New to SEO / SeoChat? Start : HereForum Rules & Posting Guidelines Canonicalisation Solutions |
|
#4
|
|||
|
|||
|
Quote:
|
|
#5
|
|||
|
|||
|
Quote:
This happens because straight HTML pages are just retrived from the server and sent out, no messing around and no extra processing. PHP pages are retrived, sent to the PHP parser, sent back and then sent out. When you set all HTML pages to be served as PHP , then they will all be sent to the PHP aprser and will all take extra time to serve. Having said that, PHP is still a pretty darned fast way of getting dynamic content up on the web, so any speed issues with pages that don't have complicated code or processes on them won't be noticed by most users because it's more likely that their internet connection will be slower then the rate that the server is pushing out the pages anyway. Any performance hits will come if you start getting a whole lot of hits and your server can't cope with the traffic. This is always possible, but on a decent web server, it'll take a lot of visitors for this to happen. |
|
#6
|
||||
|
||||
|
Conversely, you can parse html in a .php page with no problems at all. If you only have a single php-based page, why not just leave it with the natural extension?
|
|
#7
|
||||
|
||||
|
I have included php in an html page - it is working great and accomplishing exactly what I want. How do I acheive W3C markup validation when a page is running 2 codes?
www.navycs.com |
|
#8
|
||||
|
||||
|
Quote:
I assume this is the result of parsing although it could just be the "types of function" I'm using the php for! You might want to check the S/C of your page once it's online, I suspect it's the same! If somebody knows what the hell I'm talking about, I'd be interested if you would explain why! ![]() |
|
#9
|
||||
|
||||
|
I'll take a stab at it
Quote:
If I understand you correctly you are developing a file that contains a combination of traditional html markup with some php included as well and you are wondering how to validate the code vs. W3C standards. What you want to do is validate the output code. The easiest way to do this is to view the source of your webpage. PHP is processed server side and only the processed output is delivered to a browser. In this case some html combined with more html generated by your PHP scripts. When you view the source you will only see the html output. Once you are viewing the source you can copy and paste the markup into your choice of W3C validation tools. Here is the official one: http://validator.w3.org/ Viola! Now you can see how your webpage validates vs. W3C standards. You can also use tools that will retrieve your webpage and validate it as well. I hope I answered the same question you asked. I'm not sure that I did. --- BTW - I highly recommend Zend Studio for a PHP IDE. If you are concerned with clean output code it is really the best. It allows you to preview your output code as you are developing (which is awesome!). http://www.zend.com/products/zend_studio It's only worth the price if you are planning on spending some time in the PHP trenches, but if you are check it out. It also runs great on Linux if you that's your OS of choice. |
|
#10
|
|||
|
|||
|
Quote:
Depends, so long you use your php page as php and leave your html as html, the performance issue is present but very minor. You can alternatively use html in your php, the more commonly accepted method. |
|
#11
|
||||
|
||||
|
When PHP runs as an Apache module (the norm on Linux web servers) and not in CGI mode, the performance hit is negligible in most cases. You'd really need to be pushing the limits before it became a real issue.
On a properly configured server, the PHP code never leaves the server. All that is output is HTML and that is all the W3C validator sees. PHP writes the HTML dynamically then sends it off, end users including W3C never see anything but HTML. |
![]() |
| Viewing: SEO Chat Forums > Other > HTML Coding > Php code in html |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|