in Education by
I'm trying to populate my menu items with an image/logo on each of the third menu list, please see example below. 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? // initialise plugins jQuery(function(){ jQuery('ul.sf-menu').superfish(); });
    <% control Menu(1) %>
  • $MenuTitle <% if Children %>
      <% control Children %>
    • $MenuTitle <% if Children %>
        <% control Children %>
      • $MenuTitle
      • <% end_control %>
      <% end_if %>
    • <% end_control %>
    <% end_if %> <!--<li> menu item
  • --> <!--current--> <% end_control %><!-- <li> menu item -->
<!--sf-menu--> Thanks heaps. S:) UPDATE 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. <?php class Page extends SiteTree { public static $db = array( ); public static $has_one = array( 'MenuImage' => 'Image' ); function getCMSFields() { $fields = parent::getCMSFields(); $fields->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'); } } here is the error info. [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 Line 525 in C:\wamp\www\Show\sapphire\core\model\MySQLDatabase.php JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Assuming you have an image on your page object, you can render it in your template by doing something like this: $MyImage.SetWidth(50) $MenuTitle "$MyImage.SetWidth(50)" will output an image tag with an image resized to 50px wide. See the SilverStripe image reference for more info.

Related questions

0 votes
    How to insert different types of slides and images into the slides and apply animation and transition on them Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    Write a program in python to insert ten friends name in a list, then print 3rd, 5th and 9th value from the list (using data structure) Select the correct answer from above options...
asked Dec 14, 2021 in Education by JackTerrance
0 votes
    How will you insert an object at given index in a list?...
asked Nov 26, 2020 in Technology by JackTerrance
0 votes
    I'm trying to put several images together into one big image, and am looking for an algorithm which ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I'm trying to put several images together into one big image, and am looking for an algorithm which ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    Before... (question deleted) I'm trying to make a runnable jar from a Swing project. I add some ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 20, 2022 in Education by JackTerrance
+1 vote
    __________ takes in raw data and transforms into charts, graphs and images that can flawlessly explain numbers in a marvelous way to gain insights from it...
asked Oct 11, 2020 in Education by anonymous
0 votes
    I'm using beautifulsoup and selenium to scrape some data in python. Here is my code which I run ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I'm using beautifulsoup and selenium to scrape some data in python. Here is my code which I run ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    ________ allows you to insert debugging code into a function a specific places (a) debug() (b) trace() ( ... Debugging of R Programming Select the correct answer from above options...
asked Feb 16, 2022 in Education by JackTerrance
0 votes
    I've met an unknown error while inserting data into the database. The LogCat had been display "unable to insert data", ... I placed into my onClick(), it failed. onStart():...
asked Feb 9, 2022 in Education by JackTerrance
0 votes
    I've met an unknown error while inserting data into the database. The LogCat had been display "unable to insert data", ... I placed into my onClick(), it failed. onStart():...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    How do I do a SELECT * INTO [temp table] FROM [stored procedure]? Not FROM [Table] and without defining [ ... not supply any columns. Select the correct answer from above options...
asked Jan 28, 2022 in Education by JackTerrance
0 votes
    I am trying to INSERT INTO a table using the input from another table. Although this is entirely feasible ... the underlying database? Select the correct answer from above options...
asked Jan 26, 2022 in Education by JackTerrance
0 votes
    Select right statement to insert values in the table CUSTOMERS * a) INSERT VALUES INTO CUSTOMERS . b) INSERT INTO ... NONE OF THE ABOV Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
...