Jump to:

3439 Posts in 1028 Topics by 869 members

Template Questions

SilverStripe Forums » Template Questions » Help with header

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3
Go to End
Author Topic: 4027 Views
  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Help with header Link to this post

             <div id="flashBannerMessage">
                <object height="90" width="798" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
                   <param value="$FlashBanner1.URL" name="movie"/>
                   <param value="high" name="quality"/>
                   <param value="false" name="menu"/>
                   <param value="transparent" name="wmode"/>
                   <embed height="90" width="798" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" menu="false" quality="high" wmode="transparent" src="$FlashBanner1.URL"/>
                </object>               
             </div>

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Help with header Link to this post

    that's taken from a site I am using flash banners in. All there is in the CMS is a FileIFrameField called 'FlashBanner1' which is used to store the SWF file.

  • Webdoc
    Avatar
    Community Member
    332 Posts

    Re: Help with header Link to this post

    <?php

    class Page extends SiteTree {
       
       public static $db = array(
       );
       
       public static $has_one = array(
       );
       
    }

    class Page_Controller extends ContentController {
       
       public function init() {
          parent::init();

          // Note: you should use SS template require tags inside your templates
          // instead of putting Requirements calls here. However these are
          // included so that our older themes still work
          Requirements::themedCSS("layout");
          Requirements::themedCSS("typography");
          Requirements::themedCSS("form");
       }
       
       /**
        * Site search form
        */
       function SearchForm() {
          $searchText = isset($_REQUEST['Search']) ? $_REQUEST['Search'] : 'Search';
          $fields = new FieldSet(
           new TextField("Search", "", $searchText)
           );
          $actions = new FieldSet(
           new FormAction('results', 'Search')
           );

           return new SearchForm($this, "SearchForm", $fields, $actions);
       }
       
       /**
        * Process and render search results
        */
       function results($data, $form){
           $data = array(
           'Results' => $form->getResults(),
           'Query' => $form->getSearchQuery(),
           'Title' => 'Search Results'
           );

           return $this->customise($data)->renderWith(array('Page_results', 'Page'));
       }
       
    }

    ?>

    this is my page.php so where and what i need to add here

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Help with header Link to this post

    class Page extends SiteTree {
       
       public static $db = array(
       );
       
       public static $has_one = array(
          'FlashBanner1' => 'File'
       );
       
       function getCMSFields() {
          $fields = parent::getCMSFields();
          
          $fields->addFieldToTab('Root.Content.Main', new FileIFrameField('FlashBanner1'), 'Content');   

       return $fields;   
       }   
    }
    .
    .
    .

    then in your template use the flash embed code from above

  • Webdoc
    Avatar
    Community Member
    332 Posts

    Re: Help with header Link to this post

    is there needed to have some module more because i cant find place in banner tab to use file or something

    thats what i have after flush

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Help with header Link to this post

    sorry, I had an error in the previous code, if you want the file field to appear above the content field change the line to this:

    $fields->addFieldToTab('Root.Content.Main', new FileIFrameField('FlashBanner1'), 'Content');

    or if you want it to appear in the banner tab change it to this:

    $fields->addFieldToTab('Root.Content.Banner', new FileIFrameField('FlashBanner1'));

  • Webdoc
    Avatar
    Community Member
    332 Posts

    Re: Help with header Link to this post

    Tnx a lot it worked

  • steve_nyhof
    Avatar
    Community Member
    224 Posts

    Re: Help with header Link to this post

    Can you please continue with your banner image - it seems what you are saying is that I can have an added tab so I can upload and change out the banner image ???

    4027 Views
Page: 1 2 3
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.