revolution icon indicating copy to clipboard operation
revolution copied to clipboard

Improve getChunk to allow file based and inline tpl

Open sdrenth opened this issue 7 years ago • 3 comments

Feature request

Summary

The getChunk method from pdoTools allows you to use file based and inline tpl's. So it doesn't require a modChunk reference in the database.

I think the core getChunk method should be improved to allow also file based and inline TPLs and would like to know who else would like to see this improvement into the core of MODX.

pdoTools uses a system setting for the base path of where all static elements live, the new core system setting static_elements_basepath could be used for this as well.

Examples:

'tplWrapper' => '@FILE /elements/chunks/menu/wrapper.tpl'

AND

'tplWrapper' => '@INLINE <ul>[[+wrapper]]</ul>`

Why is it needed?

We like to work file based and for performance it would be better if we can bypass the database when working file based. And also for small templates it can be a lot easier to create an inline TPL then creating a new modChunk snippet for it in the database.

In short, it makes life easier and is also faster.

Suggested solution(s)

I think the getElement method in the modParser class should be changed to also support file based and inline tpls.

What do you guys think about the idea and the suggested solution?

sdrenth avatar Dec 14 '18 15:12 sdrenth

Maybe also use Fenom from pdoTools (or another template engine) for parsing templates and chunks instead of MODx tags/output filters?

Oetzie avatar Dec 17 '18 07:12 Oetzie

@Oetzie if that is something you would like to see I suggest creating a new issue/feature request instead.

JoshuaLuckers avatar Dec 17 '18 19:12 JoshuaLuckers

I will do it.

mvoevodskiy avatar Mar 15 '19 17:03 mvoevodskiy