Adding field from HomePage to other pages

Silverstripe Version:

Is it possible add 1 field from HomePage to other pages? I want show a content in marquee in all pages: https://banskobystrickalatka.sk/

HomePage.php:

private static $db = [		
		'Info' => 'HTMLText'
 ];

public function getCMSFields()   {
	  
		$fields = parent::getCMSFields();  	  
                $fields->addFieldToTab('Root.Main', HTMLEditorField::create('Info','Info pásik'),'Content');	

    return $fields;
}

Page.ss (for all page - Include header, etc.)?

<div class="infoBar">
		<div class="container">
			<marquee behavior="scroll" direction="left" onmouseover="this.stop();" onmouseout="this.start();">
					$HomePage.$Info
			</marquee>
		</div>
	</div>

You can access a specific page by its URL segment, so in your case you could use:

<% with $Page('home') %>
   $Info
<% end_with %>
2 Likes

Great! it works… :+1: :+1: