Re: [PHP] Re: newbie question - php parsing

2009-07-23 Thread Sebastiano Pomata
Thanks, it's now much more clear. I thought that html parts outside
php tags were just dumped to output, no matter of if-else statements
and other conditions. I was *definitely* wrong

2009/7/23 Peter Ford :

> In response to Sebastiano:
>
> There would be not much point in using something like PHP if it ignored the 
> "if"
> statements in the code!
> What effectively happens in a PHP source file is that all the bits outside of
> the  tags are treated like an "echo" statement (except that it handles
> quotes and stuff nicely)
>
> Your original code:
>
> 
> 
> 
>
> can be read like:
>
>  if (the_title('','',FALSE) != 'Home') {
>    echo '';
>    the_title();
>    echo '';
> }
> ?>
>
> You might even find a small (but probably really, really, really small)
> performance improvement if you wrote it that way, especially if it was in some
> kind of loop.
> Note that I prefer to keep HTML separate from PHP as much as possible because 
> it
> helps me to read it and helps my editor check my syntax and HTML structure 
> better...
>
>
> --
> Peter Ford                              phone: 01580 89
> Developer                               fax:   01580 893399
> Justcroft International Ltd., Staplehurst, Kent

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: newbie question - php parsing

2009-07-22 Thread Martin Scotta
This is how I'd write this snippet

',
$title,
'';
}
?>

On Wed, Jul 22, 2009 at 6:31 PM, Lenin  wrote:

> Ted Turner 
>  -
> "Sports is like a war without the killing."
>
> 2009/7/23 Shane Hill 
>
> > 2009/7/22 João Cândido de Souza Neto 
> >
> > > You made a mistake in your code:
> > >
> > > 
> > >
> > > must be:
> > >
> > > 
> >
> >
> > 
>
>
> Short tag and not recommended as its deprecated now, would be void at PHP
> 6.0
>



-- 
Martin Scotta


Re: [PHP] Re: newbie question - php parsing

2009-07-22 Thread Lenin
Ted Turner   -
"Sports is like a war without the killing."

2009/7/23 Shane Hill 

> 2009/7/22 João Cândido de Souza Neto 
>
> > You made a mistake in your code:
> >
> > 
> >
> > must be:
> >
> > 
>
>
> 


Short tag and not recommended as its deprecated now, would be void at PHP
6.0


Re: [PHP] Re: newbie question - php parsing

2009-07-22 Thread Shane Hill
2009/7/22 João Cândido de Souza Neto 

> You made a mistake in your code:
>
> 
>
> must be:
>
> 




also works.

-Shane



>
>
> --
> João Cândido de Souza Neto
> SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS
> Fone: (0XX41) 3033-3636 - JS
> www.siens.com.br
>
> "Sebastiano Pomata"  escreveu na mensagem
> news:70fe20d60907221355m3fa49a75ua053d2f1b9aca...@mail.gmail.com...
> > Hi all,
> >
> > A little doubt caught me while I was writing this snippet of code for
> > a wordpress template:
> >
> > 
> > 
> > 
> >
> > I always thought that php was called only between the  tags,
> > and I'm pretty sure that's right, while HTML code was simply wrote in
> > document as is, without further logic.
> > Now, I can't figure out how this snippet works: I mean, shouldn't HTML
> > code be simply put on document, as it is outside php invoke?
> > Effectively if the title of page is 'Home', the HTML part is totally
> > skipped.
> >
> > Is the if construct that does all the magic inside?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>