Jump to content

kongondo

PW-Moderators
  • Posts

    7,479
  • Joined

  • Last visited

  • Days Won

    146

Everything posted by kongondo

  1. xdebug has always been slow (all over Google). Some things you can do Disable xdebug Profiler Disable xdebug Profiler enable trigger Disable xdebug auto trace Disable xdebug auto start (if you can) Helpful hints http://www.devinzuczek.com/anything-at-all/i-have-xdebug-and-php-is-slow/
  2. @SamC, Moderator Note FYI, you posted 3 other copies of this thread. I am guessing you were on mobile, or your computer was a bit wonky. I've deleted the other three.
  3. @dweeda, Moderator Note Multithreading is not allowed. Please, do not open different topics regarding the same issue. Keep it in one place. I have merged your other thread with this one.
  4. From the repo. Browse the repository commits and click on the commit shown in the screenshot below: That will take you to the page where you can clone/download that version.
  5. loadPageField() is required to stop the field from visiting the database. There is a comment right there in the method . If we remove the method, it will just call its parent loadPageField() (Fieldtype.php). Hence, we override it. We can have it return true. That results in renderMarkup() being called once only (rather than twice currently - once each for wakeupValue() and loadPageField()).
  6. @adrian, I have tested and cannot replicate this. I tested with both single and multi page reference fields using different inputs (Asm, Checkboxes, etc). I also tested using render via code and via wire('files')->render('some-file'). This is what I get if I put bd($page->id) at the top of renderMarkup(). 1367 is the ID of the page being edited. The pages saved in the page reference fields are not called. Edit I think there is something else going on in your install. There is nothing peculiar about the field. Apart from renderMarkup(), all the other methods are ProcessWire Field methods. Theoretically, it means if a bug exists, then all Fields should be exhibiting the same behaviour.
  7. Hi @Bacelo, Achievable from version 0.1.5 using the getMenuItems() method (see examples here) or from version 0.1.8 using the 'disable menu items' feature. Please note that support for ProcessWire 2.x ceased with version 0.2.2. In your case, you can upgrade Menu Builder up to version 0.2.1. and you'll be fine. If you can though, I'd advise to upgrade to ProcessWire 3.x.
  8. Hi Alex. Not yet. Illness, Easter and Hay Fever all colluded against me. Please note that I'm also upgrading Jquery File Upload alongside Media Manager. I'm working as fast as I can .
  9. Hi @harmvandeven, Welcome to the forums. Thanks for the purchase. Currently no, but it's something I've thought about, briefly. I've not been able to decide how to best implement it. For instance, they would need to live under /video/. However, that would require a video file to be uploaded. Also, should the videos be embedded or not, etc? Thinking out loud, maybe we should have a different media type for online content - mainly for YT and Vimeo. What's the workflow? Your custom module gets the thumbnails and then you upload these as images to Media Manager? Do you want them to be able to play the related videos by clicking on the thumbs? Frontend, Backend? Sounds cool. Hard to tell without knowing more about how your modules work. We can discuss here or in PM or email if you wish.
  10. Hi @adrian, ___wakeupValue is needed for frontend access. I am assuming some people use the field in the frontend. ___sleepValue should be able to work with return true only. I'll have to investigate deeper though. The whole module is based on Ryan's concat field. These methods were copied as is (or almost) from that module. So, his module must be having the same issues then. I'll have a look sometime. Still no ETA though, sorry.
  11. How did you update ProcessWire. Using some module? Manually? For now, are you able to downgrade ProcessWire to the last stable version you had? What version of ProcessWire was that, 3.0.62? Does it work then? You can then upgrade incrementally, e.g. 3.0.62 to 3.0.7x to try replicate the issue. If you are able to do the test on a local server first, the better. I'm probably clutching at straws here...
  12. Sort order in database can affect the results returned. So, unless you are 'finding' everything, it is good to have the option to sort server-side.
  13. I suppose because it runs off Amazon's servers...?
  14. Hi @adrian_gp, Welcome to the forums. Let's say you have a category 'Technology' whose URL is /categories/technology/. In the template file of the template CategoriePage, you can do this: // @note: we set a limit here. You can use pagination if you have many posts $posts = $pages->find("template=BlogPost, limit=10, categories=$page"); $out = ''; // category title $out .= "<h2>{$page->title}</h2>"; // found posts in this category if($posts->count) { foreach($posts as $post) { $out .= "<h3><a href='{$post->url}'>{$post->title}</a></h3>" . "<p>{$post->summary}</p>";// assuming you have a summary field } // no posts in this category yet else $out .= "<p>No posts found in this category</p>"; echo $out; Quickly typed in the browser, check for errors, just an example. Btw, there are blog profiles and a Blog module you can look at for more examples.
  15. I don't know . But this is what Google says . I trust Google 100% (), so this must be correct. OK, so, it's StackOverflow. I trust SO .... <script type="text/javascript"> function loadXMLDoc() { var params = "lorem=ipsum&name=binny";// your data to the server var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == XMLHttpRequest.DONE) { // XMLHttpRequest.DONE == 4 if (xmlhttp.status == 200) { document.getElementById("output").innerHTML = xmlhttp.responseText; } else if (xmlhttp.status == 400) { alert('There was an error 400'); } else { alert('something else other than 200 was returned'); } } }; xmlhttp.open("POST", '../my-url/', true); xmlhttp.send(params); } </script> source
  16. @zimali. Consider this your final warning. You have been posting Drupal stuff in the ProcessWire forums. You have, presumably, ignored my request for clarification. This has trolling written all over it.
  17. Oh yes. Very much so. Try it yourself. Edit a value in chrome dev and inspect what's been sent. I forgot to mention. If you are not doing it already, use CSRF protection and a honey pot.
  18. It's always good to sanitise and validate. You don't lose anything. The only things you don't sanitise are passwords (just validate) and usually, a submit button (just check if post sent). Regarding the radio buttons, you are using $sanitizer->option which is validating the options sent. Implicitly, you are sanitising here as well since you provide the array of sanitised values. Yes. Sanitise it too as necessary. But, these depend on what you are going to do with the values. General practice though is to sanitise at the earliest opportunity. There is also encoding of html entities if you are going to be echoing back input values. So, this... echo $sanitizer->entities($str);
  19. ?? This is the ProcessWire forum. Please clarify your post.
  20. I've been using the Auto-Open Markdown Preview extension. Works a treat. Only problem I have with it is that it does not auto-close the preview when the markdown file is closed.
  21. @gmclelland, Moderator note: Moved your post here as it seems to be related to this module.
  22. A recent similar topic...Maybe the suggested approaches there will help?
  23. Something like this... // your functions function doSomething($) { // @note: non-self-executing function // 'config' is a global PW variable var text = config.demo; $("h2.tagline").addClass("color-red"); console.log(text); } // ready jQuery(document).ready(function ($) { doSomething($);// pass jQuery ($) if needed });
  24. Here's a ProcessWire 3 example. ProcessWire does all the heavy lifting regarding headers, etc. Please see comments in the code and the assumptions made. In this example, we assume a download link is present on the page. Modify the code to suit your needs, if you find it useful . <?php namespace ProcessWire; // @todo: you can add an Array $options parameter to pass to $files->zip() function createZip($zipfile = '', $filesToZip = array()) { // @see: https://processwire.com/api/ref/files/ $files = wire('files'); // @todo: error checks here, e.g. if $zipfile (destination) is empty; // save zipped files to disk // @see: https://processwire.com/api/ref/files/zip/ $files->zip($zipfile, $filesToZip); // force download of zipped files // @see: https://processwire.com/api/ref/files/send/ $files->send($zipfile, array( 'forceDownload' => true, 'exit' => false )); // delete zip file on server after download unlink($zipfile); exit; } $result = array(); $imagesArray = array(); $zipImages = array(); // grab and sanitize image names string in $_GET parameter 'images' // in this example, names are comma-separated $images = $sanitizer->entities($input->get->images); // if we have a 'get' input if($images) { // create array of image names (array('image-1.jpg', 'image2.jpg')) etc $imagesArray = explode(',', $images); // sanitize each image name as per ProcessWire filename expectations $imagesArray = $sanitizer->array($imagesArray, 'filename'); // if we got an array of sanitized image names if(count($imagesArray)) { // get the image repository // in this example, we store all images in one page in... // ... an image field named 'images' $imagesPage = $pages->get("/zip-files/zip-file-images/"); // create selector to find images requested in $_GET // this example assumes $_GET parameter 'images' contains image basenames // @note: we make sure image names are lowercase // selector: "basename=image-1.jpg|image2.jpg" $imagesSelector = mb_strtolower(implode('|', $imagesArray)); $images = $imagesPage->images->find("basename={$imagesSelector}"); // if we got a match if($images->count) { // create array of full disk paths to the image files $zipImages = $images->explode('filename'); // just making sure we got an array back if(count($zipImages)) { // name of zip file to create (or update) $zipfile = $config->paths->assets . "my_zip_".time().".zip"; // create zip file + force download //$result = createZip($zipfile, $zipImages); createZip($zipfile, $zipImages); } } } } // assuming $_GET will contain image basenames $downloadImagesLink = "/zip-files/zip-file-test/?images=abstract.jpg,Tree-Wide.jpg,fashion.jpg,dessert.jpg,citrus_fun.jpg"; ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php echo $page->title; ?></title> <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>styles/main.css" /> </head> <body> <h1><?php echo $page->title; ?></h1> <?php $out = "<p>Download Zipped Images</p>"; $out .= "<p><a href='{$downloadImagesLink}'>Click to download</a></p>"; echo $out; ?> </body> </html>
×
×
  • Create New...