musify can be set up for JavaScript, PHP, Drupal or Wordpress.
JavaScript set-up
The easiest way to set-up your web-pages for musify to hot-link the JavaScript into your pages.
On the pages where you want to musify
, put the following script line at the end of your HTML, before the </body>
tag:
<script type="text/javascript" src="http://musify.coreymwamba.co.uk/musify_1.0/musify.js"></script>
We then add the musify class to an element to have it display properly.
<!DOCTYPE html>
<html lang="en">
<head>
<title>example page</title>
</head>
<body>
<p>So we can write this: <span class="musify">G7[[maj7]](($5, #11))</span></p>
<script type="text/javascript" src="http://musify.coreymwamba.co.uk/musify_1.0/musify.js"></script>
</body>
</html>
If you have downloaded the archive then you can change the src attribute to where you uploaded musify.js: and then edit line 32 of musify.js to set the path of musify.css.
PHP set-up
Download the archive and extract musify.php and musify.css. Then include
musify.php in a PHP block:
<?php
include 'musify.php';
?>
Then link to musify.css in your (X)HTML: either add this line
<link href="musify.css" rel="stylesheet" type="text/css" />
or, in your existing stylesheet, add
@import url('musify.css')
You can then echo
the musify function:
<p>here's an example of a chord with a redundant extension:
<?php echo musify ('G7[[maj7]](($5, #11))'); ?>
</p>
OR you can use the musify_tag function. Any text wrapped in [mus] tags will be parsed.
<?php
$text = 'This is the text with a musical snippet: [mus]{{4@4}}Gm[[7€5]] | E[[6]][/mus]';
$text = musify_tag($text);
echo $text;
?>
Drupal set-up
Here's a quick start guide, written by Jak Carr:
- Move the entire "musify" directory into your Drupal installation's sites/all/modules folder (or your site specific directory);
- Enable the module on Administer >> Site building >> Modules; and then
- Set up a new input format or add musify support to an existing format at Administer >> Site configuration >> Input formats
It will probably work best if this filter comes BEFORE a Markdown filter.
WordPress integration
To use musify in your WordPress installation, you will first need to install the Shortcode Exec PHP plugin.
Once the plugin is installed, a menu option for Shortcode Exec PHP
will appear in the Super Admin menu.
Select it and make a new item in the new window that opens.
Open musify.php into a text editor (like Notepad, vi etc.) and find these two lines of code:
// $test = $atts['text'];
// echo musify($test);
Remove the double slashes at the beginning of the lines;
then copy the entire contents of the file, and paste the text into the Shortcode window.
.Then select Save and name the code. You can now use musify in your blog posts!