Importing HTML in Definitions with !CDATA

Importing HTML in Definitions with !CDATA

John Provasnik發表於
Number of replies: 3
Particularly helpful Moodlers的相片 Testers的相片

Hi -- I'm using Moodle 4.1 and am looking for guidance on "correctly" importing HTML into a definition following this Glossary FAQ tidbit:

  • HTML and XHTML tags written within CONCEPT or DEFINITION elements will fail on import, showing "Array" instead of the desired content. To remedy this, try writing the (X)HTML tags within <![CDATA[ ]]> markup.
Because Glossary pop up entries are soooo skinny and become so tall if there's a lot of content in the definition, I'm trying to import some HTML to better structure my definition so it looks more 'readable' when in the pop up. 

When I wrap my HTML code with <![CDATA[ ... ]]>, I see exactly that HTML as my glossary entry Definition: 


This is how I had it in my XML file:




評比平均分數: -
In reply to John Provasnik

Re: Importing HTML in Definitions with !CDATA

Eoin Campbell發表於
Core developers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片
You’re double-escaping the HTML by using entities inside the CDATA section, just use standard markup instead.
評比平均分數:Useful (1)
In reply to Eoin Campbell

Re: Importing HTML in Definitions with !CDATA

John Provasnik發表於
Particularly helpful Moodlers的相片 Testers的相片
Thanks -- I've successfully done that now (and had to also get rid of the line breaks)
In reply to John Provasnik

Importing HTML in Definitions with !CDATA

John Provasnik發表於
Particularly helpful Moodlers的相片 Testers的相片
I realized my issue -- I needed to employ the =CLEAN() formula in excel on my Definition column to remove the line breaks -- I've gotten it to work now.