You are here: Re: Mangled Code Mess « PHP Programming Language « IT news, forums, messages
Re: Mangled Code Mess

Posted by Curtis on 12/14/06 09:56

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.

Curtis

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:
> > >
> > > http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
> > >
> > > On Dec 11, 7:19 am, bill <nob...@spamcop.net> wrote:
> > >> see end of post:
> > >>
> > >>
> > >>
> > >> Double Echo wrote:
> > >>> This is old-style dirty PHP programming. There are a lot of stupid
> > >>> programmers
> > >>> 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.
> > >>> <?php
> > >>> $var = 1 + 1 ;
> > >>> print <<<ENDOFHTML
> > >>> <html>
> > >>> <table>
> > >>> <tr>
> > >>> <td>
> > >>> $var
> > >>> </td>
> > >>> </tr>
> > >>> </table>
> > >>> ENDOFHTML;
> > >>> $some_more_php = 2 + 2 ;
> > >>> print <<<ENDOFHTML
> > >>> $some_more_php
> > >>> ENDOFHMTL;
> > >>> ?>
> > >>> 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.
> > >>> -DE-DE.
> > >> for a newbie, who likes your style, please reference or explain
> > >> the syntax:
> > >>
> > >> print <<<ENDOFHTML
> > >>
> > >> bill
> > >
> >
> > That sure will make writing html with embedded PHP variables a
> > LOT more straightforward !
> >
> > bill

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация