Put My Coloring Book on a Joomla site

Install First

The first step is to install My Coloring Book following the normal installation method.  Then it's just a matter of making it appear in a Joomla article.

Putting the Coloring Book on the site

Although you can use the usual embedding techniques in Joomla, you may want to have a single Joomla page which can present different coloring pages.

To do this, you need some level of scripting, and one of the easiest ways is to use a PHP script. Depending on your version of Joomla there will be different options available to you.

  1. Create a PHP file called mcb.php.
  2. Write your PHP script.  At a minimum you will want some way to take request variables (GET, POST) and use them to output an iframe, OR an object for the SWF file.
  3. Create a Joomla page to contain the coloring book, and put in the extension code to include the script (see extensions below).

Here is a VERY simple example of what mcb.php might look like using an iFrame...

<?php
$p = $_GET['p'];
$src = '/mcb/mcb.html#b=book.xml&p='.$p;
echo '<iframe src="'.$src.'" frameborder="0" scrolling="no" width="100%" height="560"></iframe>';
?>

A better approach would be to embed the SWF directly, like this...

<?php
$p = $_GET['p'];
$url = "/mcb/mcb.swf?p=$p.gif";
$w = 700;
$h = 600;
echo <<<EOT
<div id="coloring">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="mcb" width="$w" height="$h">
    <param name="movie" value="$url"/>
    <param name="wmode" value="transparent"/>
    <embed name="mcb" src="/$url" width="$w" height="$h" wmode="transparent" type="application/x-shockwave-flash"></embed>
</object>
</div>
EOT;
?>

Sourcerer

For Joomla 1.5 and above, we recommend Sourcerer.

Here is the Sourcerer code you put in the Joomla article (include inside sourcerer tags)...

<?php
include JPATH_BASE . "/mcb/mcb.php";
?>

Add PHP (Run Digital)

For Joomla 1.5, you can use Add PHP extension from Run Digital as another simple alternative.

And here is the RD Add PHPcode you put in the Joomla article...

{rdaddphp file=mcb/mcb.php}