Knowledge Base Article

How to insert programming source code in vBulletin posts?

Many forum members, especially in the technically oriented forums, need to insert programming source code in their posts.

 

In order to be able to include such a programming code and to highlight the specific syntax the GeSHi (Generic Syntax Highlighter) extension should be integrated in the vBulletin forum.

 

The corresponding product can be downloaded from the following location:

 

http://www.vbulletin.org/forum/showthread.php?t=93071&highlight=geshi

 

Then the .xml file included in the package should be installed through the vBulletin admin panel->Plugins & Products->Manage Products->Add/Import Product. The GeSHi files and folders should be uploaded in the vBulletin includes directory.

 

In order to use the GeSHi functionality the programming source code should be wrapped in the following bbcode:



[highlight=language]
some code
[/highlight]

 

Examples of the GeSHi solution can be found below:

 

[highlight=PHP]
<?php
phpinfo();
?>
[/highlight]



[highlight=html4strict]
<!-- some HTML here -->
<html>
<body>
<p style="text-align:right">Some text in a paragraph.</p>
</body>
</html>
[/highlight]



[highlight=sql]
SELECT FROM database_table WHERE database_table.age=30 ORDER BY database_table.name;
[/highlight]

 



Rating

Please indicate if this article was helpful for you.

rating :  4.3 from 5
views :  1660
votes :  3

Haven't found what you are looking for? Suggest an article HERE.

powered by

Valid XHTML 1.0 Strict Valid CSS!