Plone 5 and templates (easytemplate, uwosh.snippets)

Hi,

in Plone 5, is it possible to use collective.easytemplate? Or are they alternatives or equivalent built-in feature?

Thanks.

I don't think it was ever updated to work with Plone 5.

What functionality are you looking for specifically?

1 Like

What functionality are you looking for specifically?

For the site of an annual conference I'm organizing, created with Plone 4.1.6, I created some properties in the ZMI → Properties tab, such as:

  • date_event for the date,
  • fee_event for the fee,

of the event.

And, in some templated pages, the actual date and fee of the event are automatically reflected thanks to:

  • {{ context.event_date.decode('utf-8') }}
  • {{ context.fee_date.decode('utf-8') }}

Here is what I'm looking for.

Could you use TAL instead? e.g.

<span tal:content="python: context.event_date.decode('utf-8')">[event_date]</span>

Is it possible to use TAL in a document made with TinyMCE?

Because, if this requires TAL page templates, sigh, much less simple than collective.easytemplate :frowning:

I must have misunderstood then what you'd meant by "in some templated pages"

I'm pretty sure it won't work if you try to enter such TAL inside HTML with TinyMCE.

If you're a developer you could look at collective.simplewiki - it replaces certain expressions in TinyMCE-entered text - as a basis for making your own "light" version of easytemplate.

The wording "templated pages" or maybe "templated document" comes from collective.easytemplate.

Indeed: that's what I tried and that failed.

AFAICS, it doesn't serve the same purpose: "Text that is wrapped with (()) or [] is rendered as a link. The wrapped text is used to look up content items within the site, as either ID or title." In particular, it seems to not be able to render arbitrary properties.

@dbitouze easytemplate seems like a nice idea but as soon as you share the site editing with someone else is who is non technical then you give the ability to easily break your site (as I have found out).

rapido on the other hand lets you create similar templates inside your theme and then place them using diazo or mosaic into where you want it. https://pypi.python.org/pypi/rapido.plone. And it works in plone 5.

if this is not a use case for Mosaic, then I don't see the point on o having a new layout solution for Plone.

BTW, storing things on portal_properties is deprecated for Plone 5, you must use the Plone registry; you're heavily relying on acquisition and that doesn't seem to be a good idea.

Unless these properties are 'always different', why dont you just make a new content type (or add the fields to an existing content type).
This can be done TTW in Plone 5.

Then you make a custom browser view, or you can use mosaic to display those fields.

( I would make a new browser view if the layout should always be the same, if not (or if you dont know how to make one), use mosaic)

Note: You can save the mosaic layout and reuse it, and you can set the default layout of your content type to (that) mosaic layout.

.... in other words: it can all be done TTW, without any "programming".

PS: You will need to add the 'Layout' behavior to your content type.

1 Like

Too bad https://github.com/collective/uwosh.snippets hasn't been updated yet for Plone 5... that's probably your use case.

...or a fragment tile is the likelier equivalent for Plone 5 & Mosaic...although perhaps not fine grained enough

@djay Sigh... rapido is much less simple than collective.easytemplate. I am aware of the drawbacks of collective.easytemplate, especially in term of security but, anyway, it was enough for my use case (I'm the only one who is maintaining the site, which is updated only once a year).

@hvelarde [quote="hvelarde, post:9, topic:4354"]
BTW, storing things on portal_properties is deprecated for Plone 5, you must use the Plone registry; you're heavily relying on acquisition and that doesn't seem to be a good idea.
[/quote]

Thanks for the information. I'll have a look at its documentation but if you have nice pointers, please let me know.

@tkimnguyen[quote="tkimnguyen, post:11, topic:4354, full:true"]
Too bad https://github.com/collective/uwosh.snippets hasn't been updated yet for Plone 5... that's probably your use case.
[/quote]

Indeed, that's exactly what I'm looking for.

In your opinion, uwosh.snippets has better chances than collective.easytemplate to be ported to Plone 5?

Yes, but the author of snippets (Sam Schwartz) is very busy these days on other work.

I pointed out simplewiki not because it does what you want but because its underlying code could be used to create what you need.

@dbitouze rapido is not that hard and is worth the effort. Really it is just one step extra from easytemplates and you get the options of using either ZPT or simple { } style templates similar to easytemplate. The only real difference is you define a block (in your case just a single template) inside your theme and a single diazo rule to place it somewhere in your site. So the only extra is a diazo rule. But the flexibility this gives you is huge. Because your template can be inserted anywhere in the page, not just inside content. Handling insertiion inside content is also easy. You just use a tinymce paragraph or char style and use that as your marker for where the diazo rule should insert your template.

There was no mention of requiring mosaic for this use-case. It is just another option if using rapido. Instead of using diazo rules to insert templates, you can insert a tile instead. But you don't have to use it as was clear I hope from my previous comment.

snippets was updated for Plone 5. There is also a fork as starzel.snippets
with additional features.
Philip

I can understand...

Well, I had a look at a Rapido tutorial, but it involves too much features beyond my current knowledge. I'll try to have a deeper look later.

Do you mean uwosh.snippets? It is said to work with Plone 4.3+, not explicitly Plone 5.

Good news, thanks! It remains to be seen if it is easy to install from the buildout.cfg...

Ah dangit thx @pbauer I forgot to check for another branch. Indeed, we did update snippets for Plone 5 but never got around to merging the branch into master.

For now, you can do a git checkout on this branch: https://github.com/collective/uwosh.snippets/tree/p5

That work was paid for by @pbauer and his client - thank you :slight_smile: