How to customize the body tag for TAL in plone main_template equivalent to "ondragstart="false"?

302 views Asked by At

I wish to customize the main_template of plone 4.1 to prevent mouse selection and drag. Don't know where exactly and how to do it in the body tag. Also need a simple and quick reference for learning TAL, TALES, METAL. Something for beginners. Please guide. I wish to prevent copy/paste form the browser. I have customized it for the file preview but unable to do the same for the main_template.

2

There are 2 answers

3
Martijn Pieters On

If you are adding a simple ondragstart="false" attribute, you don't need any knowledge of TAL, TALES or METAL.

TAL is a XML-aware templating language, it uses namespaces and XML attributes to 'blend in' into the template structure. As such, you can add extra attributes to tags outside of the TAL-specific attributes.

Simply customize the main_template file and add the attribute to the body tag:

<body ondragstart="false" class="" tal:attributes="..." />

If you still want to read up on TAL, TALES and METAL, you can read the Zope 2 book, chapter 10: Using Zope Page Templates, chapter 13: Advanced Page Templates and appendix C: Zope Page Templates Reference.

0
djay On

The simplest way to customize the body tag is to install plone.app.theming. It is easier to understand, can be done through the web and is more likely to remain compatible through upgrades. It is compatible with Plone 4.1 and included in 4.3.