How do you call a user name or ID using mustache?

How do you call a user name or ID using mustache?

by Mary Evans -
Number of replies: 3
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

I guess it must be possible, but I just can't figure out for example:

How would I have to decode this

<?php echo $CFG->wwwroot.'/user/view.php?id='.$USER->id.'&amp;course='.$COURSE->id;?>

so that I can get it to work in a template that I'm trying to make in a Boost version of Aardvark Postitnote?

Strangely enough I have got the dropdown Show/Hide toggle to work, which was a doddle as it's just JS & HTML.

But what I am trying to do with the following is harder and I can't seem to find anything that explains it in the Moodle Documentation about creating a Template, either that or I am searching using the wrong words!

<?php echo $CFG->wwwroot.'/user/view.php?id='.$USER->id.'&amp;course='.$COURSE->id;?>

Thanks in advance

Cheers

Mary

Average of ratings: -
In reply to Mary Evans

Re: How do you call a user name or ID using mustache?

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

Hi Mary,

Many ways to do this:

  • Add the values to different parts of the template data and reform in the template.
  • Create a moodle_url object with param() calls and output (out()) that as one bit of template data then use three bracket {{{myurl}}} substitution within a 'href' or whatever you're using.

G

Average of ratings: Useful (1)
In reply to Gareth J Barnard

Re: How do you call a user name or ID using mustache?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Ah! That simple...LOL

I'll give it a go.

Thanks Gareth

M

In reply to Gareth J Barnard

Re: How do you call a user name or ID using mustache?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Gareth,

Thanks for pointers for this...I managed to get it to work. Took me ages but finally got there.

I was a bit rusty and had forgotten lots of things about PHP and such and made some silly errors.

I ended up following Urs Hunklers CleanM theme...which I found very helpful and relatively easy to understand.

Cheers

Mary