LMSouq
moodle-core Open

Adding an image from within a child theme on Moodle 3.11

DR
Droopy
1 month ago
3 views
Problem Description
So, I'm new to Moodle and I'm creating a custom theme (child theme of Boost). I'm a attempting to insert an image from the pix directory into the footer template - however I can't seem to get it to output any paths. I've tried following the [Moodle Docs](https://docs.moodle.org/dev/Using_images_in_a_theme#Using_your_images_within_your_layout_files) - creating a directory mytheme/layout/footer.php and adding: ``` $templatecontext = [ 'imageone' => $OUTPUT->image_url('mylogo', 'theme'), ]; echo $OUTPUT->render_from_template('theme_mytheme/footer', $templatecontext); ``` then including the following in my mytheme/templates/theme_boost/footer.mustache: ``` <img src="{{{imageone}}}" alt="Please give your image alt text or set the role to presentation" width="50" height="50"> ``` However, all I get is the alt text and blank src. I assume I'm doing something silly - but I'm not familiar enough with the Moodle context/output/renderers etc. to troubleshoot much further than I already have. And the documentation is not the greatest! Thanks for any pointers!

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base