× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Larry:

The example you sent uses echo to output everything. Check out these
options instead:

1) Drop in and out of PHP as required:

<html>
<head><title>My Web Page</title></head>
<body>
<p>The Year is:

<?php
echo Date('Y');
?>

</p>
</body>

This will actually dump the return value of the call to the Date() function
inline into your HTML. In this example, it is a bit of overkill, but for
more complex operations such as database access, file includes, or
calculations this makes sense. You still use echo when you want to output
from within PHP code (and of course white space is ignored), but as you'll
see in the next option even that is routinely unnecessary.


2) Use PHP Expressions to embed data:
<html>
<head><title>My Web Page</title></head>
<body>
<?php
$date = Date('Y');
?>
<p>The Year is: <%= $date %></p>
</body>

This is from memory, and I haven't coded PHP from scratch in a while, but I
think it is correct. Basically, you can embed data fields or even function
calls directly inline.

Both of these approaches make your PHP code a lot more palatable.

HTH,


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.