How am i able to create the shortcut key in phpdesigner8? - phpdesigner

Is there any possible way to crate a shortcut key in phpDesigner?
For an example, i have an html code
<html>
<title> My Project </title>
</html>
how can i create a shortcut key like when i press ctrl+2, it display
<html>
<title> My Project </title>
</html>

Don't know about hotkeys, but you can add an autocompletion.
Go to Tools -> Preferences -> Editor -> Autocompletions and bind, for example,
#html
to
<html>
<title>|</title>
</html>
On new page if you enter #html and press Ctrl+J your bound item changes to code set.

It sounds like you (or someone looking for a similar feature, as I did before I found it) may also be referring to something like "PHP Code Beautifier" (but this is for PHP code primarily).
To activate this by shortcut, go into:
Tools -> Customizer... -> Shortcuts -> PHP Code Beautifier :: File, and change to CTRL + 2 then click "Change".

Related

How to code a button in HTML to open a html page in Notepad

Hello I have a server inventory with me. But we wanted to make it easy by including a button which upon clicking should open our main html page in notepad so that anyone without a coding knowledge can open it and add a new server or make any changes easily. Is it possible? I have tried many things but failed. help is very much appreciated. To put it in a simple way, I want to create a button in my html page which should open my html page in notepad but not in browser.
<html>
<head>
<script type="text/javascript">
function runProgram()
{
var shell = new ActiveXObject("WScript.Shell");
var notepad = "C:\Windows\notepad.exe" /e /s /u /wl /wr /maximize";
var file = "file:\\\10.35.114.123\e$\Inventory\Somos\Home1.html";
shell.Run(notepad+file);
}
</script>
</head>
<body>
Run program
</body>
</html>
My first reaction was say that it's not possible, but since in your code you use a local intranet address you could achieve that with this conditions:
You have to use Internet Explorer, since ActiveXObject is supported only by IE, being that object a proprietary MS extension.
You are OK with lowering a bit the security settings of the local intranet zone (only that zone, Internet security settings remain unchanged). If you don't do that you the script will fail with the message "Automation server can't create object".
Your users have file network access to that location: that directory is a shared folder and users have the appropriate permissions to access it (i.e. they can access it using Windows Explorer).
First, you have to modify your code, since the parameters you use are not valid for Windows Notepad, also you have to remove the "file://" protocol and use double slashes in the network path (because the Shell object expect strings in C/C++ format):
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function runProgram()
{
// only works in Internet Explorer
var shell = new ActiveXObject("WScript.Shell");
//var notepad = "C:\\Windows\\notepad.exe"; // full path optional for notepad
var notepad = "notepad.exe"; // use full path for programs outside Windows folder
var file = "\\\\10.35.114.123\\e$\\Inventory\\Somos\\Home1.html";
shell.Run(notepad+" "+file);
}
</script>
</head>
<body>
<button onclick="runProgram()">Open Notepad</button>
</body>
</html>
Then you have to modify the settings of Internet Explorer in each computer:
Open Internet options, and in the Security tab select Local Intranet. Important: make sure that you change settings only for the local intranet.
Press the Custom level... button and find the Initialize scripts and ActiveX controls not marked as safe for scripting option, then select Prompt or Enable (better the first one).
Open the page in Internet Explorer, it a message appears at the bottom saying that Intranet settings are off by default then press Turn on Intranet settings.
After this, pressing the "Open notepad" button will open Notepad with that file (maybe with a warning).

Sublime Text 2 HTML default markups?

