![]() | ![]() | ![]() |
| |||||||
| Forums | Register | Groups | Awards | Arcade | Pets | T-Bucks / T-Store | Invite Your Friends | Blogs | Mark Forums Read |
| Web Design Forums and discussions on webdesign |
Web Design | |||||||||
|
|
|
|
| |||||
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Civilians | HI, I am creating a little web site where I would like to publish articles. In the articles I usually display examples of programming languages code, or HTML code. Now, I get the articles by PHP and MySQL, or accessing a MySQL table using a PHP script. The article itself is a text type field in a database table. I insert text and code of the article, but, when I want to display it, for example, the HTML code of the example isn't showed, but there are only white lines. Now I would like something don'tlet this code be interpreted, as to be displayed as it is. Thanks Franc -- Teaching OnLine Corsi online di programmazione Php, Asp, C, C++, Visual Basic, Delphi VBA per Access, Excel Linux Shell Programming ------------------------------------ http://www.teachingonline.it |
|
| | #2 (permalink) |
| Civilians | And lo, Francesky didst speak in alt.www.webmaster: > HI, > > I am creating a little web site where I would like to publish articles. > In > the articles I usually display examples of programming languages code, or > HTML code. Now, I get the articles by PHP and MySQL, or accessing a MySQL > table using a PHP script. The article itself is a text type field in a > database table. I insert text and code of the article, but, when I want > to > display it, for example, the HTML code of the example isn't showed, but > there are only white lines. Now I would like something don'tlet this code > be interpreted, as to be displayed as it is. Before you display the HTML code in the field, just replace all < and > with their respective HTML entities. Your sig says you know PHP so here's a quick example: $htmlString = str_replace(array("<", ">"), array("<", ">"), $htmlString); Grey -- The technical axiom that nothing is impossible sinisterly implies the pitfall corollory that nothing is ridiculous. - http://www.greywyvern.com - Orca Knowledgebase: Completely CSS styleable Knowledgebase/FAQ system |
|
| | #3 (permalink) |
| Civilians | > Before you display the HTML code in the field, just replace all < and > > with their respective HTML entities. Your sig says you know PHP so here's > a quick example: > > $htmlString = str_replace(array("<", ">"), array("<", ">"), > $htmlString); > Well, it works, but I wanted something that in some part of the article could have been disabled html interpretation, whele in other parts not. For example, in the same article I put an img tag like this <img src="/articles/art4/image_name1.png"> to diplay an image in the article. Francesco -- Teaching OnLine Corsi online di programmazione Php, Asp, C, C++, Visual Basic, Delphi VBA per Access, Excel Linux Shell Programming ------------------------------------ http://www.teachingonline.it |
|
| | #4 (permalink) |
| Civilians | GreyWyvern wrote: > And lo, Francesky didst speak in alt.www.webmaster: > > > HI, > > > > I am creating a little web site where I would like to publish articles. > > In > > the articles I usually display examples of programming languages code, or > > HTML code. Now, I get the articles by PHP and MySQL, or accessing a MySQL > > table using a PHP script. The article itself is a text type field in a > > database table. I insert text and code of the article, but, when I want > > to > > display it, for example, the HTML code of the example isn't showed, but > > there are only white lines. Now I would like something don'tlet this code > > be interpreted, as to be displayed as it is. > > Before you display the HTML code in the field, just replace all < and > > with their respective HTML entities. Your sig says you know PHP so here's > a quick example: > > $htmlString = str_replace(array("<", ">"), array("<", ">"), > $htmlString); > > Grey > > -- > The technical axiom that nothing is impossible sinisterly implies the > pitfall corollory that nothing is ridiculous. > - http://www.greywyvern.com - Orca Knowledgebase: Completely CSS styleable > Knowledgebase/FAQ system In addition to this suggesstion, you may want to use the <pre> tag to keep all white space formatting (new lines and the such) the same as in the original code. Arccos --- http://www.landoflyrics.com - Land Of Lyrics |
|
| | #5 (permalink) |
| Civilians | > sure, but these are different elements of your document and deserve a > different treatment. I think I need something like in Wiki, where one could use formatting tags to insert various object, text, images, ecc. Frank -- Teaching OnLine Corsi online di programmazione Php, Asp, C, C++, Visual Basic, Delphi VBA per Access, Excel Linux Shell Programming ------------------------------------ http://www.teachingonline.it |
|
![]() |
| Bookmarks |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Display html example code within html | GitarJake | Web Design | 1 | 11-05-2004 16:00 |
| Biologist needs Mac code or script to repeatedly write javaoutput from an html page to a static text file | Michael Levin | Microsoft Applications | 14 | 07-23-2004 20:42 |
| Biologist needs Mac code or script to repeatedly write javaoutput from an html page to a static text file | Michael Levin | Microsoft Applications | 14 | 07-23-2004 20:25 |
| Inserting a HTML table in a page | Virgil | Web Design | 0 | 07-23-2004 15:04 |
| displaying the HTML code in HTML | Astra | Web Design | 3 | 07-08-2004 07:31 |
![]() | ![]() | ![]() |