473,804 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple question for once ?


How do I get a text string that may contain HTML tags to
echo out to a web browser verbatim?

IE I want the tags to be printed out - not interpreted.

Thanks
May 11 '07 #1
3 1314
On 11 May, 17:38, harvey <harvey....@blu eyonzders.comwr ote:
How do I get a text string that may contain HTML tags to
echo out to a web browser verbatim?

IE I want the tags to be printed out - not interpreted.

Thanks
$string = '<h1>likethis</h1>';

echo htmlentities( $string );
//or
echo highlight_strin g( '<?php' . $string . '?>' );
//where adding <?php is a trick to highlight non-php, if you dont
mind the php tags appearing.(u could kill them afterwards)

May 11 '07 #2
In article <11************ **********@o5g2 000hsb.googlegr oups.com>,
ma********@gmai l.com says...
On 11 May, 17:38, harvey <harvey....@blu eyonzders.comwr ote:
How do I get a text string that may contain HTML tags to
echo out to a web browser verbatim?

IE I want the tags to be printed out - not interpreted.

Thanks
$string = '<h1>likethis</h1>';

echo htmlentities( $string );
//or
echo highlight_strin g( '<?php' . $string . '?>' );
//where adding <?php is a trick to highlight non-php, if you dont
mind the php tags appearing.(u could kill them afterwards)

That was fast -
I am a bit red faced as I actually recognise that command but thought it
did something else !

Your second method is a new one to me - I will experiment with that.

thank you !
May 11 '07 #3
On 11 May, 17:51, harvey <harvey....@blu eyonzders.comwr ote:
In article <1178901903.347 883.242...@o5g2 000hsb.googlegr oups.com>,
matt.fa...@gmai l.com says...
On 11 May, 17:38, harvey <harvey....@blu eyonzders.comwr ote:
How do I get a text string that may contain HTML tags to
echo out to a web browser verbatim?
IE I want the tags to be printed out - not interpreted.
Thanks
$string = '<h1>likethis</h1>';
echo htmlentities( $string );
//or
echo highlight_strin g( '<?php' . $string . '?>' );
//where adding <?php is a trick to highlight non-php, if you dont
mind the php tags appearing.(u could kill them afterwards)

That was fast -
I am a bit red faced as I actually recognise that command but thought it
did something else !

Your second method is a new one to me - I will experiment with that.

thank you !
well i was too quick for my puny brain
it should be

highlight_strin g( '<?php ' . $string . ' ?>' );

of course!!

May 11 '07 #4

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

Similar topics

19
3313
by: gaudetteje | last post by:
I've been searching high and low for a way to simply convert a small XML configuration file to Python data structures. I came across gnosis XML tools, but need a built-in option for doing something similar. My knowledge of DOM and anything beyond simple XML structures is rudimentary at best. Is there a simple way to use SAX handlers to pull attributes and elements into Python lists/dictionaries?
27
2400
by: Brian Sabbey | last post by:
Here is a first draft of a PEP for thunks. Please let me know what you think. If there is a positive response, I will create a real PEP. I made a patch that implements thunks as described here. It is available at: http://staff.washington.edu/sabbey/py_do Good background on thunks can be found in ref. . Simple Thunks
16
2911
by: Terry | last post by:
Hi, This is a newbie's question. I want to preload 4 images and only when all 4 images has been loaded into browser's cache, I want to start a slideshow() function. If images are not completed loaded into cache, the slideshow doesn't look very nice. I am not sure how/when to call the slideshow() function to make sure it starts after the preload has been completed.
17
6531
by: savesdeday | last post by:
In my beginnning computer science class we were asked to translate a simple interest problem. We are expected to write an algorithm that gets values for the starting account balance B, annual interest rate I, and annual service charge S. Your algorithm would then compute and print out the total amount of interest earned during the year and the final account balance at the end of the year (assuming that interest is compounded monthly, and...
3
2174
by: Iain Miller | last post by:
Can anybody help me with some Access 2000 code? I don't do a lot of coding in Access & so every time I come back to do something I pretty much have to relearn the syntax from scratch so this is taking me hours. As with most occasional programmers its the commas, colons, inverted commas, square brackets etc etc that cause the problem! (Not to mention the nuances of using Do While, Do until, Case statements If statements, IIF etc etc...)...
18
1926
by: Bob Cummings | last post by:
Not sure if this is the correct place or not. Anyhow in school we were taught that when trying to calculate the efficiency of an algorithm to focus on something called FLOPs or Floating Point operations and disregard all integer operations. My question is this. I am writing a simulation for animal dispersement through large landscapes. We are loading data from several different files to simulate the environment the animals will be...
1
376
by: Chris Lieb | last post by:
I am new to XML Schema and am running into a bit of a snag. I have defined an XML-based scripting language for an updater program that I am working on. I would like to make a schema for this language since malformed XML documents break the updater. (I did not have time to add good error-handling code, so run-time errors can abound if the document is malformed.) A sample doc might look something like this: <manifest>
8
2309
by: Eric_Dexter | last post by:
I was looking for a simple way to load a simple python program from another python program. I tried os.system(cabel) The file name is cabel.py a csound instrument editor.. The error I am getting is
30
3554
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
1
7441
joedeene
by: joedeene | last post by:
Hello all, I am using Macromedia Flash Professional 8 in this example of a simple way to use motion tweens. Ok here goes... Directions: A. Preparation 1.) Start the Flash program. Once loaded, create a new Flash Document. Note: By default the pixels are set to 550 x 400, i changed mine to 275 x 200. 2.) Speed up the animation by changing the frame rate to 36 fps.
0
9594
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
10346
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...
1
10347
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10090
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
7635
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
5531
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
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
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.