Note that there are some explanatory texts on larger screens.

plurals
  1. POInsert images into the menu list
    primarykey
    data
    text
    <p>I'm trying to populate my menu items with an image/logo on each of the third menu list, please see example below. </p> <p><img src="https://i.stack.imgur.com/fmSML.jpg" alt="enter image description here"></p> <p>I've been using Silverstripe to populate the menu items, below is my code so far without the images. Can someone please point me to the right direction on how I go about inserting the images/logos on the third level menu?</p> <p> </p> <pre><code> // initialise plugins jQuery(function(){ jQuery('ul.sf-menu').superfish(); }); &lt;/script&gt; &lt;ul class="sf-menu"&gt; &lt;% control Menu(1) %&gt; &lt;li&gt; &lt;a href="#a"&gt;$MenuTitle&lt;/a&gt; &lt;% if Children %&gt; &lt;ul&gt;&lt;% control Children %&gt; &lt;li&gt; &lt;a href="#aa"&gt;$MenuTitle&lt;/a&gt; &lt;% if Children %&gt; &lt;ul&gt;&lt;% control Children %&gt; &lt;li&gt; &lt;a href="#aa"&gt;$MenuTitle&lt;/a&gt; &lt;/li&gt; &lt;% end_control %&gt; &lt;/ul&gt;&lt;% end_if %&gt; &lt;/li&gt; &lt;% end_control %&gt; &lt;/ul&gt;&lt;% end_if %&gt; &lt;!--&lt;li&gt; &lt;a href="#"&gt;menu item&lt;/a&gt; &lt;/li&gt;--&gt; &lt;/li&gt; &lt;!--current--&gt; &lt;% end_control %&gt;&lt;!-- &lt;li&gt; &lt;a href="#"&gt;menu item&lt;/a&gt; &lt;/li&gt; --&gt; &lt;/ul&gt; &lt;!--sf-menu--&gt; </code></pre> <p></p> <p>Thanks heaps. S:)</p> <p><strong>UPDATE</strong> below is my Page.php, and I have insert $Image.SetSize(20,20) $MenuTitle to my third level menu. However everytime i tried to insert an image through CMS, there is error coming up in CMS. Sorry i'm new to this, any help would be appreciated.</p> <pre><code>&lt;?php class Page extends SiteTree { public static $db = array( ); public static $has_one = array( 'MenuImage' =&gt; 'Image' ); function getCMSFields() { $fields = parent::getCMSFields(); $fields-&gt;addFieldToTab("Root.Content.Images", new ImageField('MenuImage','Menu image')); return $fields; } } class Page_Controller extends ContentController { public static $allowed_actions = array ( ); 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'); } } </code></pre> <p>here is the error info.</p> <p>[User Error] Couldn't run query: SELECT * FROM "Page" WHERE "ID" = 15 Table 'ss_show.page' doesn't exist POST /Show/admin/EditForm/field/MenuImage/EditFileForm</p> <p>Line 525 in C:\wamp\www\Show\sapphire\core\model\MySQLDatabase.php</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload