You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great to be able to insert other data as well, eg dates, username etc
eg I have a button that inserts
<todo startdate:yyyy-mm-dd @user>//my text here//</todo>
I'd like to be able to have custom button fill in information such as the date, time and username (or any other info calculated from that eg:
<todo startdate:@Date@ due:@date@+10 @@user@>Update AVG boot disk</todo>
would show as
<todo startdate:2015-02-25 due:2105-03-07 @Chris>Update AVG boot disk</todo>
To achieve the above date substitutions edit your action.php file in the plugin folder to include these additional lines:
protected function loadCBData() {
$json = new JSON(JSON_LOOSE_TYPE);
$file = @[file_get_contents](http://www.php.net/file_get_contents)(DOKU_PLUGIN . "custombuttons/config.json");
if(!$file) return false;
/** Start of new lines */
$file = [str_replace](http://www.php.net/str_replace)('@@TODAY@@',[date](http://www.php.net/date)("Y-m-d"),$file);
$file = [str_replace](http://www.php.net/str_replace)('@@USER@@',$client,$file);
$file = [str_replace](http://www.php.net/str_replace)('@@ONEWEEK@@',[date](http://www.php.net/date)("Y-m-d",[strtotime](http://www.php.net/strtotime)('+7 days')),$file);
$file = [str_replace](http://www.php.net/str_replace)('@@TWOWEEKS@@',[date](http://www.php.net/date)("Y-m-d",[strtotime](http://www.php.net/strtotime)('+14 days')),$file);
$file = [str_replace](http://www.php.net/str_replace)('@@THREEWEEKS@@',[date](http://www.php.net/date)("Y-m-d",[strtotime](http://www.php.net/strtotime)('+21 days')),$file);
$file = [str_replace](http://www.php.net/str_replace)('@@FOURWEEKS@@' ,[date](http://www.php.net/date)("Y-m-d",[strtotime](http://www.php.net/strtotime)('+28 days')),$file);
$file = [str_replace](http://www.php.net/str_replace)('@@ONEMONTH@@',[date](http://www.php.net/date)("Y-m-d",[strtotime](http://www.php.net/strtotime)('+30 days')),$file);
/** End of new lines */
return $json->decode($file);
}
I'm still working on getting the username substituted in… If I'd known it was this simple I'd have done it ages ago. The placeholders to put in your button text are @@today@@, @@oneweek@@ etc. Hopefully, it's obvious enough to make your own tweaks.
The text was updated successfully, but these errors were encountered:
Reported on dokuwiki.org by
It would be great to be able to insert other data as well, eg dates, username etc
eg I have a button that inserts
<todo startdate:yyyy-mm-dd @user>//my text here//</todo>
I'd like to be able to have custom button fill in information such as the date, time and username (or any other info calculated from that eg:
<todo startdate:@Date@ due:@date@+10 @@user@>Update AVG boot disk</todo>
would show as
<todo startdate:2015-02-25 due:2105-03-07 @Chris>Update AVG boot disk</todo>
To achieve the above date substitutions edit your action.php file in the plugin folder to include these additional lines:
I'm still working on getting the username substituted in… If I'd known it was this simple I'd have done it ages ago. The placeholders to put in your button text are @@today@@, @@oneweek@@ etc. Hopefully, it's obvious enough to make your own tweaks.
The text was updated successfully, but these errors were encountered: