Moodle multi-select: linking over items -
Moodle multi-select: linking over items -
i'm trying utilize multi-select form element in moodle database generate list of tags. these tags link relevant search page displaying filtered results.
the next template code works singly tagged items, fails items multiple tags:
<a href='/view.php?mode=list&filter=[[tags]]'>[[tags]]</a>
is there way loop on items in multi-select? like:
[[for tag in tags]] <a href='/view.php?mode=list&filter=[[tag]]'>[[tag]]</a> [[/for]]
i'm not there easy way using method above. though, i've hacked javascript accomplish same thing:
function init() { var tags = document.getelementsbyclassname('tags'); (var i=0; i<tags.length; i++) { tags[i].innerhtml = tags[i].innerhtml.replace(/\w[\w\s]+?(?=<br>)/g, function(n) { homecoming "<a href='view.php?d=16&mode=list&perpage=10&filter=1&f_81%5b%5d="+ escape(n) + "'>" + n + "</a>"; }); } }; window.onload = init;
moodle
Comments
Post a Comment