Jump to content

[SOLVED] PHP Freak Code


frost

Recommended Posts

htmlspecialchars() will allow you to display html tags and characters on the page. Barrands even better method highlight will provide the lovely blue,red,green and orange colors for the various php and html elements in the text. If your mysql data is returned exactly as you typed it it will produce...

 

TITLE

TUTORIAL STUFF

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/65892-solved-php-freak-code/#findComment-329420
Share on other sites

Ok so the thing is I want to html code around the tutorial:

 

<table>

<tr><td>

<b>TITLE</b></td></tr>

<tr><td>

TUTORIAL STUFF

</td></tr></table>

 

and all of that is stored in my database, so if I do htmlspecialchars(); it will also display the table code...

 

 

 

Why are you storing all that in the database? Just store your tutorial part.

Link to comment
https://forums.phpfreaks.com/topic/65892-solved-php-freak-code/#findComment-329433
Share on other sites

The tutorial includse stuff that is code and stuff that is just me explaining things.

 

How about this route:

 

$Text = preg_replace("/\[code\](.+?)\[\/code\]/is","$CodeLayout", $Text);

 

This is a BBcode thing but I wonder if I could be adapted?

 

In this example it replaces everything between the bbcode "code" values. Is it possible to do something like this and instead of replacing everything just replace all instances of < and > with < > ?

Link to comment
https://forums.phpfreaks.com/topic/65892-solved-php-freak-code/#findComment-329455
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.