Sorry for asking such basic question but I can't seem to find the answer anywhere.
How can I get ST2 to write the basic html markup structure in new files?
You can use the Emmet package.
Installation
The simplest method of installing Emmet (and any other package) is via the Package Control package. To install that, follow the instructions from the project's home page:
The simplest method of installation is through the Sublime Text console. The console is accessed via the ctrl+` shortcut or the View > Show Console menu. Once open, paste the appropriate Python code for your version of Sublime Text into the console.
import urllib2,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')
Next, open the command palette using the shortcut: CTRL + SHIFT + P
and type: "install package" and press Enter.
Type "Emmet" and select: Emmet (ex-Zen coding) for Sublime Text package.
And that’s it. After selecting the package, Emmet will install. You'll get a notification once it's done.
Use
Emmet allows you to type CSS-like expressions that can be dynamically parsed to produce (amongst other things) HTML.
For example, open a new file, type html:5, then press Ctrl + E. This will expand into:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
</body>
</html>
Emmet can do a lot more though, for example ul>li*3 will expand to:
<ul>
<li></li>
<li></li>
<li></li>
</ul>
I would recommend that you watch the getting started video and check out the docs. Integrating Emmet into your workflow is a real time saver.
You can use DefaultFileType.
If you have the Package Control package installed, you can install DefaultFileType from inside Sublime Text itself. Open the Command Palette and select "Package Control: Install Package", then search for DefaultFileType and you're done!
Package Control: https://packagecontrol.io/installation#st2

how to enable html editor in eclipse JUNO for phonegap application?

I am using eclipse JUNO as Android Developer Tools, I am developing PhoneGap application, So I need mobile html but, It does not highlight the html syntax. So How to enable its **syntax highlighter and suggestions for html syntax. **
Eclipse Juno by default has the html tags enabled.
Try File-> New -> file -> FileName.html -> Finish.Now try pasting your code in this file.
Use Ctrl + Space for suggestions.
Thanks Every body I got my answer form this link
I summarized it
In Eclipse Juno Go ..
Step1:Help=>Install New Software..
Step2:Select the Juno repository (http://download.eclipse.org/releases/juno/) from the 'Work with:' menu:
Step3:In the search box, enter 'web' to filter the results, and select 'Web Page Editor':
Step4: Click Next:
Step5: Accept the terms and click Finish:
Step7: You might see this - just click OK:
Step8: Click Yes when ready:
If color of html files is not change(only black) So you have to go
step9: Window => Preferences menu as shown:
Then for both *.htm and *.html,
Step10: click on the 'HTML Editor' in the window below and click the 'Default' and 'OK' to apply.
Now open with HTML Editor
Check the Eclipse editor for HTML

Phpstorm zen coding: insert <?php ?> tag

Is there a built-in zen coding shortcut in PhpStorm to insert a <?php ?> tag? If not, how would I go about setting one?
No there is not, You can set it by Going to File -> Settings -> -- IDE Settings -- -> Live Templates -> Add And using the following values:-
Abbreviation: php
Group: user
Template Text: <?php $END$ ?>
Context: Check HTML
In PhpStorm2016.1 must change Applicable in Value to HTML .
Go to File -> Setting -> Editor -> Code Style -> Live Templates
On right sidebar click on "+" then :
Abbreviation : (for example) p
Template text :
Applicatin :change the value to HTMLl like befor
then click on ok .
In newer versions of PhpStorm(2019.* or higher) adding the shortcut is a little bit different.
First go to File -> Settings (or simply press CTRL + ALT + S). Open Editor tab and find Live Templates tab. Select PHP and click small blue plus icon at the right sidebar, select live template and:
Type shortcut on Abbreviation input.
Type <?php $END$ ?> on template text area.
Define applicable context like php and html.
If you want to expand with another key instead tab, you must define another expand key.
Click Apply and OK buttons. That's it.
Go to
File --> Settings --> Search & click Live Templates
Click + button on the right side
then click Live Template
lastly input following:
Abbreviation: PHP
Template Text: <?php $END$ ?>
Context: Check HTML
Click Apply then OK
Now type php and press tab in a php file
PHP tag (<?PHP ?>) will automatically generated
You can set it by going to File -> Settings -> -- IDE Settings -- -> Live Templates
and then input
Abbreviation: php
Group: user
Template Text: php $END$ ?>
Context:
Check HTML

Writing a vim function to insert a block of static text

I'd like to be able to do something like this in vim (you can assume v7+ if it helps).
Type in a command like this (or something close)
:inshtml
and have vim dump the following into the current file at the current cursor location
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
</body>
</html>
Can I write a vim function do this is? Is there a better way?
Late to the party, just for future reference, but another way of doing it is to create a command, e.g.
:command Inshtml :normal i your text here^V<ESC>
The you can call it as
:Inshtml
Explanation: the command runs in command mode, and you switch to normal mode with :normal, then to insert mode with 'i', what follows the 'i' is your text and you finish with escape, which is entered as character by entering ^V
It is also possible to add arguments, e.g.
:command -nargs=1 Inshtml :normal i You entered <args>^V<ESC>
where <args> (entered literally as is) will be replaced with the actual arguments, and you call it with
:Inshtml blah
I do that by keeping under my vim folder a set of files which then I insert using the r command (which inserts the contents of a file, at the current location if no line number is passed) from some function:
function! Class()
" ~/vim/cpp/new-class.txt is the path to the template file
r~/vim/cpp/new-class.txt
endfunction
This is very practical - in my opinion - when you want to insert multi-line text. Then you can, for example, map a keyboard shortcut to call your function:
nmap ^N :call Class()<CR>
i have created a new file generate_html.vim in ~/.vim/plugins/
with the following code
"
" <This plugin generates html tags to new html files>
"
autocmd BufNewFile *.html call Generate_html()
function! Generate_html()
call append(0, "<!DOCTYPE HTML>")
call append(1, "<html><head>")
call append(2, " <title></title>")
call append(3, ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />')
call append(4, ' <style type="text/css">')
call append(5, ' </style>')
call append(6, '</head>')
call append(7, '<body>')
call append(8, '</body>')
call append(9, '</html>')
endfunction
this way, everytime I open a new .html file in vim, it prints that text to the new file
Can you define an abbreviation. e.g.
:ab insh 'your html here'
as nothing in the above appears to be parameterised ?
In fact, looking at my VIM configs, I detect a new .html file being loaded thus:
autocmd BufNewFile *.html call GenerateHeader()
and define a function GenerateHeader() to insert my required template (I do the same for Java/Perl etc.).
It's worth getting the Vim Cookbook for this sort of stuff. It's a sound investment.
snippetsEmu
I like to use the snippetsEmu vim plugin to insert code snippets like your.
The advantage of snippetsEmu is that you can specify place holders and jump directly to them in order to insert a value. In your case you could for example add a place holder between the title tags so you can easily add a title to the document when inserting this snippet.
snippetsEmu comes with various snippets (also for HTML) and new snippets can be esaily added.
EDIT
snipMate
Today I revisited my VIM confiugration + installed plugins and found the snipMate plugin, which is IMHO even better than snippetsEmu. snipMate updates just like TextMate all placeholders on the fly.
This should be possible. I use auto-replacement. In my .vimrc I have this line:
iab _perls #!/usr/bin/perl<CR><BS><CR>use strict;<CR>use warnings;<CR>
And whenever I start a Perl script, I just type _perls and hit Enter.
You can use Python (or any other program) if like me you haven't quite grasped vimScript
This guy talks about the vim expression register. Essentially you put something like this in your .vimrc file
:imap <C-j> <C-r>=system('/home/BennyHill/htmlScript.py')<CR>
So that every time in insert mode you press Ctrlj it calls the script htmlScript.py which has something like this in it (NOTE I haven't actually tested this)
#!/usr/bin/env python
import sys
snippet="""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
</body>
</html>"""
sys.stdout.write(snippet)
Then just remember to make the file executable (chmod 0755 /home/BennyHill/htmlScript.py). It might be overkill, but I am far more comfortable with Python than I am with vim's syntax.
You can once copy this text to some ( for example 'a' ) register. And paste it every time you need unless you overwrite register 'a'.
To copy to register a in visual mode: "ay
To paste from register a in normal mode: "ap
To paste from register a in insert mode: a
Or if you have this template already copied you can use
let #a = #*
To put this template to register a.
There are many template expander plugins for vim.
NB: I'm maintaining the fork of muTemplate. Just dump your code into
{rtp}/template/html.template or into $VIMTEMPLATES/html.template. And that's all. If you don't want the snippet to be implicitly loaded when opening a new HTML file, then name the template-file html/whatever.template (instead of html.template), and load it with :MuTemplate html/whatever of with whatever^r<tab> in INSERT mode (in an HTML buffer).
All the path issues, portability issues, etc are already taken care of. And unlike snippetEmu that supports (and somehow expects) several (hard to maintain, IMO) snippets in a same snippets definition file, Mu-template requires one template-file per snippet.
Put your text in a file (e.g.,html).
Then put the following in your .vimrc.
command Inshtml r html
I use Inshtml instead of inshtml because vim doesn't support user defined command starting with small letter.
Then if can type Inshtml in command mode (i.e., :Inshtml).