17488 Posts in 4473 Topics by 1978 members
|Go to End|
6 November 2008 at 6:23am
I want to use images instead of text in main menu.
class Page extends SiteTree
static $db = array(
static $has_one = array(
'MenuImg' => 'Image'
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Images", new ImageField('MenuImg','Menu image'));
than attach my image for menu.
but i can't get how to use it in my template.
i use <% control Menu(1) %> to get info about menu ($Title, $Content) but there is no $MenuImg there.
how i can use $MenuImg in my templates?
6 November 2008 at 9:31am Last edited: 6 November 2008 9:31am
So you've put $MenuImg in your template? It should work eg:
<% control Menu(1) %>
<% if MenuImg %>
<% else %>
<!-- debug: menu image missing for page $Title -->
<% end_if %>
<% end_control %>
6 November 2008 at 9:31pm
thanks, it helps)
|Go to Top|