Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static template file not updated (/sync) when changed though a clear cache is done #14674

Closed
intersel opened this issue Aug 13, 2019 · 4 comments

Comments

@intersel
Copy link
Contributor

commented Aug 13, 2019

Bug report

Summary

When a template is static, if the static file of the template is changed with an external editor, then we do a clear cache, there is no sync of the template, changes are not taken into account...

Step to reproduce

  1. create a template with a static file
  2. create a resource using the template
  3. change and save the static template file with an editor outside modx
  4. clear cache in the manager (or remove the core/cache content)
  5. view the resource

Observed behavior

Nothing has changed or was updated... the resource parsed with the old template.

Expected behavior

The view is updated according to the changes made in the template static file

To have the template updated, it is needed to go to the manager and edit the template... that reloads the static file and seems to sync at that moment.
then save template or clear cache...
Perhaps is there a simpler way to have the template updated in modx from its static file?

Environment

MODX 2.7.1, apache 2.4.25 (Debian 9.8), 10.1.38-MariaDB-0+deb9u1, firefox/chrome

@JoshuaLuckers

This comment has been minimized.

Copy link
Collaborator

commented Aug 14, 2019

Thanks for taking time to report this issue. Unfortunately I'm unable to reproduce this bug.

What is the Media Source for the template?

@intersel

This comment has been minimized.

Copy link
Contributor Author

commented Aug 15, 2019

args... so it sounds to be a environment problem... but what... I've got no pb with static chunks or snippets...

To answer your question:

media source is set to "Filesystem"
static file name is like core/components/website/templates/page/page-section/category/myfile.template.html

I've just done a new test with another template with static file and it's working fine with it :-s
I have to go deeper in my analyse... as I've got one wrong and the other ok :(

The difference is that the one that does not work is parsed through the API... I mean I get the content of the template through the API

$template = $modx->getObject('modTemplate',$tempId); $output = $template->get('content');

@JoshuaLuckers

This comment has been minimized.

Copy link
Collaborator

commented Aug 15, 2019

The difference is that the one that does not work is parsed through the API... I mean I get the content of the template through the API

$template = $modx->getObject('modTemplate',$tempId); $output = $template->get('content');

This will fetch the template from the database (not from the file). I believe $template->getContent() will get the unparsed content from the static file.

@intersel

This comment has been minimized.

Copy link
Contributor Author

commented Aug 15, 2019

great! and that's make perfect sense...
Thanks for your expertise... that's working now :)

@intersel intersel closed this Aug 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.