I have this code template in Eclipse
#since ${date}
when entered i get something like this :
#since 4.8.2009
But when i add the same template (#since ${date}) to NetBeans
it outputs
#since date
Can someone help ?
No answer yet ? Is this not possible in Netbeans ???
Something like the following example should doing the job :
${date?date?string("yyyy")}.${date?date?string("MM")}.${date?date?string("dd")}
yyyy => year on 4 elements (ex: 2012)
MM => Month on 2 elements (ex: march -> 03)
dd => Day of the month on 2 elements (ex: 23)
. => separator you want to separate each fields (ex: - or / or . or smth else)
You should have to check about available format somewhere in the netbeans help (sorry I don't find out informations about this for now).
I see that's a very old post, but if it may usefull for someone ...
regards.
ollie314
Not wanting to raise the dead with this post, but I thought it worth mentioning so I signed up to SO specifically to clarify, since Ollie314 saved me a lot of time.
The format ollie314 used is correct (for version 7.1+ at least) BUT just to be clear, if it's not displaying correctly it may be due to your system locale settings, if outside of USA. Be sure to include <#setting locale="en_AU"> (replace en_AU with your locale id) in the template you are editing, prior to the date?date?string cast declaration, or it will not work. If you place it in the user settings it won't cast the date string in the template and you will generate errors in your template output.
The documentation from Netbeans isn't particularly clear on that. Still, best IDE ever :)
Inserting ${date?date?string("yyyy")} within your template will do the trick (if you want year only)
Note: With NetBeans 6.5/6.7, if you do not find that template, you could create it.
See this tutorial.
I'm pretty sure this is not possible in Netbeans, or at least not worth the amount of trouble. It's possible that you could author your own Netbeans module, add a code template to the module (in which you might be able to put the ${date} as an extra variable, I'm not sure), and then add the module to Netbeans. But you could also just type the date in, which, unless you type it several thousand times per day, would probably take less time.
Your snippet looks like freemarker code. This is used in Netbeans for file templates (Tools -> Templates). If you put ${date} in a file template it will get transformed when the file is created to the current date. If you're trying to use it as a code template I don't know how that works.
Even simpler, use ${date?date?string.yyyy}
Related
So, it's my first question here - i found a lot of hints which all working for itself but im struggling now with the final step to get solved.
Guess it's very specific pointed to TYPO3-CMS V9 and higher.
I can also support with all of the Codes, for the moment i guess this will be better on request.
Task: Create a simple Productorderform for logged-in-users pointing just there specific products form the specific price-lists. -> solved by using PHP-Script working with a CSV-File, grabbing also some functions from TYPO3 itself to get needed parameters.
This PHP creates a DATALIST on runtime for the INPUT-Field producing the needed HTML-Code -> solved and working as expected.
Tricky part.
As TYPO3 offers a CORE-Extension called FORM and the Option to - REPEAT - the fieldset.
Also for TYPO3 there is an extension which allows to put PHP-Code directly to TYPO3 as a Content-Element.
FORM itself allows to put Content-Element to a form.
Working so far, but as described, the field (its value) is not recognized when i fire the send button.
So for some reason i have to predefine the trigger also.
I tried step for step to extend the predefined field in the php with the tags of an empty one, all(?) the surrouding DIV etc. to make FORM recognize this field as a "native" field, just extend in the main tag with ... list="prodlist" ...
Well, as you might see, i'm not a developer or programmer, i might have some skills and experiences to know where and how to go with the level (and timeframe) i have.
So i guess the final step might not be that far, but as we say here, i can't see wood because of trees...
The FORM structure by the way is saved to a YAML-file which might be also manipulated, but as i have seen, it gets the triggers -what- to parse in some way from the FORM created.
Many thanks for hints, ideas an hopefully noone was falling to sleep reading this question... ;)
I have a lot of PHP files in which I have used date() function in all files to format the date.
Currently I am using the format as MM-DD-YYYY. Now I need to change the date format to another as DD-MM-YYYY.
Is there any way I could change the date format in all files in a feasible way?
I know I could have used a common function for formatting, but its too late :(
Thank You
EDIT
Example of using date() function in my PHP files
Currently I am using as below,
date('m-d-Y', strtotime(myDateStr));
But I need to change in all files as,
date('d-m-Y', strtotime(myDateStr));
Please suggest if there is any other possible way to do this.
Are you simply looking to go through the code of each of your php files and change the string 'm-d-Y' to 'd-m-Y'?
If so, you simply need to see if your IDE/text editor has a find and replace tool.
In Notepad and Netbeans (at least) this is Ctrl+H. Then put 'm-d-Y' in the find box and 'd-m-Y' in the replace box, then click 'Replace All'. Do this for every relevant sheet.
If you already don't have one, get an editor like Atom or Notepad++.
In Atom:
Press Ctrl + Shift + F to open the Find in Project - view.
To the upper Find in project textbox, type date('MM-DD-YYYY', and to the lower Replace in project textbox add date('DD-MM-YYYY',.
Click the Replace All - button.
In Notepad++:
Almost similar, press Ctrl + Shift + F to open the Find in files - dialog. Set Find what to date('MM-DD-YYYY', and Replace with to date('DD-MM-YYYY',. Finally click Replace in Files.
Note! You might need to adjust the Directory to suit your needs.
There are other editors as well capable of doing this and the process is almost identical in every one of them. Explore them to find how to do it in the editor in question.
I am trying to add a Google calendar to a website I'm making that the client will be able to update themselves. I found this: http://mikeclaffey.com/google-calendar-into-html/ which has been quite helpful, but I am a bit stuck.
The website I am building is using PHP template and the page contents is contained within the $content variable. Here is the link I'm working on: http://victoriasawyer.com/AmosTheTransparent.
The calendar feed is the top one of the two lists of Tour Dates. I would like the top one to look similar to the bottom one. The same would be ideal but not necessary.
The biggest issue I'm having is with the start date and time. In the title of the event I would like just the date to show (preferably like 10/03/14) not the time. I have figured out how to display just the time separately without issue. Is there some way to change the date format?
The other issue I'm having is the order that the events are appearing. I would like the events to show with the soonest one first in the list and the furthest one last in the list. I added the additional parameters as instructed in the tutorial (orderby=starttime and sortorder=ascending) but they do not display correctly.
The url I am using is: https://www.google.com/calendar/feeds/qmfadhgtq2kmabsi3dlb456v98%40group.calendar.google.com/public/full?orderby=starttime&sortorder=ascending&futureevents=true&alt=json. Is there something I can adjust or add to fix the order?
Any help will be much appreciated (even if you can recommend an alternative. It just needs to be customizable, and so far this seems to be the best option I have found).
You can use PHP's DateTime class like this:
$date = new DateTime('Sun Nov 16 2014 00:30:00 GMT+0000');
echo $date->format('Y-m-d');
You can then use the predefined formats in PHP which are listed here to format it into whatever style you like.
echo $date->format('d/m');
echo $date->format('d/m/Y');
I'm trying to take 2 versions of text (10 pages long) and compare the 2 to produce the difference. I know Wikipedia has a similar feature to compare revisions. Does anyone know what they use? I'm hoping they're using a php-driven solution.
There is an implimentation of diff in php. I haven't used it but it's a start. There is also something called PHP inline diff that you can check out
My PHPEd suddenly stopped showing arguments and arg order in the hints, and now just shows a basic description of the function.
Before I go digging around in the config files, has anyone else had this problem?
Thanks!
Edit:
Sorry, I may not have been entirely clear on this. There is no problem with my own classes, only with the actual php functions.
Example:
How it used to work:
I type a PHP function, say strpos. As soon as I type the '(' at the end of it, I get the little yellow box, showing something like this:
int strpos ( string $haystack , mixed $needle [, int $offset=0 ] )
with the first argument bold. If I type it, and then a comma, it bolds the second arg, and so on. This is really nice, since PHP functions are a bit scrambled as far as argument order, and I don't have to look them up every time.
How it works now:
I type a php function, say strpos. As soon as I type the '(' at the end of it, I get the little yellow box. It says something like "strpos - Returns the numeric position of the first occurrence of needle in the haystack string."
There are no arguments shown, which makes the little box basically worthless - I know what strpos does, I just want a reminder of the argument order.
I think this may be a problem with the included PHPDoc, which I never use, but may be the source of the data for the hint box.
I did recently upgrade to 5.6, but ended up removing it and restoring 5.2. I installed to a different folder, and uninstalled from there, but it may have overwritten something in the original folder?
I'm using v5.2 (5220).
A complete re-install seems to have done fixed the problem. Perhaps it was a problem with a partial upgrade or a version mismatch on the settings.
What version of PhpEd are you using ? And did you made an update of PhpEd recently ?
As mentionned in the forum, that can modify the "Function Arguments Tooltip" feature behavior.
One way to check if this is linked to settings is to move the phped.cfgconfig file (save it), and let PhpEd recreates it with default values. If that does restore the tooltips, use a diff program to check what option may have been changed.
Do you see no hints for all classes, or only your own Php classes (in the latter case, this thread has some setting advices) ?
Note: the reason I ask for the version is because of this very recent thread, about PhpEd5.5:
In that case, the advice is to copy %PROGRAMFILES%\nusphere\phped\config\func.rel into %APPDATA%\nusphere\phped\config\ directory overriding the file in it.