Code Snippets

Code snippets were introduced with Website Baker 2.6. This module type allows to add own functions which can be invoked from the index.php file off your template or from a page/section of the type: Code. Website Baker does not include any code snippets per default.

Code snippets are installed via the WB backend: Add-Ons -> Modules -> Install Module. All functions contained in the include.php file of the code snippet can be invoked via the index.php file of your template or from a page/section of type code.

The list below provides all code snippets available for Website Baker.

Additional Functions
  Any newsdownloads: 10889 | type: zip | size: 61.4 kB

This snippet adds the new function: displayNewsItems() to Website Baker. The function can be used to display news entries from the Website Baker News module on any page you want. Details about the optional function parameters and tips and tricks to adjust the output to your needs are contained in the README (EN, NL outdated) files. For help or feature requests, please visit the Anynews forum thread.

Supported languages: English, German, Dutch and Estonian.

Note: invoke displayNewsItems() from the index.php file of your template or from a page/section of type code

Requirements: Website Baker version 2.7 or higher, WB News module
Remember that you have to adjust the function parameters when upgrading from Anynews v0.70 or below.

Licence: GNU-GPL, Author: Christian Sommer (doc), Version: 1.10 (May 31, 2009)

:.. Please note:
I have suspended my support for the "Anynews" code snippet effective June 07, 2009. If someone wants to develop or maintain this code snippet any further, please feel free to do so, but keep in mind  that the snippet  is licensed under GNU GPL (doc).
 
  Html2pdfdownloads: 9296 | type: zip | size: 4.3 MB

This code snippet allows you to convert HTML pages to PDF, based on html2ps/pdf v.1.9.4. The documentation of the module can be found on the website of the developer. See the forum for further information about the module.

Note: invoke the function from the index.php file of your template or from a page/section of type code

Licence: GNU-GPL, Author: Arnt F. Below, Version: 0.11

 
  Last Update Infodownloads: 6581 | type: zip | size: 1.6 kB

This snippet adds the new function: get_modified_when() to Website Baker.
The function displays the date and the name of the last author of a page. The function is invoked without any parameters.

Note: invoke the function from the index.php file of your template or from a page/section of type code

Licence: GNU-GPL, Author: Peter Vroegop, Version: 0.20

 
  Newsletterdownloads: 3753 | type: zip | size: 17 kB

Newsletter is a code snippet which provides an interface for visitors to sign for a newsletter. The module send an activation link to the user and after activation add the email to massmail. Supported languages: English, German, Dutch, French. See the module thread of the WB forum for further information or visit the website of the developer.

To get it work, intall the massmail module and the newsletter snippet via the WB backend and add the following code to the index.php of your template or to any code section:

if(function_exists('newsletter_info')) {
  newsletter_info('Newsletter','newsletter@ralf-hertsch.de',true,false);  }

Note: All versions below v0.16 had a XSS security vulnerability. Please upgrade.

License: GNU-GPL, Author: Ralf Hertsch, Version: 0.17 (Apr 12, 2008)

 
  Random Imagedownloads: 10060 | type: zip | size: 943 Bytes

This snippet adds the new function: RandomImage() to Website Baker. The function displays a random image from a specified directory. As parameter the directory path starting from the WB root directory is required.

To display a random image from the subfolder '/pics' within the MEDIA directory, use: RandomImage(MEDIA_DIRECTORY .'/pics');

Note: invoke the function from the index.php file of your template or from a page/section of type code; the specified subfolder must contain at least two images (other wise you will see an error message).

Licence: GNU-GPL, Author: John Maats (pcwacht), Version: 0.10

 
  ShowMenu2downloads: 17510 | type: zip | size: 34.5 kB

This snippet adds the new function: show_menu2() to Website Baker.
The function is a very powerfull replacement for the built in function show_menu().

See the snippet thread of the WB forum for further information. Details about the function parameters can be found in the English README (EN) or German README (DE) files. Visit the website of the developer to get an impression what the function is all about. Compatible with WB 2.6.x and WB 2.7.x.

Invoke the function from the index.php file of your template or from a page/section of type code.

Note: If your menu disappears after submitting a search, follow the steps described in this module thread.

Licence: GNU-GPL, Author: Brodie Thiesfield, Version: 4.70 (Okt 20, 2008)