473,796 Members | 2,512 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

trouble with echo <br />

I'm an extreme newbie, and have been nosing around the PHP.Net site for a
few days. Only, the search function returns alot of information that's not
truly relevant due to Coding samples at the bottom of the pages.

What I'm trying to determine is :

Which is better for printing info to a page based on dynamic variables?
IE - if I have a boolean = True, should I use PrintF, print, echo to spit
out the info?

Also, when I use either, and have a <br /> in the statement, it puts <br>
instead, and I can't for the life of me get it to put /> there at the end.

And one more thing (begins a rambling rant o questions), the syntax for
boolean use (basic format?)

I used
$good = TRUE

if($good == TRUE) { echo "blah <br />" } and it doesn't seem to trigger.

If I use = TRUE, it triggers, but i think that's wrong for some reason.

-Khai
Dec 2 '05 #1
14 16487
Echo is a construct, print is a function. I think speed wise they
should both be the same.

Try

$good = TRUE;

if($good == TRUE) { echo "blah <br />"; }

You forgot those semi colons. Not sure why it isn't printing out the
/>.

This

$good = TRUE;

if($good = TRUE) { echo "blah <br />"; }

Will always evaluate to try because instead of doing a comparison you
are doing an assignment.

Dec 2 '05 #2
Man, you were so right. AS soon as I saw the first Try $good = TRUE; it
dawned on me that I never set the $good to anything except FALSE. So when
it was testing for $good == TRUE it was coming up false, because $good was
never ever set to true, it was just an empty var. *smacks forhead*.

However, I changed my echo setup and went with escaping to HTML, IE:

<?php if ($good = TRUE) { ?>
blah blah <br />
<?php }; ?>

THat seems to work better, but still having issues getting the <br />
instead of the <br> it keeps punching out. Perhaps it's just in cache and I
need to clear it.

Thanks =)

-khai
"Sean" <or**********@g mail.com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
Echo is a construct, print is a function. I think speed wise they
should both be the same.

Try

$good = TRUE;

if($good == TRUE) { echo "blah <br />"; }

You forgot those semi colons. Not sure why it isn't printing out the
/>.

This

$good = TRUE;

if($good = TRUE) { echo "blah <br />"; }

Will always evaluate to try because instead of doing a comparison you
are doing an assignment.

Dec 2 '05 #3
In our last episode,
<xN************ *************** ***@comcast.com >,
the lovely and talented Khai
broadcast on comp.lang.php:
THat seems to work better, but still having issues getting the <br />
instead of the <br> it keeps punching out. Perhaps it's just in cache and I
need to clear it. Thanks =)


Are you running your output through lint such as tidy?
If it (the lint) doesn't know you are trying to write xhtml, it
will "correct" it to html. Be sure your doctype declares xhtml,
too.

--
Lars Eighner us****@larseigh ner.com http://www.larseighner.com/
Love: The warm feeling you get towards someone who meets your neurotic needs.
Dec 2 '05 #4
I think u should it without that space so u should try it <br/> only
not <br />

Dec 4 '05 #5
XIII wrote:
I think u should it without that space so u should try it <br/> only
not <br />

Except if it is XHTML the space is required, now if the original file is
HTML no XHTML it should be '<br>' with no '/'

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Dec 4 '05 #6
Ok - it seems that PHP has a Tidy library that tries to validate/repair
html. Since <br /> is expected to have a <br>, it's replacing it with a
<br>.

Even if it's written outside <?php ?>, or echo from inside, it still puts
<br> instead of just <br />.

Is there a way around this, rather than writing <br> <br /> every time I
want a break?

Thanks,

Khai
"Lars Eighner" <us****@larseig hner.com> wrote in message
news:sl******** ************@go odwill.io.com.. .
In our last episode,
<xN************ *************** ***@comcast.com >,
the lovely and talented Khai
broadcast on comp.lang.php:
THat seems to work better, but still having issues getting the <br />
instead of the <br> it keeps punching out. Perhaps it's just in cache and I need to clear it.
Thanks =)


Are you running your output through lint such as tidy?
If it (the lint) doesn't know you are trying to write xhtml, it
will "correct" it to html. Be sure your doctype declares xhtml,
too.

--
Lars Eighner us****@larseigh ner.com

http://www.larseighner.com/ Love: The warm feeling you get towards someone who meets your neurotic

needs.
Dec 5 '05 #7
In our last episode,
<qL************ *************** ***@comcast.com >,
the lovely and talented Khai
broadcast on comp.lang.php:
Ok - it seems that PHP has a Tidy library that tries to validate/repair
html. Since <br /> is expected to have a <br>, it's replacing it with a
<br>.
There are tidy functions in php, but if you are not invoking
them, I don't see how they would affect things. I suspect that
tidy is being run externally on your output. Before looking
any deeper in php, be sure your doctype declares xhtml and try
using a .tidyrc with an xhtml doctype option.
Even if it's written outside <?php ?>, or echo from inside, it still puts
<br> instead of just <br />.
Just echoing or printing tags should not do anything with php's
tidy functions, which seem to be some kind of object-oriented
crap.
Is there a way around this, rather than writing <br> <br /> every time I
want a break?


