Sniplet Modules

Sniplets is supplied with a variety of built-in modules, details of which are given on this page. Where necessary some modules require the use of additional parameters. These parameters can be specified alongside the module name and multiple parameters are separated with a comma.

Syntax Highlighting

The syntax highlighting function takes several parameters:

  • language – Any of the GeSHi language strings
  • header – Set to div or pre to specify whether the code is wrapped in a div or pre
  • keywords – Set to true or false to have code keywords linked to help pages
  • numbers – Set to normal or fancy to specify the line numbering method
  • css – Set to true or false to tell GeSHi whether to embed styles, or whether to use CSS classes
  • force – When set to true the contents are assumed to be PHP, even though they may not start with <?php
  • highlight – Colour highlight specified lines. Lines are separated with a pipe, and can include a range. For example, highlight=1|4|7-15 – highlight line 1, 4 and 7 to 15

Randomize

This will randomize the content based upon a type parameter:

  • line – display a random line from the content
  • word – display a random word from the content
  • custom – split the content using the delimited specified by the parameter custom and display a randomly selected piece of content
  • section (default) – split the content using [section] as the delimiter

You can use this function to achieve a fortune cookie effect.

Leave a comment

Your email address will not be published. Required fields are marked *