We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15871
    • 105 Posts
    Yep, that’s the one. I go it working. The Flash embed code is not as sexy as I want it to be since I think it will have issues with ActiveX. The AC_RunContent script won’t fire, so I am just using The EMBED and OBJECT code for it.

    OK, first, I’m passing the docID into the pageflip document which holds the Flash code like so:
    <a href="[~111~]?docID=[*id*]">Page Flip<a>
    


    Document #111 is the pageflip page with the flash code using a blank template (for now):
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Prinspiration</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    body {
    	background-color: #333333;
    	margin-left: 0px;
    	margin-top: 0px;
    	margin-right: 0px;
    	margin-bottom: 0px;
            height: 100%
            width: 100%
    }
    -->
    </style>
    
    </head>
    
    <body>
    
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="[[flippingVars?filter=`width`]]" height="[[flippingVars?filter=`height`]]" id="flippingBook" align="middle">
    	<param name="allowScriptAccess" value="sameDomain" />
    	<param name="allowFullScreen" value="true" />
    	<param name="movie" value="assets/flash/flippingBook.swf" />
            <param name="quality" value="high" />
            <param name="bgcolor" value="#000000" />
    	<param name="scale" value="noscale"> 
            <param name="FlashVars"value="xmlConfig=pageflip.xml?docID=[[flippingVars?filter=`pID`]]">
            <embed src="assets/flash/flippingBook.swf" quality="high" bgcolor="#ffffff" width="[[flippingVars?filter=`width`]]" height="[[flippingVars?filter=`height`]]" name="flippingBook" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="xmlConfig=pageflip.xml?docID=[[flippingVars?filter=`pID`]]" scale="noscale" />
    	</object>
    
    
    
    
    </body>
    </html>
    


    You’ll see a "flippingVars" snippet. This let’s me pass the variables down into the Flash script. Here’s the code for that:
    <?php
    $pID = (int) $_GET["docID"];
    $filter = (isset ($filter)) ? $filter : 'pID'; // Set the  filter
    $tvSize = $modx->getTemplateVarOutput(array("pageWidth","pageHeight"),$pID);
    $width = $tvSize['pageWidth'] *2;
    $height = $tvSize['pageHeight'];
    
    if  ($filter == 'width') {
         echo $width;
    } elseif ($filter == 'height') {
         echo $height;
    } else {
         echo $pID;
    }
    ?>
    


    The XML file is set in MODx, template blank, text/xml filetype and named "pageflip.xml" (I am using fURLs with no file suffix BTW). I make a snippet call on that page to "generateXML" (uncached) and here is the snippet:
    <?php
    $pID = (int) $_GET["docID"];
    if($pID < 1) {
    exit("no valid document id received - aborting script");
    }
    $tvSize = $modx->getTemplateVarOutput(array("pageWidth","pageHeight"),$pID);
    $width = $tvSize['pageWidth'];
    $height = $tvSize['pageHeight'];
    $filter = (isset ($filter)) ? $filter : '.jpg'; // Set the  filetype filter
    $directory = (isset ($directory)) ? $directory : 'assets/pageimgs/'.$pID.'/normal/'; // Where to look for images
    
    //Set the size (width and height attributes are sent in TVs as pixel dimensions)
    $tvWidth = $width * 2; // This sets the total width
    $tvHeight = $height;
    
    // read through the directory and filter files to an array
    
    $d = dir($directory);
    if ($d) {
    while($entry=$d->read()) {
    $ps = strpos(strtolower($entry), $filter);
    if (!($ps === false)) {
    $items[] = $entry;
    }
    }
    $d->close();
    sort($items);
    }
    
    // Add an xml header and the opening tags
    header("content-type:text/xml;charset=utf-8");
    
    echo '<?xml version="1.0" encoding="utf-8"?>';
    echo '<FlippingBook>';
    echo '<width>'.$tvWidth.'</width>';
    echo '<height>'.$tvHeight.'</height>';
    echo '<scaleContent>false</scaleContent>';
    echo '<firstPage>0</firstPage>';
    echo '<alwaysOpened> false </alwaysOpened>';
    echo '<autoFlip> 50 </autoFlip>';
    echo '<flipOnClick> true </flipOnClick>';
    echo '<staticShadowsDepth> 1 </staticShadowsDepth>';
    echo '<dynamicShadowsDepth> 2 </dynamicShadowsDepth>';
    echo '<moveSpeed> 2 </moveSpeed>';
    echo '<closeSpeed> 3 </closeSpeed>';
    echo '<flipSound>assets/media/01.mp3</flipSound>';
    echo '<pageBack> 0x1C90CB </pageBack>';
    echo '<loadOnDemand> true </loadOnDemand>';
    echo '<cachePages> true </cachePages>';
    echo '<cacheSize> 10 </cacheSize>';
    echo '<preloaderType> Progress Bar </preloaderType>';
    echo '<pages>';
    
    // now, loop through the file list in the target directory
    
    for($i=0; $i<sizeof($items); $i++) {;
    echo ' <page>'.$directory.''.$items[$i].'</page>';
    }
    
    echo '</pages>';
    echo '</FlippingBook>';
    ?>
    


    That should do it. I still have some display to work out on the resulting page but at least I have it functioning now. I am using the "SWF Object" version of the flipping book BTW.

    I have just purchase the HTML edition since it has a nicer interface and functions closer to what I want. It generates the list via a JS file but has "undocumented" XML capablity. I will post once I get that working. Once I tighten this up, I’ll add to the Wiki.
      • 4749
      • 623 Posts
      Thanks. Please let us know how it all turned out. smiley
        The MODx has you...
        Utah Web Design
        • 15871
        • 105 Posts
        It’s working here: http://printspiration.com/direct-access-partners-brochure

        Click on the magenta "View" button
          • 10071
          • 18 Posts
          Coould you add this all to the wiki.

          It’s very usefull to alle the users of modx
            • 15871
            • 105 Posts
            Sure can smiley
              • 32142
              • 19 Posts
              Quote from: killorbytes at Apr 22, 2009, 01:16 PM

              It’s working here: http://printspiration.com/direct-access-partners-brochure

              Click on the magenta "View" button

              When you click on this above link, an internal server error message is displayed like so.

              Internal Server Error

              The server encountered an internal error or misconfiguration and was unable to complete your request.

              Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

              More information about this error may be available in the server error log.

              Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

              You may want to check out what is happening there....!
                • 27983
                • 1 Posts
                Does anybody could give me instructions step by step on this.... Seems i’m missing something.

                Regards
                  • 15871
                  • 105 Posts
                  @webman
                  Thanks, It looked like it was a hiccup.

                  $Somel, what problems are you haviong?
                    • 30607
                    • 4 Posts
                    Was this ever posting to Wiki? Is there a step by step guide for how to implement something like this? Thanks.
                      • 17705
                      • 501 Posts
                      Someone used this guide?

                      I do not fully understand this section
                      "The XML file is set in MODx, template blank, text/xml filetype and named "pageflip.xml" (I am using fURLs with no file suffix BTW). I make a snippet call on that page to "generateXML" (uncached) and here is the snippet: "

                      What to do with the following code? a snippet? where is called it? we should call it any name in special?