473,396 Members | 1,935 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

When Can PHP be mixed inline w/ HTML?

I have looked for a definitive answer for this and have not found one.
"sometimes, when it works" is not getting very far in designing a
solution. Maybe the question should be "WHERE can PHP be mixed inline in
the file?"

for example, a file called xxx.html, marked
DocType -//W3C//DTD HTML 4.01 Transitional//EN

the server can execute PHP, I am using PHP v.4.4.0

thanks
Jan 23 '06 #1
9 1430
*** one man army escribió/wrote (Mon, 23 Jan 2006 18:48:45 GMT):
I have looked for a definitive answer for this and have not found one.
"sometimes, when it works" is not getting very far in designing a
solution. Maybe the question should be "WHERE can PHP be mixed inline in
the file?"

for example, a file called xxx.html, marked
DocType -//W3C//DTD HTML 4.01 Transitional//EN


Anywhere.

Of course, you need that the resulting parsed file makes sense, unlike
(e.g.):

<html<? echo 'Hello, world!'?>>

--
-+ Álvaro G. Vicario - Burgos, Spain
++ http://bits.demogracia.com es mi sitio para programadores web
+- http://www.demogracia.com es mi web de humor libre de cloro
--
Jan 23 '06 #2
one man army wrote:
I have looked for a definitive answer for this and have not found one.
"sometimes, when it works" is not getting very far in designing a
solution. Maybe the question should be "WHERE can PHP be mixed inline in
the file?"

for example, a file called xxx.html, marked
DocType -//W3C//DTD HTML 4.01 Transitional//EN

the server can execute PHP, I am using PHP v.4.4.0

thanks


Basically it can be mixed anyplace in the file.

You just need to set your Apache configuration to process the pages
through the PHP parser.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jan 23 '06 #3
one man army wrote:
I have looked for a definitive answer for this and have not found one.
"sometimes, when it works" is not getting very far in designing a
solution. Maybe the question should be "WHERE can PHP be mixed inline in
the file?"

for example, a file called xxx.html, marked
DocType -//W3C//DTD HTML 4.01 Transitional//EN

the server can execute PHP, I am using PHP v.4.4.0

thanks


<p>this is an <?php= $level ?> example</p>
Jan 23 '06 #4

ming wrote:

<p>this is an <?php= $level ?> example</p>


Your file needs to have the file extension of ".php" if it is
".anythingelse" it won't work.

Ken

Jan 23 '06 #5
NC
one man army wrote:

I have looked for a definitive answer for this and have not found one.
The answer is very simple: when PHP code and HTML are out into a file
with *.php extension.
for example, a file called xxx.html, marked
DocType -//W3C//DTD HTML 4.01 Transitional//EN


Normally, HTTP servers are configured not to treat *.html files as
those that contain no executable code. So if you put PHP code into an
*.html file, it will not be executed.

Cheers,
NC

Jan 23 '06 #6
NC
one man army wrote:

I have looked for a definitive answer for this and have not found one.
The answer is very simple: when PHP code and HTML are put into a file
with *.php extension.
for example, a file called xxx.html, marked
DocType -//W3C//DTD HTML 4.01 Transitional//EN


Normally, HTTP servers are configured not to treat *.html files as
those that contain no executable code. So if you put PHP code into an
*.html file, it will not be executed.

Cheers,
NC

Jan 23 '06 #7
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ken Robinson wrote:
Your file needs to have the file extension of ".php" if it is
".anythingelse" it won't work.


Wrong. You can configure your web server software to
process .php, .html, .shtml, .whatever files through the PHP engine.

(However, this is obviously not the default, and newbies should name their
files with the .php extension in order to avoid confusions)

- --
- ----------------------------------
Iván Sánchez Ortega -i-punto-sanchez--arroba-mirame-punto-net

Un ordenador no es un televisor ni un microondas, es una herramienta
compleja.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFD1Uqw3jcQ2mg3Pc8RAqnJAJ9Fd950zGlmn7BjKHD4q9 BFlu3O8gCeNkaM
YAcAv9alMVwVPwd7aHCHcSM=
=UN+I
-----END PGP SIGNATURE-----
Jan 23 '06 #8
LJB
The reply below is not entirely correct. Files with the .html extension
(or any other extension for that matter) can contain PHP code if they
are called as an <em>include</em> file.

NC wrote:
one man army wrote:
I have looked for a definitive answer for this and have not found one.

The answer is very simple: when PHP code and HTML are out into a file
with *.php extension.

for example, a file called xxx.html, marked
DocType -//W3C//DTD HTML 4.01 Transitional//EN

Normally, HTTP servers are configured not to treat *.html files as
those that contain no executable code. So if you put PHP code into an
*.html file, it will not be executed.

Cheers,
NC

Jan 24 '06 #9
ming wrote:
<p>this is an <?php= $level ?> example</p>


The <?= ?> syntax doesn't work for <?php ?>.

Jan 24 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

34
by: Niels Berkers | last post by:
Hi, i'd like to host my web pages using multiparts to reduce the number of hits on the server. i know this isn't a real PHP subject, but i'll try it anyway. i've been searching the web for...
2
by: Paul A. Hoadley | last post by:
Hello, I am trying to convert a RELAX NG schema to DTD using Trang. I am currently trying to add some inline elements to the schema, such as <emph> for marking emphasised text. Here is an...
2
by: Matt | last post by:
I posted a question before regarding the offset positions when I used CSS. Some people suggested I should use percentage instead of pixels? I tried many different ways, but the position still...
46
by: James Harris | last post by:
Before I embark on a new long-term project I'd appreciate your advice on how to split up long names. I would like to keep the standards for command names the same as that for variable names....
2
by: Steve McLellan | last post by:
Hi, We've found some pretty serious performance hits that we didn't expect in a mixed mode C++ application. The number crunching bits of our algorithms are compiled with #pragma unmanaged. They...
5
by: comp.lang.php | last post by:
// NEW 11/27/2006: FINALLY, IF YOU ADDED OR DELETED OR DID ANY KIND OF FORM ACTION SUCCESSFULLY, DON'T RE-DISPLAY THE NEW EXPENSE ITEMS VIA $_POST if ($_POST && (!is_array($leaseObj->errorArray)...
17
by: mansb2002 | last post by:
Hi, We recently moved our webserver from Win2K to Win2003. The application works fine. Only problem is that when user views a report as a PDF, IE does not show it. The following code is used to...
9
by: GloStix | last post by:
Okay, when I click the link it dissapears and makes a white space underneath it but the space is clickable. so when you click the space, the link actually works Used Firefox 3.0 RC2 for this. OS X...
0
by: mk189 | last post by:
Hi, I am trying to create XML schema of custom markup language, enriched by XHTML. In simplified version, the XML documet could look like that: <a:alarm-manual xmlns:a="alarm-manual"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.