Adding images into Promote Courses on Front page

Adding images into Promote Courses on Front page

by Narit B -
Number of replies: 10

Hi 

I'm using Moodle 3.3.4 with eGuru Theme


How can i adding images into Promote Course on Front page?  

or others Free theme can do like this  please advice. 




Thank you 

Average of ratings: -
In reply to Narit B

Re: Adding images into Promote Courses on Front page

by Jean-Roch Meurisse -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi,

In course "Edit settings" page, you can add a course image in the "Description" form section. 

Hope it helps!

Average of ratings: Useful (1)
In reply to Jean-Roch Meurisse

Re: Adding images into Promote Courses on Front page

by Narit B -

Hi Jean-Roch Meurisse

Thank you for your answer, i already uploaded image into the course summary file in edit course setting.

It's work and help me to do that.


Note: Is it possible if i want to do mouse over (change picture or text)?


Thank you once again.



In reply to Narit B

Re: Adding images into Promote Courses on Front page

by Jean-Roch Meurisse -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi again,

For that you'll have to make code modifications, that is override/change promoted_courses() function in course_renderer.php file. You'll thus be able to add a "title" html attribute to the course image to display some text.

If you want to change the image on mouse hover, you'll have to add some javascript

Hope it helps

In reply to Jean-Roch Meurisse

Re: Adding images into Promote Courses on Front page

by Narit B -

Hi Jean-Roch Meurisse,

Thank you for prompting my question, i will try to explore more about code or javascript modification.

May i have a some other question for Eguru theme, 

- Is it possible to have a hyperlink in Marketing Spot (click link on Picture or Topic or some wording in contents)  


- For the Promote course, is it possible to change to Course Categories instead  



Thank you once again and advance.


  


In reply to Narit B

Re: Adding images into Promote Courses on Front page

by Jean-Roch Meurisse -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi,

Again, to add links to marketing spots, you'll have to dig into code.

  • In theme settings, add a setting to each marketing spot to define the target link
  • In marketingspots.php surround the "i" tag with an "a" tag to add the link to the target.

IMHO, it would be better for you to propose this feature to theme developers.

As for replacing courses with categories in promoted course block, I am not sure of what you really want to do. Do you want to display the full categories list or to display a selected list of categories? If you want all categories, you can do that simply in administration by disabling promoted courses block in eguru settings and add the list of categories to home page in front page settings. If you want a selected list, you'll have again to change the code in promoted_courses() function (course_renderer.php)

Hope it helps

Average of ratings: Useful (1)
In reply to Jean-Roch Meurisse

Re: Adding images into Promote Courses on Front page

by Narit B -

Hi Jean-Roch Meurisse,

Again, thank you for your replied.

Yes, i will explore more about the coding to marketing spots meaning i need to edit the code in marketingspots.php right? Do you any sample line coding about add the link to the target?

 For the courses categories, usually i only to display a selected list of categories. so i will try  to explore more in promoted_courses() function (course_renderer.php) 


Thank you   

In reply to Narit B

Re: Adding images into Promote Courses on Front page

by Jean-Roch Meurisse -
Picture of Core developers Picture of Plugin developers Picture of Testers

To add a link to marketing spots, as I told you before, you have to add a setting to each marketing spot to define the target link in settings.php (Do not forget to add new lang strings to your lang/en/theme_eguru.php file and bump up theme version number to register new lang strings.)

// Marketing Spot 1 Link.
$name = 'theme_eguru/mspot1link';
$title = get_string('marketingspot', 'theme_eguru').' 1 - '.get_string('link', 'theme_eguru');
$description = get_string('mspotlinkdesc', 'theme_eguru');
$setting = new admin_setting_configtext($name, $title, $description, '');
$temp->add($setting);

Repeat that step for all marketing spots.

In marketingspots.php you have to load that setting in the loop generating html for each marketing spot, thus

$msplink = theme_eguru_get_setting('mspot'.$i.'link') after line 84

You will then just have to surround the 'i' tag with an 'a' tag with $msplink as href.

Good luck


Average of ratings: Useful (1)
In reply to Jean-Roch Meurisse

Re: Adding images into Promote Courses on Front page

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Or don't bump up the version number but do a purge all caches and avoid a potential version number issue between your version and their version.

In reply to Jean-Roch Meurisse

Re: Adding images into Promote Courses on Front page

by Narit B -

Hi Jean-Roch Meurisse

Big thanks again for advised and to be honest i'm not a PHP programming person but i need to learn more about this coding.


Thank you