Get parameter hints for my own PHP functions in Notepad++ - php

After enabling "Function parameters hint on input" in Preferences->Backup/Auto-Completion, I get helpful tips for native PHP functions like this:
string|false substr (string str, int start, [int length])
Is there a plugin or something that would make Notepad++ do this for my own functions, much like Dreamweaver does?

Settings -> Preferences -> Backup/Auto-Completion -> Function
parameters hint on input [CHECK]
Is this what you're talking about? Works for me.

I have accomplished this by doing the following:
Edit API XML file used by Notepad++ for the desired language.
Add custom names in Settings > Style Configurator to get highlighting you desire.
Editing the API XML file
The API XML files are located in your installation directory \plugins\APIs. I believe there is a file for each language that has a parser. That parser will determine which pieces of the XML file are required or ignored.
These files are very fragile so here are some tips:
All entries MUST be in alphabetically order by KeyWord or it will silently fail.
Watch out for text that makes your XML invalid in descriptions. From what I can tell Notepad++ doesn't have a schema to tell it that attributes are of type string so all kinds of characters will break the XML and your tips.
Any problems with the XML file will silently fail the tips.
I have used this technique to support a custom API used by a game engine I am working with and it works great. I have an excel spreadsheet to manage entries and create properly formatted XML to be pasted into the correct section of the file, but obviously there are many ways that managing that could be done.
I figured all this out based on these sources:
http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Editing_Configuration_Files#API_files
http://retroaffect.com/blog/190/A_Lua_Language_File_for_Notepad__/#b
(The API file here you can download has the Environment tag in the wrong place, it should be within the AutoComplete tag instead, but it helped me understand the usage.)
Editing the Style Configurator
Screen adding new key word: myNewKeyword
Final result after adding math.tanh with highlighting

I'm not too familiar with Notepad++, however I think unless there is some sort of IDE plugin it would not be possible.
In my opinion, you should use Aptana Studio, it's based off of the Eclipse IDE, and is specifically made for web development/PHP. Although there are plenty of other IDEs out there, here's a few.
Here's a link to Aptana: http://www.aptana.com

Related

PHP str_replace into microsoft word template

Right now I'm get task to make generate contract letter function in HRMS.
I'm already using CKEditor but the result is very different since the purpose made CKEditor is not like Microsoft Word or Google Docs purpose.
So I'm having idea that I'm making the template first in Microsoft Word and use PHP function str_replace to passing the data into Microsoft Word template.
The question is :
1. With that flow, is it possible to do that?
2. If Question 1 is possible can you hit me with the sample?
Many Thanks,
Hendra
There are several Classes that can do at least part of what you are trying to do:
wrklst/docxmustache
openTBS – Tiny But Strong
PHPWord
docxtemplater pro (basic opensource / free version / MIT license available as of writing; image replacing is a commercial plugin)
docxpresso (commercial)
phpdocx (commercial)
The first 4 of these are at least partially open source and investigating the code will help you understand the process, which is not trivial with word. In addition you can check out http://officeopenxml.com for the format details.
The main problem I see is with proper HTML to openXML conversion. Meaning to convert the styling from CKEditor (which might be HTML) into the proper XML Styling, which functions quite differently and a direct translation is not trivial. Check out https://github.com/wrklst/docxmustache/blob/master/src/WrkLst/DocxMustache/HtmlConversion.php so see some basic HTML conversion on singular runs of bold, italic and underlined text.
To my knowledge there is no maintained open source package that delivers proper html to openxml conversion. If you need this and cannot write it yourself, you will probably go for one of the paid solutions.
Good luck.
Docx is a zipped format that contains some xml. If you want to build a simple replace {tag} by value system, it can already become complicated, because the {tag} is internally separated into <w:t>{</w:t><w:t>tag</w:t><w:t>}</w:t>. If you want to embed loops to iterate over an array, it becomes a real hassle.
source : https://docxtemplater.readthedocs.io/en/latest/goals.html
You could use the library I created in answer for this problem : https://github.com/open-xml-templating/docxtemplater , it works with JS in the browser or with node.js.

