![]() |
|
#1
|
|||
|
|||
the content in MY pageHi Forum,
I want to include text in my page. The text sometimes might have some format - like line breaks and I don't want to worry too much about things like: ' or " .... how do I do that using include (or something similar) htmlentities(include("content.txt"), ENT_QUOTES); includes it, but if content.txt contains html code it still su%§$ Well I guess there are a lot of ways. I want to fill the plain text from .txt files in css boxes. Greetings Dan |
|
#2
|
||||
|
||||
Re: the content in MY pageWhat is the question?
If you want to simply strip markup from the string (content), you may want to consider strip_tags()? __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#3
|
|||
|
|||
Re: the content in MY pageQuote:
no, I don't want to strip the tags. I want to include a plain text file (*.txt) in the body of my page. All characters (in the text file) which have HTML character entity equivalents have to be translated into these entities. In case the text file contains html code, I don't want the code/tags to be removed but converted (e.g.: </B> converted to </B> ) Thanks Dan |
|
#4
|
|||
|
|||
Re: the content in MY pageThis works
<?php $content = file_get_contents('content.txt'); echo htmlentities($inhalt, ENT_QUOTES); ?> .......BADcode.......htmlentities(include("content .txt"), ENT_QUOTES); Tanks D |
|
#5
|
||||
|
||||
Re: the content in MY pageIf this is for a web page, you just need htmlspecialchars.
Because you didn't supply example content from content.txt, and what you hope to see on the web page, it's hard for me to understand what you're asking. The problem with htmlentities/htmlspecialchars is that it will translate & into &, which affects any html character entity already inside content.txt. A decent way of maintaining the character entities in your web page is to use preg_replace, like this: PHP Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#6
|
|||
|
|||
Re: the content in MY pageQuote:
There is no problem with & and &using my code! I don't know why. But I have an other related question: whenever I use letter-spacing:0.05em to format a class of text IE doesn't execute <br /><br /> in the text. It just makes a single <br />. Firefox works fine. same code, letter-spacing:0.05em (plain text) IE makes: bla* bli** blupp Firefox makes: bla* bli** blupp *line brake(<br />) ** 2line breaks (<br /> <br /> If anybody knows a tutorial about text-screen-layouts (how to get the best readability), I would be grateful! |
Recent GIDBlog
First week of IA training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Google AdSense tips to earn money | amigo | AdSense Forum | 30 | 17-Mar-2008 09:02 |
| Bad, bad Google update! | JdS | Search Engine Optimization Forum | 18 | 12-Nov-2005 21:41 |
| Loading a php page in an iframe from javascript | Clive73 | Web Design Forum | 0 | 18-May-2005 06:10 |
| [script] E-mail webmaster error page | BobbyDouglas | PHP Code Library | 0 | 19-Aug-2003 20:10 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The