Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Template Questions /

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

Help with header


Go to End


24 Posts   5229 Views

Avatar
Carbon Crayon

Community Member, 598 Posts

6 October 2009 at 8:06am

			<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>

Avatar
Carbon Crayon

Community Member, 598 Posts

6 October 2009 at 8:07am

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.

Avatar
Webdoc

Community Member, 349 Posts

6 October 2009 at 8:18am

<?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

Avatar
Carbon Crayon

Community Member, 598 Posts

6 October 2009 at 8:26am

Edited: 06/10/2009 8:26am

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

Avatar
Webdoc

Community Member, 349 Posts

6 October 2009 at 8:50am

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

Avatar
Carbon Crayon

Community Member, 598 Posts

6 October 2009 at 9:02am

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'));    

Avatar
Webdoc

Community Member, 349 Posts

6 October 2009 at 9:48am

Tnx a lot it worked

Avatar
steve_nyhof

Community Member, 224 Posts

28 October 2009 at 1:44pm

Edited: 28/10/2009 1:52pm

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 ???