Question

I'm designing a page in moodle (arrg), and I need to escape the url so moodle wouldn't recognise it as a url. My code:

<td style="background-image: url('http://example.com/pluginfile.php/788/mod_forum/intro/header_start.jpg');>

Moodle recognised the "link" and so wraps it with an <a> tag

<td style="background-image: url('&lt;a href=" http:="" example.com="" pluginfile.php="" 788="" mod_forum="" intro="" header_start.jpg'"="" class="_blanktarget">http://example.com/pluginfile.php/788/mod_forum/intro/header_start.jpg'); width: 55px; height: 50px;"&gt;

Could you think of any possible way to get around this? I thought maybe something like:

url('ht'+'tp://example.com/pluginfile.php/788/mod_forum/intro/header_start.jpg');

But I couldn't find anything about url concatenation in css.

Was it helpful?

Solution

According to the documentation, you should be able to disable the auto-linking feature but wrapping the section where it shouldn't occur with ... , so in your case:

<nolink>
<td  style="background-image: url('http://example.com/blah.jpg');">
</nolink>

Or, you could just add a style block above the relevant code and uses classes or ids, assuming that moodle knows to skip over those elements.

Also, try changing your markup to:

<td  style="background-image: url(http://example.com/blah.jpg);">

it's possible that the single quotes inside the double quotes is throwing off any "skip checking attributes" type filter. And your example code doesn't have the style attribute close quotes, in case that's not a typo.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top