See if this happens in documents generated by php cli. I bet it
doesn't. If it doesn't, there is some kind of post processing
going on. If it is nice, it should get the right answer if you
provide the right doctype and/or .tidyrc .

--
Lars Eighner us****@larseigh ner.com http://www.larseighner.com/
Good Morning, Carnivore! - Anthrax botulin nuclear flight mail Akbar reservoir
Ramadan letter activate bridge Abdul safehouse virgins money detonators Allah
smallpox Glaspie Springfield agent airport dispersal facility counterfeit
Dec 5 '05 #8
"Khai" <middae*nospam* @*nO_Spam*hotma il.com> wrote:

Ok - it seems that PHP has a Tidy library that tries to validate/repair
html. Since <br /> is expected to have a <br>,


No, it's not. The close of a matching pair has the / at the beginning:
<p> </p>
The / at the end specifically means "this is a standalone tag that does not
have a closing mate". Thus, <br /> is quite correct.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Dec 6 '05 #9
I have tried it both ways, and it seems it spits out <br>'s only. I'm at my
wits end. *sighs*

-khai

if anyone takes pitty, i'll be happy to post the source or email it.

-khaiv2

"Jonathan N. Little" <lw*****@centra lva.net> wrote in message
news:43******** *************** @news.centralva .net...
XIII wrote:
I think u should it without that space so u should try it <br/> only
not <br />

Except if it is XHTML the space is required, now if the original file is
HTML no XHTML it should be '<br>' with no '/'

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Dec 6 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
7866
by: fis | last post by:
Hi all, I've problem because there are needed break lines in my texts on the web site but i can't do it :( My pipeline looks like: XMS -> I18N -> XSLT -> HTML I have lot of texts in my "languages" files and these are describes for things on my website. Example text looks like this:
6
12155
by: Lasse | last post by:
I have done this simple function, it seems to work as intended, to solve a problem i have had for a while. I couldnt find any sample around that was working for me. I would like to test it with you and see if there are any improvments that i should make ;-) It should be fast and if possible compatible with todays modern browser-standards. It should be activated by the onload-event. This is my code, free for all to use:
7
19166
by: noor.rahman | last post by:
I have an XML file that stores data from an HTML form. I use XSL to display the data in HTML format. The data may have newline characters. However, XSL is not displaying the newlines properly in the browser. I even replaced all the newlines with <BR/> tags but eventhough I see the tags in my source, I don't get a line break in the output document. Any help would be greatly appreciated.
7
2752
by: Rocky Moore | last post by:
I have a web site called HintsAndTips.com. On this site people post tips using a very simply webform with a multi line TextBox for inputing the tip text. This text is encode to HTML so that no tags will remain making the page safe (I have to convert the linefeeds to <BR>s because the Server.EncodeHTML does not do that it seems). The problem is that users can use a special tag when editing the top to specify an area of the tip that will...
5
6080
by: SteveB | last post by:
How can I write a break on Web Form using C#?
2
2538
by: Winshent | last post by:
I have a multi line text in an admin page on my cms. I am trying to capture carriage returns as and replace them with <p></p> bfore the string gets written to the database. I have tried all the charcontrols option and chr(13) with success.. was using the following code: Dim s As String = MyTextbox.Text
1
3172
by: Winshent | last post by:
I have a multi line text in an admin page on my cms. I am trying to capture carriage returns as and replace them with <p></p> bfore the string gets written to the database. I have tried all the charcontrols option and chr(13) with success.. was using the following code: Dim s As String = MyTextbox.Text
7
3628
by: Nathan Sokalski | last post by:
Something that I recently noticed in IE6 (I don't know whether it is true for other browsers or versions of IE) is that it renders <br/and <br></br> differently. With the <br/version, which is what most people use when they write static code (some people use <br>, but with xhtml you are required to close all tags), IE6 simply breaks to the next line like it is supposed to. However, with <br></br>, which is what is sometimes generated by...
2
2087
by: kaotik78 | last post by:
I've racked my head on this all day long. I've been using php for 3 days now and this is the first hang up I've had and it's driving me nuts, but I can't pull myself away from trying to fix the problem. I need help or a push in the right direction. I have a contact form and a validate form. I'll keep this short and sweet, if it can work for one field, I can figure it out for the rest. I have session_start() at the top of both form and...
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9525
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10452
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10221
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.