cakephp 3.0 create new widget by a plugin - cakephp-3.0

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

Related

Issue with css inclusion in my angular app (NOT angular-cli)

I was trying to import bootstrap's css and material design's one into my angular application but i found at the same time an issue and a compromise.
If I include them with "link href" in my index.cshtml file, I get as
result that this prevents my angular app from loading.
If I include them with #include into my main .css file (which is
called by require("style-loader!./styles.css"); ), it actually
works but this prevents my app from parallel .css download and the
result is that - yes, it works - but that slows my app a lot.
I saw that lot of people include them into the proper angular-cli json file but my app is not an angular cli application so I actually can't do that.
So the question is: can you suggest me what's the best way and the best practice to include the css in a non-angular cli application?
OTHER INFORMATIONS:
I am using also webpack, don't know if this changes or means something for my question
One thing good to know about the angular CLI is that in the background it makes a call to webpack to bundle your application with bootstrap
(if you put the proper line in the angular-cli.json file
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
],
)
As you are not using the angular.cli.json file, you have to directly import the bootstrap framework with webpack. A link which might help you to import boostrap with webpack : https://getbootstrap.com/docs/4.0/getting-started/webpack/
I hope it will be helpfull !

angular 4 load html template files from external folder

I developed an application with angular 4 for security reason and changing the template without compiling I am trying to find a way can change HTML and application use that. somehow I need to read HTML template files from an external folder and use that.
I tried to find a way, but unfortunately I could not get a direct answer I hope here I can found out is it any solution for that or not?
what I did are:
https://github.com/lacolaco/ng-dynamic
Load Angular2 template from external URL
Equivalent of $compile in Angular 2
Angular 4 Template Binding with ES6 Template String
Dynamically load HTML template in angular2
How to bind raw html in Angular2
Previously Angular were shipping angular-compiler in build (bundle js) for security reason they removed angular-compiler from bundle and reason is obvious that angular compiles code on build and there is no need to ship compiler. It creates extra overhead on your production site and also creates heavier bundle. So the answer is no. You cannot inject template from external source. Why not create a component and use condition to show your external html in this way?

Add helper via plugin

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?

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

Drupal site. How do I add custom js/css prettify.js/prettify.css for a drupal page?

I want to use custom css/js. I have moved these to the server. But the drupal page starts with a section. how do I add the custom css/js to my drupal site page. I have admin and just need to know what to do to get this included on the page. Please send exact steps as I am totally new to drupal. Thanks
"Custom CSS and JavaScript files" module allows to specify two folders, one for CSS and one for JS where the stylesheets and javascripts files are located respectively.
The module creates two sub-folders under your files folder:
files/customcssjs/css
files/customcssjs/js
Indeed, it's depend on your task, what css and js files should do, and adding these in custom module (drupal_add_js, drupal_add_css) or custom theme (info file, preprocess in template.php or directly in page-XXX.tpl.php and so on).