Thursday, March 11, 2010

The Layout Template "Edit HTML" Wizard And "Expand Widget Templates"

Sometimes, when we're working on a problem that requires editing the HTML in a layout template, we need to understand the need to expand (or not expand) the widget templates. This month, for instance, we have hundreds of blogs containing malicious code, unknowingly installed by the blog owners. The malicious code must be removed, but the installed code aggressively prevents use of the "Page Elements" wizard, and the "Remove" button.

Note: The selection to "Expand Widget Templates" has been replaced, by folded lines of code, which are now expanded selectively.

When the "Page Elements" wizard can't be used to remove code, you have to use the "Edit HTML" wizard, and remove the individual gadget entries, one by one.

Here's what the unexpanded line entry for one problem gadget looks like
<div class='widget Gadget' id='Gadget1' />

That's easy enough to find - and to delete.

Here's what that entry looks like, expanded. To examine, and maybe modify, the gadget code, you have to select "Expand Widget Templates". To simply remove an entire gadget, on the other hand, do not select "Expand Widget Templates".
<div class='widget Gadget' id='Gadget1'>
<h2 class='title'>Maukie - the virtual cat</h2>

<div class='widget-content'>
<script type="text/javascript">
if (!window.gadgets || !gadgets.rpc) {
document.write('<script type="text/javascript"' +


'src="http://www.gmodules.com/gadgets/js/rpc.js?v\x3d9261b340ef5af1e5faca55914670c7\x26container\x3dblogger\x26debug\x3d0\x26c\x3d1">'

+
'</scr' + 'ipt>');
}
</script>

...


</span>
</span>
<div class='clear'></div>
</div>


OK, the example above was heavily excerpted. If I was to include the entire code set for this one gadget, I would risk this post (my main page display) being subject to segmentation, caused by Auto Pagination. So, I gutted 95% of the interior code. But, you should get the idea.

The point is, when you need to remove malicious code, do not select "Expand Widget Templates". Then, find (as an example)
<div class='widget Gadget' id='Gadget1' />

and delete that one line.

Problem solved.

And next time, be more selective what gadgets you install in your blog.

>> Top

Elm0D

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

0 comments:

Post a Comment

Navigate» Become author for this Blog

Manual Categories