Add helper via plugin - cakephp-3.0

I created a helper what adds a css class to links which are pointing to the current url. I want to create a plugin with the same functionality.
I am almost done, as if I use the following code in my /src/View/AppView.php file than everything is working.
$this->loadHelper('Html', ['className' => 'MenuLink.MenuLink']);
What I want is to let the plugin load the helper. I tried to create an AppView.php in my plugin's View folder but it seems to be ignored.
How to load a helper via a plugin?

Related

How to pass this data in ReactJS?

I am working with ReactJS and in a carousel design of Bootstrap, I found this line:
<div class="tns-carousel-inner" data-carousel-options="{"mode": "gallery", "responsive": {"0":{"nav":true, "controls": false},"992":{"nav":false, "controls": true}}}">
I am passing the value of "data-carousel-options" as it is in the above line but it is not working. However, it works fine in plain HTML. I am not sure how I can use this line in ReactJS.
Looks like the problem was not passing the data. The data can be passed exactly in the same way as it is in the question. The problem was, the javascript file which is responsible to act on the provided data needs to be loaded in each page individually. As I was working with React app, I put all the external javascript files (e.g: bootstrap, custom theme js, etc.) in the index.html file inside the "script" tag. But it turns out that not all javascript files work correctly in that way. Sometimes, some javascript files need to be loaded each time the route is changed. So, I had to include the javascript file inside the componentDidMount() and now it works fine.
Here is the link of another question that I asked on how to include external javascript files in ReactJs:
How to make external javascript file work in ReactJs?

How to exclude rendering existing script in DOM in Yii2

How to exclude in rendering already existing scripts in DOM in Yii2
What method (render or renderAjax etc.) i have to use to exclude rendering one more (the same) jquery, jquery.ui
I have jquery.js on my page. And i (via ajax) load to my page modal window of registration, that requires jquery.js, and it pulls jquery.js second time.
And in the result my page contains 2 jquery.js library. And somewhere starts ocurring errors. I want to fix it by remoeving enother jquery.js
I'm not sure if you are using AssetBundle class but if not - you should.
There is already defined yii\web\JqueryAsset with jquery.js you can use.
Now you can create AssetBundle with your script that will depend on JqueryAsset (read more about assets dependency in the Guide). No matter how many times this asset is registered JqueryAsset will be registered only once.
You can do the same when adding single js file with registerJsFile() - in options array you can use 'depends' key with the JqueryAsset.
Sorry again. I found solution. Here is it

How can find place referencing a js file?

I'm using hexo and yilia theme to build my blog,but when I visit my blog,I see some error on chrome console:
I want to change the two js reference to https,but I don't know where I can find the place referencing these files,anyone knows please help me,thanks!
For the mathjax js file, change it in layout/_partial/mathjax.ejs
For the jquery js file : change it in layout/_partial/after-footer.ejs
After that, don't forget to generate the new site with hexo generate

cakephp 3.0 create new widget by a plugin

I created a new widget for cakephp 3.0 and now I would like to distribute it as a plugin.
My widget is at /src/View/Widget/Autocomplete.php
I baked the plugin and moved this file to /plugins/Autocomplete/src/View/Widget/Autocomplete.php
I want to let my plugin to load all neccessary helpers, css and js files. Where and how should I add them?
You would add that information to the composer.json in your plugin. Here's an example:
https://github.com/cakephp/debug_kit/blob/ccb5c35b4d525103e04a5b457ab5cf12f2e9a6b3/composer.json
Make sure you have the same data in "require", and change your "autoload" section accordingly

joomla 3.3 css module overriding doesn't work

I have use the backend feaure to create an override for the module djmenu. This automatically create the folder mod_djmenu in template/protostar/html and create a default.php in this folder.
I want to override the djmenu.css which is originally placed in module/mod_djmenu/themes/default/css, so I created in template/protostar/html/mod_djmenu the folder themes/default/css and copy paste the djmenu.css there.
I changed some simple but obvious CSS properties (background...) to test the override but it's not changing anything on my website and when I use firebug I still that the original file is used and not the override. I went across several tutorials but without success.
What I am missing?
Here is what you should do to make the css overrides work (it's working for the dj-menu module only not every modules though)
1) copy paste the css files you want to override in the template/protostar/css folder
2) in dj-menu module setting, select - override from template - on the theme field (first tab in the module page).