Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

JavaScript

Summary: Embed (static) JavaScript into wiki pages
Version: 2006-07-17
Prerequisites:
Status: Stable
Maintainer: Pm
Discussion: JavaScript-Talk?

Questions answered by this recipe

  • How can I embed static JavaScript into a wiki page?

(For information about using wiki markup to create or edit JavaScript, see JavaScript-Editable.)

This section is optional; use it to indicate the types of questions (if any) this recipe is intended to answer.

Description

Getting JavaScript into a wiki page is easily done by creating a custom markup for it. For example, weather.com provides me with the following JavaScript code for displaying weather information on a webpage:

<script src='http://voap.weather.com/weather/oap/75025?template=LAWNH&par=null&unit=0&key=77351fbfbbfc1099f80fa310e5f58b52'></script>

So, to create a custom (:weather:) markup that will output this JavaScript code, define a custom markup in local/config.php or a group customization as:

Markup('weather', 'directives',
  '/\\(:weather:\\)/',
  Keep("<script src='http://voap.weather.com/weather/oap/75025?template=LAWNH&amp;par=null&amp;unit=0&amp;key=77351fbfbbfc1099f80fa310e5f58b52'></script>"));

This results in:

Notes

See Also

Contributors

  • Pm

Comments

See discussion at JavaScript-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on October 22, 2013, at 03:37 AM