Using Placeholders in Language Customization...

Using Placeholders in Language Customization...

by Mike Wilday -
Number of replies: 7

I need some help figuring out the correct string I need to use to call the Course Full Name in a specfic string. 

When I open the language pack and edit the local customisation string I want I am trying to use the following text/placeholder... 
{$a->coursefullname}

I am trying to display the course full name. What am I doing wrong? Help please!

Average of ratings: -
In reply to Mike Wilday

Re: Using Placeholders in Language Customization...

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
Mike, strings have access only to those values that are explicitly passed in the get_string() call. Effectively this means that unless the original string has {$a->coursefullname}, you can't use such (new) placeholder in the customized version of the string.
Average of ratings: Useful (1)
In reply to David Mudrák

Re: Using Placeholders in Language Customization...

by Mike Wilday -

So how can I know what strings are being called? Our moodle site is currently being hosted by moodlerooms and I am not sure that I have access to see that information.

In reply to David Mudrák

Re: Using Placeholders in Language Customization...

by Peter Mott -

 Ah. Now I am running a course for practising doctors. Some of them are very aware of their status and sending them an email  "Hi {$a-firstname}" would often not be well-received, especially give what they pay for the course! So I need to start "Dear Dr. {$a->lastname}" but apparently I cannot do that. Can you tell me where the code is that handles sending these messages?  Maybe a feature request should be added?

-- Peter

In reply to Peter Mott

Re: Using Placeholders in Language Customization...

by Robert Brenstein -
I am guessing that you are referring to emails sent in the registration process. See https://moodle.org/mod/forum/discuss.php?d=235012 for ideas.
In reply to Robert Brenstein

Re: Using Placeholders in Language Customization...

by Peter Mott -

@Robert Benstein . Yes that's right. I was replying to David Mudrák but the post did not turn up where I expected. Anyway I will take a look. Many thanks. 

--Peter

 

In reply to Mike Wilday

Re: Using Placeholders in Language Customization...

by Mike Wilday -

Essentially what I am trying to accomplish is to change the "Topic" word at the top of each moodle course page to the Course Full Name. Is this possible without editing the .php as I have no access to that as our moodle server is being hosted by moodlerooms. 

In reply to Mike Wilday

Re: Using Placeholders in Language Customization...

by Robert Brenstein -
Unfortunately, you need to change that one line of PHP code which calls your string to include passing the variable which holds the full course name.