We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3617
    • 7 Posts
    Hi guys,

    Congrats on a truly wonderful cms!

    I have managed to get a simple site up and running using the doco provided. But i have I am stuck on one thing. I have a flash banner at the top of my page which is hard coded into the template. However, i would like to make this changeable (ie, via TV). Can this be done? If so, then how?

    Cheers,
    Trav.


    Web Server:
    ----------------
    PHP version: 4.4.1
    MySQL version: 4.1.14-standard
    Linux: 2.6.9-22.0.2.ELsmp

    Browser/Client:
    -----------------
    Firefox 1.5.0.1 & IE 6
    Windows XP
    • First of all, welcome to the forums Blu.

      Now, the way I would do it (this is off the top of my head):

      1. Create a small snippet to output the necessary HTML with a parameter to set which file is to be loaded.
      2. Create a TV with an @INHERIT binding so you can load different SWF with the snippet, but default to a standard header if required.

      Now, I don’t use much flash but I think the snippet would run along the lines of (might need tweaking wink ):

      $file = (isset($file)) ? $file : ''; // insert a default path to the swf file between the ''
      $width = (isset($width)) ? $width : 468; //default width is 468 px
      $height = (isset($height)) ? $height : 60; //default height is 60 px
      $output='';
      
      $output.= '
      <object type="application/x-shockwave-flash" data="'.$file.'" width="'.$width.'" height="'.$height.'">
      <param name="movie" value="'.$file.'" />
      </object>
      ';
      
      return $output;
      


      You can use this snippet using the following in your page (if the snippet is called flash):

      [!flash? &file=`assets/flash/file.swf` &height=`468` &width=`60` !]


      The TV would just use the snippet call but would allow for different files to be loaded as and when required.

      Please note, I haven’t tested this (I’ve typed it straight into the post) but should hopefully give you a start. smiley

      Hope that helps, Garry

      edit: i updated my original snippet code to a xhtml-compliant method of calling the swf file.
        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 28471
        • 48 Posts
        Also, i uploaded a flash banner rotator here,

        http://modxcms.com/forums/index.php/topic,2885.0.html

        It allows you to have random flash banners shown.


          • 3617
          • 7 Posts
          Thanks Garry, I will digest this over the next couple of days.

          Cheers,
          Trav.
            • 3617
            • 7 Posts
            Thanks stempy, your solution worked perfectly!

            Cheers,
            Trav.