After writing my post about having fun with experience manager last year, I think it is time for a small update. This time I’ll keep it short, but we will have even more fun with XPM!
I explained the usage of a jQuery plugin script that could detect if you were inside XPM, so that your additional elements would only be shown in there. At the time I was convinced that the code I used was the best solution. But now I have an update, a bit more technically advanced, but still not perfect I have to add. Instead of just checking if the page is loaded in an iframe (which is what I used to do, assuming that means you are inside XPM), I now check for the availability of Tridion objects. This can only be done after the page is finished loading and the XPM bootstrap script has executed (so I wait 5 seconds after page load before checking). So now you can replace the jQuery plugin script from my previous post with this one:
Also good to mention is that with the release of SDL Tridion 2013 SP1 we now have new functions for DWT Templates to mark fields. These make it possible to have more control over what you want to edit. For instance editing a background image, whichÂ is impossible to accomplish using
@@RenderComponentField("image")@@. But using the following in your DWT TBB, it will work: