I’m just figuring out how the "Import HTML’ command
in Modx works. It looks like Modx grabs the stuff between
the <body></body> tags when it does an import.
My question is what happens to any javascript functions
that are defined between the <header></header> tags?
What does Modx do with those and anything else between
those tags?
I can just hear someone advising me to put those javascript
functions into a file.
p.s. that’s a neat little trick that Modx does by adding "_base_href"
to <img src= > tags, so that I only need to copy the image directories
into the root of the document tree. It saves me from going around
and changing the image path in every file.
-
☆ A M B ☆
- 24,524 Posts
Everything between other than the <body> content is expected to be in your template. You can make snippets or TVs for pages that need javascript code added and use the $modx->regClientScript and its sibling API functions to insert them as needed.