modxcms / revolution

MODX Revolution - Content Management Framework
https://modx.com/
GNU General Public License v2.0
1.36k stars 528 forks source link

Improve getChunk to allow file based and inline tpl #14201

Open sdrenth opened 5 years ago

sdrenth commented 5 years ago

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?

Oetzie commented 5 years ago

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

JoshuaLuckers commented 5 years ago

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

mvoevodskiy commented 5 years ago

I will do it.