JavaScript Editor Ajax software     Free javascripts 



Main Page

8.
In the options form that shows up after clicking Save, leave the default options, making sure
you’re exporting to Flash Player 6 format, and click OK.
9.
After exporting your file, it’s OK to close Macromedia Flash. You don’t need to save any
changes to
sifr.fla
.
10.
Open
catalog.php
and add a reference to the
sifr.js
file. Note that you’re working on the
catalog.php
file you created in the previous chapters. Use the code provided by the book’s
code download if you didn’t follow the first six chapters in sequence.
<?php
// load the URL factory library
require_once ‘include/url_factory.inc.php’;
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN”
“http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
<html>
<head>
<title>The SEO Egghead Shop</title>
<script src=”sifr/sifr.js” type=”text/javascript”></script>
<link rel=”stylesheet” href=”sifr/sIFR-screen.css” type=”text/css”
i
media=”screen” />
<link rel=”stylesheet” href=”sifr/sIFR-print.css” type=”text/css”
i
media=”print” />
</head>
11.
The final step required to see sIFR in action is to select the strings you want replaced. You do
this by including JavaScript code that makes the changes when the page loads. Add this code
before the closing
</body>
tag in
catalog.php
, as shown in the following code snippet. (Note
there are additional ways to do this, as explained in sIFR’s documentation.)
<!-- sIFR replacement code -->
<script type=”text/javascript”>
// continue only if the sIRF code has been loaded
if(typeof sIFR == “function”)
{
// replace the <h1> text
sIFR.replaceElement(named({sSelector:”body h1”, sFlashSrc:”./sifr/super_font.
i
swf”}));
};
</script>
</body>
</html>
12.
You’re done! If you disable JavaScript and load
http://seophp.example.com/
catalog.html
, you get to your catalog page that uses the default heading font, which
you can see in Figure 6-8.
13.
Loading the very same page with JavaScript and Flash enabled, you get your title drawn
with the new font! (See Figure 6-9.)
134
Chapter 6: SE-Friendly HTML and JavaScript
c06.qxd:c06 10:55 134


JavaScript Editor Ajax software     Free javascripts