Jump to content

LAPS

Members
  • Posts

    212
  • Joined

  • Last visited

Everything posted by LAPS

  1. @adrian I'll test in the next few days (I hope)
  2. I upgraded to Tracy v4.21.33 and confirm the problem still occurs. I had to disable Tracy to solve it.
  3. v4.21.30 (as wrote in the linked post 😉 )
  4. Around line 333 I've the following code: // load Tracy files and our helper files $tracyVersion = version_compare(PHP_VERSION, '7.1.0', '>=') ? '2.7.x' : '2.5.x'; require_once __DIR__ . '/tracy-'.$tracyVersion.'/src/tracy.php'; require_once __DIR__ . '/includes/TD.php'; if($this->data['enableShortcutMethods']) { require_once __DIR__ . '/includes/ShortcutMethods.php'; } Probably I'm not using the latest Tracy core update.
  5. In Admin > Modules > Tracy Debugger, I checked "Enable Tracy Debugger". Then, in front-end, I clicked the button so to have this Tracy Debugger panel . When I click a link for downloading a file the error is still generated. How should I change the code line?
  6. @adrian I don't know if you've access to the linked topic in my previous post, but I'm not using any hook for RepeaterMatrix nor InputfieldRepeaterMatrix. The error with RepeaterMatrix occurs when Tracy Debugger is enabled and it doesn't occur when Tracy Debugger is disabled. Could be this a bug?
  7. When Tracy Debugger is enabled, I get ProcessWire\WireException: Method RepeaterMatrixPage::render is not hookable
  8. Yes Yes Waiting for the availability of the newest PrivacyWire version (0.4.4) to give it a try.
  9. The following procedure makes PrivacyWire to work in combination with ProCache, performing the minimum amount of HTTP requests. In PrivacyWire config option, check "Render Banner and Header Content Manually" and uncheck "Add basic CSS Styling". In directory /site/css/, create the file PrivacyWire.css which includes the PrivacyWire CSS statements. In source code, add: <head> ... <!-- CSS --> <link rel="stylesheet" type="text/css" href="<?= $procache->css([ ..., '../assets/css/PrivacyWire.css' ]); ?>"></script> <!-- JS --> <!-- Note: Here order is important. Render these two lines before adding PrivacyWireUnstyled.js --> <script>var PrivacyWireSettings=<?= $modules->get('PrivacyWire')->getInlineJs() ?></script> <?= $modules->get('PrivacyWire')->renderBodyContent(); ?> <script src="<?= $procache->js([ ..., '../modules/PrivacyWire/js/PrivacyWireUnstyled.js' ]); ?>"></script> </head> <body> ... </body> Not an elegant way to make things but it works. Any improvement is welcome.
  10. I think the PrivacyWire.js/PrivacyWireUnstyled.js file is requested by the PrivacyWire module (see functions ___render() > renderHeadContent() > ___getJsFile()). ProCache automatically merges and minifies all js/css files into one file only if in PW Admin > Setup > ProCache the "merge options" are checked BTW since my js/css files change from page to page, I uncheck all these "merge options" (as also advised in ProCache itself). In other words, I would like to have more control on what is loaded by PrivacyWire. Of course, if I uninstall the PrivacyWire module I don't get the HTTP request that retrieves the PrivacyWire.js/PrivacyWireUnstyled.js file.
  11. @The G I noticed of that config option, but the "one more HTTP request" is still performed either way by checking and unchecking the "Use ProCache JS Minification (if available)". I would like to merge the PrivacyWire JS code (PrivacyWire.js/PrivacyWireUnstyled.js) into my ProCache JS minified file. That is, I would like to make something like this: <head> ... <script src="<?= $procache->js([ ..., '../modules/PrivacyWire/js/PrivacyWireUnstyled.js' ]); ?>"></script> ... </head> And stop PrivacyWire to perform its "one more HTTP request" to get the PrivacyWire.js/PrivacyWireUnstyled.js file (ProChaced or not) since I load it myself. The point here is avoiding the "one more HTTP request". It's a matter of performance. IMHO A config option for this should be added or improved.
  12. @The G After your post I understood that only one of the mentioned JS files is required. In any case I would like to manage for less HTTP requests as possible. In particular, I would like to merge PrivacyWire JS code into the ProCache JS minified file, and make the same for the CSS. The following procedure makes PrivacyWire to work but still performing one more HTTP request for retrieving the JS file (PrivacyWire.js/PrivacyWireUnstyled.js) in combination with ProCache. In PrivacyWire config option, check "Render Banner and Header Content Manually" and uncheck "Add basic CSS Styling". In directory /site/css/, create the file PrivacyWire.css which includes the PrivacyWire CSS statements. In source code, add: <head> ... <link rel="stylesheet" type="text/css" href="<?= $procache->css([ ..., '../assets/css/PrivacyWire.css' ]); ?>"></script> <?php echo $modules->get('PrivacyWire')->renderHeadContent(); ?> </head> <body> ... <?php echo $modules->get('PrivacyWire')->renderBodyContent(); ?> </body> IMHO The above-mentioned PrivacyWire.css file, even if small sized, should be added in the PrivacyWire module directory by design. The issue is that PrivacyWire loads PrivacyWire.js/PrivacyWireUnstyled.js in all cases. Nothing stops it to perform the one more HTTP request to get the JS file. I would like to avoid this behaviour in order to merge the PrivacyWire JS and CSS code into ProCache JS and CSS chaining. With the above code I can do it for the CSS file but not for the JS file.
  13. @joshua thanks for the module. I unchecked the module config checkbox "CSS: Add basic CSS Styling" and added via <script> the PrivacyWire.js (which, as of module implementation, seems to include CSS itself), but the PrivacyWireUnstyled.js still loads in network (i.e. a HTTP request is made to get it). Is there a way to include "manually" all the JS files (including PrivacyWireUnstyled.js)? That is, to make possible something like this: <script src="/site/modules/PrivacyWire/js/PrivacyWire.js"></script> <script src="/site/modules/PrivacyWire/js/PrivacyWireUnstyled.js"></script> so it would be the developer choose to minify and merge files, and to manage for less HTTP requests. Maybe a config option?
  14. I'm struggling on this hook that would populate selectable pages in PageTable Edit modal form also when a new page is just created. $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { $page = $event->arguments('page'); // this is a PageTable page i.e. it's created through an InputfieldPageTable field $form = $event->object; if($form->hasField != 'selectable_page_field') return; bd($page); // e.g. output: Page('id' => 123, ...) $related_page = wire('pages')->get("template=tmpl-name, page_table_field.id={$page->id}"); bd($related_page); // output (when $page is just created/added): // => NullPage('id' => 0, ...) // output (when $page is reloaded e.g. the edit page form is refreshed): // => Page('id' => 456, ...) // // Note: get() behaves differently depending on the page process flow: add and edit! // The problem may be caused by the page_table_field (InputfieldPageTable field) which // doesn't create the page until e.g. the related modal window is closed and re-opened, // and/or save button is hit in it. //... }); As expected, the above hook runs every time the Page Edit form using selectable_page_field is rendered. However it doesn't get the $related_page during the creation time because get() returns NullPage(), but the same code does get $related_page in all cases other than the creation time e.g. in Page Edit view after refreshing or closing-opening the modal window. Is there a way to make the get() to work even during page creation?
  15. I opened a new wishlist topic on the PW forum for this and in the meantime I ask to the community looking for a reasonable solution. Using the PageTable field, is there a way to un-restrict the creation of pages under a given parent template page (or as page children if no parent for items is selected)? That is, is there a way to allow the selection of the parent page dynamically / on the fly during page creation via the PageTable field?
  16. I'm using the PW PageTable field extensively and I think an improvement to it could be made regarding the ability to choose the page parent where the page created via PageTable will reside. Say you have a PageTable field set like this: Edit Field: page_table_field > Details > Select one or more templates for items > template_one > template_two > template_three Select a parent for items > parent_template Actually, you can only create pages under the parent_template page (or as page child if no parent for items is selected). BTW I am looking for reasons about this limitation. What about allowing to choose on the fly where the pages created via PageTable will reside? that is, having the possibility to choose dynamically under which parent page to create the pages? Actually, one could overcome to this by creating multiple appropriately set PageTable fields, one PageTable field per PageTable parent for items, but this is unsustainable (?) when you want to create a lot using PageTable… By allowing to choose dynamically / on the fly the parent page during page creation via the PageTable field would open up a wider usage of PageTable. What do you think about? @ryan @Robin S
  17. I've pages using the custom-page-template and I would like to display a simple message at the top of the page form when editing those pages in the Admin. I thought about hooking ProcessPageEdit::buildForm() but I do not well how to use that hook in order to display the message just for the custom-page-template pages. Any help? UPDATE: Solution found wire()->addHookAfter('ProcessPageEdit::buildForm', function(HookEvent $event) { $ProcessPageEdit = $event->object; $form = $event->arguments('form'); switch ($ProcessPageEdit->getPage()->template->name) { case 'custom-page-template': $form->prependMarkup("<div style='margin-bottom: 3.6em; margin-top: 1em; background: #ffd;'>MY MESSAGE</div>"); break; default: // do nothing } }); Any improvement is welcome!
  18. About the original topic and just for future reference, here I add a way of doing things using explode. $p_ids = $pageArray->explode('id');
  19. Hello there, I've a serie of pages manually sorted in the admin having the following titles: Black color Black dark color Black light color White color White dark color White light color Green color Green dark color Green light color Blue color Blue dark color Blue light color Red color Red dark color Red light color Color Dark Color Light color And (for now) I've a search form to search for the above pages (template is color-page) that use the following code: $search_result = $pages->find("template=color-page, title={$search_term}, sort=sort"); When I perform the search with $search_term equal to "Dark Color" then I get the result sorted as follow (and as expected because of the sort=sort) Black dark color White dark color Green dark color Blue dark color Red dark color Dark Color However, I would like to sort the $search_result by "relevance" to get the found pages sorted as follow: Dark Color Black dark color Blue dark color Green dark color Red dark color White dark color That is, "Dark color" is the first item because it is the "most matching". From the official PW documentation about sorting I know that if you don't specify your own sort=property the results are sorted according to MySQL's text searching relevance but this MySQL feature seems do not always work and I would like to make sure that found pages are sorted by "most matching" as in the example above. How can I make that in PW?
  20. Hi there, I would like to set a HTML code block in advance to output it later in the template file. I found I can make that this way: <?php $html_code = function() { ?> ... some HTML here... <?php }; ?> <?= $html_code(); ?> However it doesn't sound to me the goodest way of doing things. Furthermore it seems there isn't a smooth way to pass PW variables within the block. Is there a PW API method to make that a better way? UPDATE I just found this.
  21. Hi @nbcommunication, I have no experience with campaigns too, but I think compaings work in a similar manner as tags (both are arrays). Also, I think a setCampaign() method is the way to go in order to set the campaigns for Mailgun.
  22. @MoritzLost thanks for the explanation, and I would like to know why tabs are stripped out from the log text while they are not stripped between the "standard" PW-added data such as 'showUser', 'showURL', 'user', and 'url'. It is because I would like to use offline the log data that is in a structured format.
  23. Hello there, I'm trying to log some text that includes horizontal tabs (\t), this way: wire('log')->save("log-file", "{$data['one']}\t{$data['two']}\t{$data['three']}") However, when I download and open the log file then tabs are not included i.e. tabs changed to white spaces. Maybe, it happens because of this. How should I write tabs to log files?
  24. Hi there, I propose to add the campaigns data to be supported in WireMailMailgun (in a similar way as made for tags data). 😃
  25. According to this old post, I'm trying to use the PW cache feature: $my_page = $pages->get($pageId); if($my_page->viewable()) { $content = $cache->get("my_page"); if(!$content) { $content = renderCustom($my_page->children); $cache->save('my_page', $content, 3600); } echo $content; } function renderCustom(PageArray $items) { foreach($items as $item) { echo $item->title; // ... heavy content loading } } After loading the page which renders the above code, in the admin I can see something was cached (note: I'm using ClearCacheAdmin) : But when I reload the page the cached value seems do not be used and the page loads slowly. The result of doing var_dump() is the following: var_dump($cache); // return object(ProcessWire\WireCache)#20 (0) { } $content = $cache->get("my_page"); var_dump($content); // return string(0) "" What could be the problem?
×
×
  • Create New...