NuvoForum LeaderVPS - Virtual Prince of the Server
If you're not planning on using PHP's inbuilt PHP code highlighter, it's as simple as:
[PHP]<?php
$variable = "This is the code:
<?php echo 'code'; ?>";
$variable = str_replace("<", "<", $variable);
$variable = str_replace(">",">", $variable);
?>[/PHP]
If you plan to use PHP's highlighter, it's a bit different, but the highlighter isn't much good unless you don't mind not being able to easily highlight other languages (it only works on PHP by default).
The basic jist of it is that HTML is designed so that code won't get rendered as anything other than text unless it's HTML tags or CSS, ASCII character codes or a few other things.
PHP, CSS, XHTML, Delphi, Ruby on Rails & more. Current project: CMS Object. Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in. Release date: NEVER!!!
danielneriWP V.I.P.VPS - Virtual Prince of the Server
NuvoForum LeaderVPS - Virtual Prince of the Server
X_X
Get the contents you want from your DB and store it in a variable so you can work on it before echoing it to the output.
Ideally, you should do this before inserting the article into the database since it will add to the loading time if you do it each time the end user load the article (it also adds to server load).
If you do it before insertion, you only increase server load and loading times when you insert articles and when you edit them (because you have to convert the tags and such).
PHP, CSS, XHTML, Delphi, Ruby on Rails & more. Current project: CMS Object. Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in. Release date: NEVER!!!
danielneriWP V.I.P.VPS - Virtual Prince of the Server
so could you help me out here? i right now have no flying clue what to do!
NuvoForum LeaderVPS - Virtual Prince of the Server
You know when you insert an article into the DB?
Before inserting it with the mysql query, you'd want to use the code I posted above to change:
[php]
mysql_query("INSERT blah blah");
[/php]
mysql_query("INSERT blah blah but using the modified body of the article");
[/php]
I have a very lame script which enables highlighted PHP code blocks, but due to the way it's built, posting it here is a bit funky (it uses the [ php ] tags vB also uses, thus causing problems when written here).
PHP, CSS, XHTML, Delphi, Ruby on Rails & more. Current project: CMS Object. Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in. Release date: NEVER!!!
danielneriWP V.I.P.VPS - Virtual Prince of the Server
I have a very lame script which enables highlighted PHP code blocks, but due to the way it's built, posting it here is a bit funky (it uses the [ php ] tags vB also uses, thus causing problems when written here).
can you post a text file?
btw thanks alot ill check the script out
danielneriWP V.I.P.VPS - Virtual Prince of the Server
wow nuvo thanks so much you are by far one of the most helpful members of this forum!!!
^^ I agree there
Thats the sort of person who makes moderator status
The Royal Ram
danielneriWP V.I.P.VPS - Virtual Prince of the Server
so make him a moderator! he has been deserving it for months!!!!
NuvoForum LeaderVPS - Virtual Prince of the Server
O_o
Anyway, I'm in the process of rewriting a BBCode parser which should be useful for getting people started with writing such things.
I'll do that (shouldn't take long) and post it here.
It should have the PHP highlighting code in with it.
PHP, CSS, XHTML, Delphi, Ruby on Rails & more. Current project: CMS Object. Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in. Release date: NEVER!!!
danielneriWP V.I.P.VPS - Virtual Prince of the Server
Comments
I've read on how to solve this but I can't say that I remember how to do it.
Sorry:(
Submit your threads
Music Forum
My Web Entrepreneur Blog
VolumeBoost - Member Chosen Music News
[PHP]<?php
$variable = "This is the code:
<?php echo 'code'; ?>";
$variable = str_replace("<", "<", $variable);
$variable = str_replace(">",">", $variable);
?>[/PHP]
If you plan to use PHP's highlighter, it's a bit different, but the highlighter isn't much good unless you don't mind not being able to easily highlight other languages (it only works on PHP by default).
The basic jist of it is that HTML is designed so that code won't get rendered as anything other than text unless it's HTML tags or CSS, ASCII character codes or a few other things.
Current project: CMS Object.
Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in.
Release date: NEVER!!!
http://www.vipercreations.com/tutorials.php?phpID=3
help?!
thats okay fourtone
Get the contents you want from your DB and store it in a variable so you can work on it before echoing it to the output.
Ideally, you should do this before inserting the article into the database since it will add to the loading time if you do it each time the end user load the article (it also adds to server load).
If you do it before insertion, you only increase server load and loading times when you insert articles and when you edit them (because you have to convert the tags and such).
Current project: CMS Object.
Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in.
Release date: NEVER!!!
Before inserting it with the mysql query, you'd want to use the code I posted above to change:
[php]
mysql_query("INSERT blah blah");
[/php]
to:
[php]
$article = $_GET;
$article = str_replace("<","<",$article);
$article = str_replace(">",">",$article);
mysql_query("INSERT blah blah but using the modified body of the article");
[/php]
I have a very lame script which enables highlighted PHP code blocks, but due to the way it's built, posting it here is a bit funky (it uses the [ php ] tags vB also uses, thus causing problems when written here).
Current project: CMS Object.
Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in.
Release date: NEVER!!!
can you post a text file?
btw thanks alot ill check the script out
Thats the sort of person who makes moderator status
The Royal Ram
Anyway, I'm in the process of rewriting a BBCode parser which should be useful for getting people started with writing such things.
I'll do that (shouldn't take long) and post it here.
It should have the PHP highlighting code in with it.
Current project: CMS Object.
Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in.
Release date: NEVER!!!
python make him a moderator now!
I will look into it more when christmas is out of the way... Thats when I plan to make some changes around here
The Royal Ram