nette

Escaped HTML in summernote

こ雲淡風輕ζ 提交于 2021-02-19 01:39:11
问题 I am using wysiwyg called summernote which values I send to server, where I purify it with HTML Purifier. After that I save it to the DB (mysql). I then need to show purified html back in the wysiwyg, so write it as a textarea value (the textarea is linked in js with summernote). But it shows escaped html instead of formatted text. The editor works normally and js console shows no errors. Javascript I use to init summernote $('.summernote').summernote({ lang: 'cs-CZ', height: 100, airMode:

Nette Framework - custom attribute macros

送分小仙女□ 提交于 2019-12-23 08:57:09
问题 What is the best way to define new attribute macros in the Nette Framework? Moreover, would it be possible to do so in the config file? 回答1: define your own macro is really simple in Nette Framework, first you must create MacroSet: $latte = new Nette\Latte\Engine; $set = new Nette\Latte\Macros\MacroSet($latte->compiler); then create new Macro with args: $set->addMacro('if', 'if (%node.args):', 'endif'); And solution for your second question: Class MyMacroSet extends Nette\Latte\Macros

Nette Framework - custom attribute macros

烂漫一生 提交于 2019-12-23 08:56:11
问题 What is the best way to define new attribute macros in the Nette Framework? Moreover, would it be possible to do so in the config file? 回答1: define your own macro is really simple in Nette Framework, first you must create MacroSet: $latte = new Nette\Latte\Engine; $set = new Nette\Latte\Macros\MacroSet($latte->compiler); then create new Macro with args: $set->addMacro('if', 'if (%node.args):', 'endif'); And solution for your second question: Class MyMacroSet extends Nette\Latte\Macros

Cannot read property 'indexOf' of undefined

主宰稳场 提交于 2019-12-21 12:30:03
问题 i'm trying to set different options for several datepickers in jquery. My code is looks like this: {foreach $cart->getItems() as $item} {if $item->action->prereservation} var disableDates = new Array(); {if $item->action->hasVariants()} disableDates[{!$item->id}] = {$disabledDates[$item->action->id][$item->idVariant]}; {else} disableDates[{!$item->id}] = {$disabledDates[$item->action->id]}; {/if} if (disableDates[{!$item->id}].length !== 0) { $(".datepicker_"+'{$item->id}').datepicker({

Nette Framework - Route everything to one presenter

跟風遠走 提交于 2019-12-12 01:21:48
问题 I'm using Angular 2 in cooperation with Nette framework and I would like to let my Angular 2 to do all the routing instead of Nette . Now when I use Angular 2 routing. I get an Unexisting route exception from Nette. 回答1: To route everything to one specific presenter , simply add a new route into your RouteFactory (commonly in /app/RouterFactory.php ). $router[] = new Route('/<param .+>', 'Homepage:default'); PS: You don't need to use :default action in linking. Homepage will automatically

Pass PHP variable to MySQL trigger #nette

最后都变了- 提交于 2019-12-11 16:19:40
问题 I have trigger created in my database. I need to pass PHP variable to that trigger. I tried executing something like this in PhpMyAdmin: SET @myVariable = 123; INSERT INTO table (foo) VALUES (bar); Trigger successfully take @myVariable - So I tried it in Nette project, but I was not successfull. First, Prepared Statement can execute only one command, so I am not able to call SET and INSERT together. Then I found information that variable should be valid for whole connection, so I tried call

Cannot read property 'indexOf' of undefined

三世轮回 提交于 2019-12-04 05:58:05
i'm trying to set different options for several datepickers in jquery. My code is looks like this: {foreach $cart->getItems() as $item} {if $item->action->prereservation} var disableDates = new Array(); {if $item->action->hasVariants()} disableDates[{!$item->id}] = {$disabledDates[$item->action->id][$item->idVariant]}; {else} disableDates[{!$item->id}] = {$disabledDates[$item->action->id]}; {/if} if (disableDates[{!$item->id}].length !== 0) { $(".datepicker_"+'{$item->id}').datepicker({ maxDate: new Date('{!$item->action->voucherTo|date: Y-m-d}'), beforeShowDay: function(date){ var string =