I’ve created some snippet, but I don’t know the folder location of this snippet.
Where is the location of that snippet file? I want to include some of this file, but I don’t know the path.
thanks before
-
☆ A M B ☆
- 24,524 Posts
Snippets are stored in the database, in the site_snippets table. A copy is also stored in the assets/cache/siteCache.idx.php file. But for creating and editing snippets, you use the manager, in Resources -> Manage Resources, the Snippets tab. You can create a new snippet or edit an existing one from the list.
A snippet itself can be as simple as a single line to include an external .php file. The location of the .php file is up to you. Normally such external files are stored in the assets/snippets/your-snippet-name folder, but you can put them wherever you want as long as the correct path is specified in the include line in the snippet.
I’ve created a snippet, but my snippet folder didn’t created in the snippets folder, and I can’t find my snippet PHP files
Snippets are stored in the database, not in files. If you wish to have them in files you will have to create these files manually.
Oh I see. Thanks for the info.
sorry to ask again.
I’ve created this file manually, then how I call this files in template? since I didn’t create the snippet tag, that can be called in the template.
There is only one.
As far as MODx is concerned there is only one kind of snippet - the database type, the kind that you define through the manager. Files are just files, not snippets. This is a workaround that enables using the file’s contents for your snippet.
What you should have is:
- A file with the php code inside it.
- A snippet with an statement including the file’s contents
Now you can use the snippet in MODx just like you would use any other snippet.