Jump to content

tires

Members
  • Posts

    226
  • Joined

  • Last visited

Everything posted by tires

  1. BTW. Is there a way to check if a file is secure or not? Or to check if there are insecure files on my website? Thanks!
  2. Hey! I just added this line in my config.php $config->pagefileSecure = true; I've got two questions: Is there a way to change existing files to secure ones? Do i necessarily need the line: $config->pagefileSecurePathPrefix = '-'; Thanks and greets!
  3. Hi! Is there a way to save the full name (i.e. another user field) instead of the username as the "cite" for a comment? Or isn't that recommended for some reason? Thanks!
  4. I chose the Operator: ~= (i.E. All given words appear in compared value, in any order. Matches whole words. Uses “fulltext” index.) But if i enter "everything 2021" i am not finding the page with the titel "everything is great in 2021".
  5. Thanks for your answer! I tried it without success. It seems that this line is responisble for the error. If i delete the if statemant the mail is sent (twice and after every change of the page). if($page->template =="mytemplate" && $page->id && $page->isChanged('status') && !$page->is(Page::statusUnpublished)) {
  6. Thank you for the answer! I still tried the doubble ampersand. Without success. Any other suggestion? BTW. Is this line correct? $numSent = $this->mail->subject($subject)
  7. Hello! I tried to make my own module using the code above. But unfortunately no mail is been sent. If i delete the if statement that starts with "if($page->template ..." it works. But then a mail is sent after every page modification. Here is my module code. Do you see any error? <?php class MailNotificator extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'MailNotificator', 'version' => 1, 'summary' => 'Hook the saving of pages to add own processes.', 'singular' => true, // Limit the module to a single instance 'autoload' => true, // Load the module with every call to ProcessWire ); } public function ready() { $this->pages->addHook('saveReady', $this, 'afterSaveReady'); } public function afterSaveReady(HookEvent $event) { $page = $event->arguments[0]; if($page->template =="mytemplate" && $page->id && $page->isChanged('status') && !$page->is(Page::statusUnpublished)) { $result = $this->db->query("SELECT status FROM pages WHERE id={$page->id}"); list($status) = $result->fetch_row(); if($status & Page::statusUnpublished) { $to = "your@email.com"; $from = "my@email.com"; $subject = "New page: ".$page->title; $body = $page->text; $bodyhtml = "<html><body><p>".$page->text."</p></body></html>"; $numSent = $this->mail->subject($subject) ->to($to) ->from($from) ->body($body) ->bodyHTML($bodyhtml) ->send(); } } } } Thanks and good night!
  8. Is there really no way to get a simple "download as pdf" button?
  9. I want to offer a download function to the website visitors ... not only for myself.
  10. I am still using a css with "@media print". What browser feature do you mean?
  11. Hi! I just want to have a simple "download this page as pdf" button on my page. The created pdf should use the print.css. How can i get it? Thanks!
  12. Is there a way to get this running with php 7.3? How can i upgrade the mpdf version? The files that i can download here https://github.com/mpdf/mpdf/releases doesn't look very much like the ones i got in my /site/modules/Pages2Pdf/mpdf folder. Or is this module not usable anymore? Thanks!
  13. Thanks for your answer! But it outputs nothing although there are about 10 versions. When i do a "print_r" it outputs a "1": print_r($page->versionControlRevisions) Any ideas?
  14. Yes! That seems to work! Thank you once again! This is my code that works: $input->whitelist('q', $q); $input->whitelist('tag', $tag); $input->whitelist('sort', $sort); $pagination = $mypage->renderPager(array( 'nextItemLabel' => "next", 'previousItemLabel' => "prev" ));
  15. Hi! I want to use a few values for pagination whitelist, so i can submit all values to the next page. The code of the "next" link should look like this: https://mywebsite.com/search/page2?q=mysearchquery&tag=mytag&sort=desc How can i add this values to my the whitelist: $pagination = $mypage->renderPager(array( 'nextItemLabel' => "next", 'previousItemLabel' => "prev", $input->whitelist('q', $q) )); Thanks!
  16. Is there an easy way to echo the number of page edits / versions? Thanks!
  17. That's easy! Thanks a lot! $mypages= $pages->find("template=mytemplate, sort=mycomments.count, limit=10");
  18. Hi! I want to sort pages by the number of comments that where made to a page. $mypages= $pages->find("template=mytemplate, sort=mycomments, limit=10"); What is the best way?
  19. Thanks for your answer! I changed the .../site path just for the forum post. After restarting the browser (new session) the privace wire toolbar is shown up!
  20. I installed the module and the privacywire code (js and css) appears in my sourcecode (in the head) but the cookie toolbar insn't shown up. <style>.privacywire{position:fixed;bottom:-250%;left:0;right:0;box-shadow:0 -1px 3px rgba(0,0,0,.3);opacity:0;background:#fff;z-index:1;padding:1rem;transition:bottom .3s ease-in,opacity .3s ease}.show-banner .privacywire-banner,.show-message .privacywire-message,.show-options .privacywire-options{bottom:0;opacity:1}.privacywire-header{font-weight:700}.privacywire-ask-consent-blueprint,.privacywire button[hidden],[data-ask-consent-rendered="1"]{display:none}</style> <script>var PrivacyWireSettings={"version":1,"dnt":"0","customFunction":"","messageTimeout":1500,"consentByClass":"1","cookieGroups":{"necessary":"Necessary","functional":"Functional","statistics":"Statistik","marketing":"Marketing","external_media":"External Media"}};</script><script type='module' src='.../site/modules/PrivacyWire/js/PrivacyWire.js'></script><script nomodule type='text/javascript' src='/.../site/modules/PrivacyWire/js/ie_polyfill.js'></script><script nomodule type='text/javascript' src='.../site/modules/PrivacyWire/js/PrivacyWire_legacy.js'></script> Is there somethings missing or do i make a mistake? Thanks!
  21. Thanks a lot!!! It works ... after a while of thinking and testing! Here is the code of my ready.php (located in "site" directory). The module TextformatterProcessImages has to be installed. More Details about the module are here https://github.com/Toutouwai/TextformatterProcessImages/tree/7068b7864dd9e78c9cc4a76d6790957a41198dda <?php $wire->addHookAfter('TextformatterProcessImages::processImg', function(HookEvent $event) { // The Simple HTML DOM node for the <img> tag /** @var \simple_html_dom_node $img */ $img = $event->arguments(0); // The Pageimage in the <img> src, if any (will be null for external images) /** @var Pageimage $pageimage */ $pageimage = $event->arguments(1); // The Page object in case you need it /** @var Page $page */ $page = $event->arguments(2); // The Field object in case you need it /** @var Field $field */ $field = $event->arguments(3); // Only for images that have a src corresponding to a PW Pageimage if($pageimage) { // The original full size image $imgoriginal = $pageimage; // Small image with a width of 390 px $imgsmall = $pageimage->width(390); // Set the code for the lightbox link and image $img->outertext = "<a data-lightbox='image-1' title='zoom in' href='{$imgoriginal->url}'><img alt='{$pageimage->description}' src='{$imgsmall->url}' width='{$imgsmall->width}'></a>"; } }); ?> THANKS!!!
  22. Thanks a lot! I just don't understand, how i get to the original image. $img->outertext = "<a class='lightboxclass' href='MY FULLSIZE IMAGE'>MY SMALL IMAGE</a>"; Thanks!
  23. Any ideas? Or is this the wrong way to do it? Thanks!
  24. Ok, i gave it a try with not much success. Here is my textformatter so far. <?php namespace ProcessWire; /** * Wraps CKEditor image into a tag * eg <img src="/path/to/myimage_300.jpg"> * to <a href="/path/to/myimage.jpg" class="lightbox"><img src="/path/to/myimage_300.jpg"></a> */ class TextformatterLightboxImg extends Textformatter { public static function getModuleInfo() { return array( 'title' => 'Wraps img tag with a tag', 'version' => '1.0.0', 'summary' => "Wraps all img tags with a tag with class lightbox and links it to original image", ); } // public function formatValue(Page $page, Field $field, $value) { public function format(&$str) { $originalimg = $page->bild->url; $str = preg_replace("{<img\\s*(.*?)src=('.*?'|\".*?\"|[^\\s]+)(.*?)\\s*/?>}ims", '<a href="'.$originalimg.'" class="lightbox"><img $1src=$2 $3/></a>', $str); } } I get the error message "Notice: Undefined variable" for page, bild and id. Could you give me an advice? Thanks!
  25. Hi! I want to add an automatic lightbox function to my page. Therefore i want to wrap all my "img" tags (from all image and textarea/ckeditor fields) into an "a" tag that is linked to the original image. In the end this: <img src="/path/to/myimage_300.jpg"> should look like this: <a href="/path/to/myimage.jpg" class="lightboxclass"><img src="/path/to/myimage_300.jpg"></a> What is the best way to archive this? Thank!
×
×
  • Create New...