Is there a way to auto-indent HTML/PHP files?

My first place to look at this was a fix with Notepad++.
This quite quickly brought me to "TextFX HTML Tidy".
Read the description and it seemed to be the problem for all my problems.
However, the install is quite hard, apparently TextFX used to be standard practice for Notepad++, for some reason that is no longer the case. I eventually fixed this by downloading an older install for Notepad++ and copied the plugin folder to my own Notepad++ file.
This gave me acces to the correct plugin, but this plugin is written purely for HTML, C++, or XML.
Since I use php in my files, this gives some complications. Normal tags are ignored as they should be, but when I use php inside an html string, in a link for instance, the php tags get converted to html.
For instance:
The start of my sentence Here my anchor tekst.
After tidy HTML becomes
The start of my sentence Here my anchor tekst.
Rendering this solution unusable.
There must be a lot of people looking for this functionality, and since this one is no longer standard practice for Notepad++, I figured there must be a better method to auto format your HTML code. But for some reason I can't find it.
So my question is: Is there a way to autoformat my code, clearing empty lines and indenting tags in the correct opening and closing order?
Preferably with Notepad++ but any other program will do.
Kind regards
For anyone looking for the same things. Switching to Netbeans did the trick for me, options with Notepad++ are still appreciated.
In Netbeans, using Shift+alt+F did the trick for me.

Autocomplete User defined Functions for notepad++?

dreamweaver has an option to automatically scan a directory and index all the user defined functions so you can then easily reference and auto complete when writing code. I am using notepad++ to right PHP and would like a similar feature without the need of manually updating an API or config file or anything for notepad++.
Does anyone know of a plugin/addon etc or maybe a better open source program which allows this feature?
Did you try Sublime Text 2? It's a really cool text editor, that implements natively what are you asking for.

Is there an embedded visual (PHP) parser for Microsoft Word?

I am writing about code that I have written for documentation, mainly in PHP. I also have other languages that I will write about but I am wondering what the easiest way to display code within a word document. I could just import a print screen of a Notepad++ document but I would like an easy way to include code into Microsoft Word without having to print screen it every time I want to make a change. I am looking for something that will allow me to edit the code within word, but obviously not be functional. I would like there to be some sort of visual parsing so that similarly to Notepad++ it is more readable.
You don't need to print screen in Notepad++. You can export/copy the text as RTF and preserve syntax highlighting and formatting.
I'm not on my PC at the moment, but the option is either under the TextFX menu, or the Plugins menu.
Works very nicely.
Edit:
This menu, press 'Copy RTF to Clipboard', and you can paste into Word.
Instead of using word to document your code, you could instead check out a document markup language called Latex.
It allows for easy documentation of code(and math) and is therefor a really good tool for creating scientific reports.
http://www.latex-project.org/
Here is a basic tutorial on how it works:
http://www.youtube.com/watch?v=SoDv0qhyysQ
(This youtube video explains the basics)

Homesite outline profile editor

I've been using HomeSite since Allaire owned it. I started with plain HTML, then classic asp, now I've been using it for PHP development for quite a while but there's a feature I really want and Homesite only seems to do it sometimes. Most IDEs will show a list of functions on a page. Homesite will sort of doing this with the Tag Inspector feature. If I have a file that is nothing but PHP user-defined functions (ex. require('functions.php')) then all the functions show up just fine. However, if my page is mainly an HTML page with PHP functions added in they don't show up in the outline.
I guess I could have all my functions be part of a 'required' file but I was wondering if any homesite jocks might know of a more reliable way of creating an outline profile that would display user-defined functions
I used Homesite myself. Topstyle kinda took over from it (it was by the same guy), and now TS itself has now been sold on, for version 4 - http://www.topstyle4.com/ - (now in beta).
Code insight for the files/classes/functions isn't particularly unique anymore though - I think the various Eclipse based IDEs and the Komodo IDE can also do it now.
I don't use homesite, but it sounds like perhaps it could be keying off the file extension. Try saving your file with a different extension, for example: save "yourfile.html" as "yourfile.phtml".

Categories