Hi,
I just try to include jQuery in a CMP. What is the correct way to do this?
Currently I tried this in MyHomeManagerController of my CMP:
public function loadCustomCssJs() {
// load libraries
$this->addJavascript($this->goodnews->config['jsUrl'].'mgr/jquery/jquery-1.9.1.min.js');
$this->addJavascript($this->goodnews->config['jsUrl'].'mgr/jquery/plugins.js');
....
But this doesn't work. It seems MODx tries to minify the added JS code.
Thanks for your help,
Martin
[ed. note: gadgetto last edited this post 13 years, 7 months ago.]
-
☆ A M B ☆
- 24,524 Posts
However, you don't have to use ExtJS in your Custom Manager Pages - you can use plain HTML, or another JS framework, if you like. If you do decide to use another JS framework, MODx recommends that you not set "Load Headers" to true on the modAction, since this will load the ExtJS scripts. You'll need to create your own header file and output that with your normal output.
Quote from: sottwell at Feb 18, 2013, 07:20 AMHowever, you don't have to use ExtJS in your Custom Manager Pages - you can use plain HTML, or another JS framework, if you like. If you do decide to use another JS framework, MODx recommends that you not set "Load Headers" to true on the modAction, since this will load the ExtJS scripts. You'll need to create your own header file and output that with your normal output.
Thanks for the hint Susan!
You might try $modx->regClientStartupScript(). That will work in the front-end, I don't know if it's correct for a CMP.