RE: [PHP-DB] Quick Question: Line Breaks

2004-01-09 Thread Ford, Mike [LSS]
On 09 January 2004 03:58, Jacob Hackamack wrote:

> Hello,
> 
> I have a couple of quick questions.  When I execute this code on my
> php page (I know that the .PSD image isn¹t web ready, but Safari does
> what I need it to do :) ) it displays the entire source as one line. 
> Is there anyway to have it be broken.  I have read places (internet
> sites) that say that the following solutions might work:
> echo OE¹;\n\n
> echo OE¹\n\n ;
> echo OE\n\n¹;
> 
> None of them seem to work, am I doing something wrong?
> 
> 
> echo ''; echo '';
> echo '';
> echo '';
> echo 'FilmCanister Desktops';
> echo '';
> echo '';
> echo '';
> echo '';
> echo '';
> echo '';
> echo 'Coming SoonDesktop Pictures (2.83 GB Worth)'; echo
> ''; echo '';
> echo '';

The reason you have it all on one line is because you haven't echoed any
newlines.  You have a number of options to do this.  As there is no variable
interpolation anywhere in there, you could just break out of PHP and do it
as straight HTML:

...
?>




FilmCanister Desktops






Coming SoonDesktop Pictures (2.83 GB Worth)






...


';

If you plan to have variables in there at some point, you can either use
 segments, or use a heredoc:

echo <<





...


END;

or, again, you could use a multi-line string -- but this time double-quoted
to give interpolation (but note that you now have to escape all your
embedded double quotes):

echo "






...


";

Which route you choose is pretty much personal taste -- personally, if I
have a page that's mostly straight HTML with not much PHP code, I write it
as HTML with embedded PHP snippets, but I know some people think that looks
weird or ugly...!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



Re: [PHP-DB] Quick Question: Line Breaks

2004-01-08 Thread Micah Stevens

\n is not converted to a newline unless you use double quotes around the 
string. 

See: http://us3.php.net/manual/en/language.types.string.php

-Micah


On Thu January 08 2004 7:58 pm, Jacob Hackamack wrote:
> Hello,
>
> I have a couple of quick questions.  When I execute this code on my php
> page (I know that the .PSD image isn¹t web ready, but Safari does what I
> need it to do :) ) it displays the entire source as one line.  Is there
> anyway to have it be broken.  I have read places (internet sites) that say
> that the following solutions might work:
> echo Œ¹;\n\n
> echo Œ¹\n\n ;
> echo Œ\n\n¹;
>
> None of them seem to work, am I doing something wrong?
>
>
> echo '';
> echo '';
> echo '';
> echo '';
> echo 'FilmCanister Desktops';
> echo '';
> echo '';
> echo '';
> echo '';
> echo '';
> echo '';
> echo 'Coming SoonDesktop Pictures (2.83 GB Worth)';
> echo '';
> echo '';
> echo '';
>
> Also, I am looking for a good freeware image gallery for Linux/Apache, if
> anybody has any suggestions please help out.
>
> Thanks for advance.
>
> Jacob

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



[PHP-DB] Quick Question: Line Breaks

2004-01-08 Thread Jacob Hackamack
Hello,

I have a couple of quick questions.  When I execute this code on my php page
(I know that the .PSD image isn¹t web ready, but Safari does what I need it
to do :) ) it displays the entire source as one line.  Is there anyway to
have it be broken.  I have read places (internet sites) that say that the
following solutions might work:
echo Œ¹;\n\n
echo Œ¹\n\n ;
echo Œ\n\n¹;

None of them seem to work, am I doing something wrong?


echo '';
echo '';
echo '';
echo '';
echo 'FilmCanister Desktops';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo 'Coming SoonDesktop Pictures (2.83 GB Worth)';
echo '';
echo '';
echo '';

Also, I am looking for a good freeware image gallery for Linux/Apache, if
anybody has any suggestions please help out.

Thanks for advance.

Jacob