Joel - are the %< and %> tags part of HTML? I've not seen them before - is
that how you reference a varible defined in PHP when you are outside of the
PHP sections?
, Larry Kleinman
Kleinman Associates, Inc.
212-949-6469
203-255-4100
"Joel Cochran"
<joelcochran@gmai
l.com> To
Sent by: "Web Enabling the AS400 / iSeries"
web400-bounces@mi <web400@xxxxxxxxxxxx>
drange.com cc
Subject
10/02/2007 11:33 Re: [WEB400] PHP
AM
Please respond to
Web Enabling the
AS400 / iSeries
<web400@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,
--
Joel Cochran
http://www.developingfor.net
On 10/2/07, Larry Kleinman <larry@xxxxxxxxxxxxxxxxx> wrote:
Hi - I'm making the switch from Net.Data to PHP and have some really basic
questions. Most important, at least right now:
Net.Data allows ordinary HTML inside of a Net.Data function. For example
%HTML (S1) {
<html>
<head>
</head>
<body>
Some text here
@S1 ( )
Some more text here
</body>
%}
will display "Some text here" then call the function name S1, then display
"Some more text here"
In PHP, it looks like i have to use the Echo funciton whenever I want to
do
straight HTML
<?php
Function input ( ) {
echo "
some text here
";
S1 ( )
echo "
some text here
";
}
?>
Is this correct?
Larry Kleinman
Kleinman Associates, Inc.
212-949-6469
203-255-4100
--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/web400.
As an Amazon Associate we earn from qualifying purchases.