I have main.php
include("DB.php");
and in my DB I have some public static function like
public static function getOne($table, $where='') {
}
Is there a way I can have an autocomplete in main.php ?
ex: DB::getOne(...)
Yarek,
you can try plugin, but in sublime text 3:
https://github.com/alienhard/SublimeAllAutocomplete
But it works only when DB.php is opened.
For more plugins PHP:
https://mattstauffer.co/blog/sublime-text-3-for-php-developers
if you want sublime to autocomplete you code you first have to install package control from :https://packagecontrol.io/installation
after that install codeintel from :
http://sublimecodeintel.github.io/SublimeCodeIntel/
and you will be ready to go
Related
I want to link to a public url where my login is hosted from a button in my app. I know how to link to pages in my app but not sure how to link outside my app.
I couldn't find much when i searched for it.
Is there an ionic way to do this (which is preferred) or would i have to go the html href route?
Install #capacitor/browser.
npm install #capacitor/browser
npx cap sync
example function :
import { Browser } from '#capacitor/browser';
async openCapacitorSite (url:String) {
//urlFormat http://capacitorjs.com/
await Browser.open({ url });
};
How can I create and download a PDF version of the current web page (which is open in browser) on button click?
I am assuming you use jquery on client-side.
$('#button_id').click(function(){
window.print();
});
Which will guide you to print menu where you can choose "Save as PDF" which will save your current view as pdf.
Did it solve your issue?
You can look at Nuget package: Rotativa http://nuget.org/packages/Rotativa. It's based on wkhtmltopdf.
Usage is really simple.
Having an action you would like to serve as Pdf, instead of Html page. You can define an action that returns an ActionResult of the type ActionAsPdf (RouteAsPdf is also available). So the code is just:
public ActionResult PrintIndex()
{
return new ActionAsPdf("Index", new { name = "Giorgio" }) { FileName = "Test.pdf" };
}
With name = "Giorgio" being a route parameter.
Look at this GitHub
If i am getting you right. You want to generate a PDF from HMTL. Rotativa plugin is a good choice. Also, mentioned by Janmejay Kumar. If you want to implement this plugin. Please ask if you have any doubt .I have used this plugin for PDF and for image generation.
I would like to create a plugin inside a plugin with Cakephp3. I found a solution for Cakephp2 but it doesn't seem to work in Cakephp3:
Is it possible to create a plugin inside a plugin with CakePHP?
How can I do this in Cakephp3?
I'm going to assume your question regards having the plugin loaded in your CakePHP 3.x application, not creating the plugin :-)
Note: this answer assumes you installed Cake using composer.
As an example, let's say we wanted to create a plugin, Themes, and this plugin was going to contain other plugins, Blue and Red.
By convention, the Themes plugin should be contained in your_app/plugins/Themes and the Blue and Red plugins could be contained in your_app/plugins/Themes/plugins/Blue and your_app/plugins/Themes/plugins/Red respectively.
In your_app/config/bootstrap.php , add the following:
Plugin::load('Themes', ['bootstrap' => true]);
(See https://book.cakephp.org/3.0/en/plugins.html#plugin-configuration for info regarding plugin configuration)
The code above tells Cake to load the Themes plugin, and to look for and load the plugin's bootstrap file.
If you haven't already done so, create the Themes plugin's bootstrap file at your_app/plugins/Themes/config/bootstrap.php and have it looking similar to:
<?php
use Cake\Core\Plugin;
// load the red and blue child plugins
Plugin::load('Themes/plugins/Red');
Plugin::load('Themes/plugins/Blue');
Important: Since you're trying to write the plugin(s) manually and not installing via composer, you need to modify your_app/composer.json to contain something like:
"autoload": {
"psr-4": {
"App\\": "src",
"Red\\": "./plugins/Themes/plugins/Red/src",
"Blue\\": "./plugins/Themes/plugins/Blue/src"
}
}
(See https://book.cakephp.org/3.0/en/plugins.html#autoloading-plugin-classes for more info on autoloading plugin classes).
Now, from within your_app/ run:
php composer.phar dumpautoload
(or the equivalent command, depending on how composer was installed on your machine)
This tells composer to refresh its autoloading cache. If you were to inspect your_app/vendor/cakephp-plugins.php, you should see that a path to the Themes plugin's folder has been added to a pre-existing list of plugin paths.
Now, from within your app's main controllers, you should be able to have stuff like:
public function initialize()
{
// load (supposedly-existing) components from the "Red" or "Blue" themes
// load GradientComponent of the "Red" theme
$this->loadComponent('Red.Gradient');
// load ColorComponent of the "Blue" theme
$this->loadComponent('Blue.Color');
// use what you asked for...
$this->Color->someMethod(['data']);
parent::initialize();
}
Also, to use view files (that you'd expect theme plugins to provide :-) ):
public function beforeRender(Event $event)
{
// use the "home" layout from the Red theme
$this->viewBuilder()->setLayout('Themes/plugins/Red.home');
parent::beforeRender($event);
}
In the past, there was a simple trick, to include the flex mxmlc module by adding the following line to the flash-cs4 makefile:
-include-libraries “/absolute/path/to/my/assets/assets.swc”
This gave you the ability to use getDefinitionByName, an helper function to access the embedded swc asset-library (instead of creating hand-written classes all assets).
Unfortunately, this has stopped working since flash-cs4. Does anybody know another solution?
Unfortunately, the only workaround I have found is to explicitly refer each of asset classes somewhere in the code. You may create dummy class like this:
public class AssetsExporter extends Sprite
{
public static function export()
{
AssetClass1;
AssetClass2;
//etc
trace( "DEBUG AssetsExporter.export()" );
}
}
Specify this class as Document class in Flash IDE, so it will be compiled into the resulting swc. Then in the main code of your application call
AssetsExporter.export();
After doing this you will be able to use getDefinitionByName().
You can add them to the libraries in the publish settings.
(Image from http://wiki.gigya.com/ via Google Images)
By the way, if you use SWC files, you can also do
new somepackage.SomeClass();
instead of
new getDefinitionByName("somepackage.SomeClass")
where applicable. This is because SWC files are included at compile time, not runtime.
Even though you can change a compiler setting manually, its easy if you are using FlashDevelop as this is very simple to fix.
Right click your included swc from the Project list. Choose options then "include library (complete library)".
..you can now use getDefinitionByName to get an unreferenced class from your swc file.
Im having problems with classpaths. I have used them before with "import" but I'm not able to link a class directly to symbol in the library.
I have a class c:/myfolder/src/myclass.as . In prefernces > AS3 settings, I have c:/myfolder/ as default classpath. I click linkage on the symbol and enter src.myclass . When I click the checkmark, it says 'class not found'. I am able to do: *import src.myclass; and attach the class to an instance on th stage. That works fine, but thats not what I need to do.
It's weird to use src as a package. Typically you'd set your preferences to c:/myfolder/src then put your top level package in there, but...
Check and make sure your file MyClass looks like this:
package src {
public class MyClass {
...
}
}
If it doesn't then you need to make sure your package matches the directories under your source directory (c:/myfolders).
Also you probably need to include the fully qualified package on the embed tag.
I found the answer. In preferences > AS3 settings the folder "c:\myfolder\" was below ".\". Once I moved it above, it saw the definition normally.