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

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

av Mary Evans -
Antall svar: 3
Bilde av Core developers Bilde av Documentation writers Bilde av Peer reviewers Bilde av Plugin developers Bilde av 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

Gjennomsnittlig vurdering: -
Som svar til Mary Evans

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

av Gareth J Barnard -
Bilde av Core developers Bilde av Particularly helpful Moodlers Bilde av 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

Gjennomsnittlig vurdering:Useful (1)
Som svar til Gareth J Barnard

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

av Mary Evans -
Bilde av Core developers Bilde av Documentation writers Bilde av Peer reviewers Bilde av Plugin developers Bilde av 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