Re: Mangled Code Mess

As long as the JavaScript isn't relying on data passed by PHP, you
should be fine by storing the JS in its own file, which is usually the
case. Usually, it's best to keep the presentation tier separate from
the business logic anyway.


Skijor wrote:
Thanks all.

As far as the JavaScript definitions go, is there really a good reason
to generate the functions on the fly like this? I assume I can just
statically define them in a .js file instead of creating them on the
fly every time my php code is called. The assumption being I replace
the function definitions with function calls in the php-generated HTML.

bill wrote:
Curtis wrote:
Here's the PHP manual's page on heredoc syntax:

On Dec 11, 7:19 am, bill <nob...@xxxxxxxxxxx> wrote:
see end of post:

Double Echo wrote:
This is old-style dirty PHP programming. There are a lot of stupid
who mingle/mangle code like this trying to be cute. Instead of some HTML
with PHP thrown in, reverse it. Have PHP with HTML thrown in. PHP
should be the control, HTML should not be.
$var = 1 + 1 ;
print <<<ENDOFHTML
$some_more_php = 2 + 2 ;
print <<<ENDOFHTML
A lot of web servers won't be set up for HTML-with-PHP but if you have
a web server with PHP enabled, you can always throw in HTML. Programmers
who mix PHP into HTML just don't know how to program cleanly.
for a newbie, who likes your style, please reference or explain
the syntax:

print <<<ENDOFHTML


That sure will make writing html with embedded PHP variables a
LOT more straightforward !



Relevant Pages

  • XMLHttpRequest and AJAX for PHP programmers
    ... Although the concept isn't entirely new, XMLHttpRequest technology is ... There are too many PHP programmers avoiding any ... work with javascript beyond simple form validation, ...
  • Attempt to de-mystify AJAX
    ... A javaScript enabled web browser. ... One of the first things to happen is toward the last in the html code: ... Set the onReadyStateChange handler to our processChange() function ... I like PHP so our example uses php. ...
  • Re: MV by Phone and Cross-Platform MV connectivity
    ... And you believe the operators are going to do their own thing in PHP / ... Javascript & HTML ... where are *any* services set up by Pick hosts. ...
  • Re: XML over CSS
    ... >>It depends how you code your PHP. ... But generally when people code the HTML ... So there is a trade-off between reusability and ... programmers can do that. ...
  • Simple Javascript replace (with a twist!) of an href
    ... know this isn't that hard, i'm just a little new to javascript, and I ... so I need to change the href of a link on our php driven auction ... The reason I need to do this is that the html parser used by our ... I have spent hours searching and testing with no luck. ...