Snippet in external file is ignored

Hi, in modx 3.0.3 I have snippet in external file and switch STATIC is enabled.
But modx is still using snippet in window below.
I also disabled using cache file for snippet, but it is always created anyway.
why?

Even static snippets have a corresponding entry in the database. But changes to the file are automatically synchronized (and vice versa). This is just how it works in MODX.

So what is the solution?

Solution for what?

What exactly are you trying to achieve?

I probably dont understand your answer. I mean why statis switch in modx is not working and modx always use snippet entered in manager and not linked in external file…
If I use

<?php
return include ("path to php")

it work ok even without caching the snippet

There should be no difference between the code in the external file and the code “in the manager” (that comes from the database entry in modx_site_snippets).

When you change the code in the external file, the content of the database entry should get updated automatically.
When you change the code in the manager, the content of the external file should get updated.

Are you sure the path to the file is correct on the Create/Edit snippet panel? If it’s not, the synchronization can’t work. If you make a change in the snippet and save it, does the file change?

Also check permisions, if you are using an external editor with the file, there’s a chance that your file permissions have changed, and MODX can’t actually get those, so it won’t get updated on the DB or rendered

1 Like