Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/16/2020 in all areas

  1. Welcome to the forums! "What about for things that are module-specific?" Lots of old modules still work on current ProcessWire versions, but it is recommended to do a forum search in the related forum topic where you can also ask the developer. "Related to the core stuff?" The core is constantly being refactored by Ryan but normally we should use the API anyway. So most of the time this shouldn't be of anyone's concerns. "Related to templating?" Generally speaking any old code based on the API should still work as expected. Depreciation is rare if any, and Ryan is trying not to introduce changes that break old code. "Related to the API specifically?" See my previous answer above ? Others might join in and shed more lights on things, but this is what came to my mind ? EDIT: Probably PHP deprecations can cause more issues than changes introduced in ProcessWire.
    7 points
  2. Spent too long getting this to work so I've made a short github gist and have included it here so people don't have to ? https://gist.github.com/benbyford/ada3a229501c769880b0aa2b13276d3e I've added this php instead of the normal page in my templates when a /cal url query is preset.
    3 points
  3. Yes, you enter database information when you restore the backup (try it).
    2 points
  4. No worries - good to know ? I think this really means that you need to figure out how to get one.com to change that setting, or move to a decent host. I just think there are going to be other issues with using them, not just this one. I know that's not what you want to hear, but cheap shared hosting just ain't worth it. I would really recommend a Digital Ocean or Linode VPS - they are really cheap and if you install an admin panel on top, you won't even need to spend much time on the command line if you're not up for it, although you might actually enjoy it if you experiment ?
    2 points
  5. If you, for what ever reason, need to present a link to a static *.ics file for download, you can add this line to the servers .htaccess file instead have to send http headers: AddType text/calendar .ics
    2 points
  6. Thanks for the info and the welcomes ? So far I really dig how this is setup, but definitely still learning the ropes, so that helps give me the confidence that I shouldn't worry too much. I've got a bit of an ambitious project so I'm sure you'll see me around, and hopefully I can eventually contribute something!
    2 points
  7. I just deleted my post while the post from @szabesz chimed in, and he has written it in a more structured way then what I had done. So, nothing to add from me here. @Jared Welcome to the forums. ?
    2 points
  8. This could be useful: https://github.com/spatie/calendar-links
    2 points
  9. @Macrura - You really deserve a gold medal a) for the speed you responded and b) for how the module sailed through all the articles, pulling in all the images smoothly. On (3) however, I wasn't successful as somehow the script didn't work in Tracy Debugger's console but not to worry ... I went to Batch Child editor where I 'Unpublished' the articles in bulk and published them again. In the process your module pulled in all the images. ;) Once again, Thank you very much!
    2 points
  10. Have you ever tried on-demand downloading of files? https://processwire.com/blog/posts/pw-3.0.137/#on-demand-mirroring-of-remote-web-server-files-to-your-dev-environment This works really great. You can start with a completely empty files folder and PW will download all requested files on demand - either on the frontend or on the backend.
    2 points
  11. I'm working on a module that scans the textarea field and imports external images, and replaces the reference to them in the editor with the local version. This is the function that is hooked after Page save. Mods: http://modules.processwire.com/modules/import-external-images/ Github: https://github.com/outflux3/ImportExternalImages
    1 point
  12. You are posting in the support thread for the third-party Image Extra module. This is already reported in the GitHub issues repo: https://github.com/processwire/processwire-issues/issues/1070
    1 point
  13. Hi all! Issue with script insert to the head section is now fixed in version 1.2.3 https://github.com/BlowbackDesign/EmailObfuscation/releases/tag/1.2.3 @CalleRosa40 and @Brian Williamson please update and report back if you're still facing any problems. @creativejay and @Robin S - EMO has skipped form tags on obfuscation since day one and I haven't been able to reproduce this error so I'm kind of lost here why are you guys facing this issue with recent 1.2.x update. For example, none of the addresses in the markup below are not touched: <form action="/"> <p>john@doe.com</p> <input type="text" name="email" value="john@doe.com"> <textarea name="message">john@doe.com</textarea> </form> Using no-emo class on element to avoid obfuscation is a nice idea but not so easy to implement safely to the current logic based on regular expressions.
    1 point
  14. Hey! No I think we're thinking of models the same; I didn't mean to imply that they would be tied to their routes, as the templates (basically) are in PW. I do mean models entirely separate from routing, thereby allowing for routes to be specified as needed and totally custom. The ways you mention with parent pages and URL segments I've tried, but still don't prefer totally overall, all the time... Yes, define routes abstracted. For example for a car sales website... which could totally be done in PW as-is, but for one thing I would not really want the listings to even be in the tree view in the admin... Maybe it could just be a module that would allow for creating templates and admin views of pages (?) outside of the page tree that then can be controlled and moved around (?) more easily (?) in views for those within the tree. That's probably just fine. Sorry this is a really rough idea. I don't believe I'm making it any clearer. Apologies.
    1 point
  15. @NoremPload - this functionality is now in the PW core: https://processwire.com/blog/posts/pw-3.0.142/#custom-fields-for-files-images I would recommend that over this module now.
    1 point
  16. Chances are you'll be fine with the $5 / month plan: https://www.linode.com/pricing/ The DNS stuff is mostly just a matter of pointing your domain to the IP address of your linode. I don't have any significant experience with control panels, but server pilot sounds like a decent choice, but perhaps others will chime in. I set up LetsEncrypt via the certbot tool on the command line, but there might be a way to do that via on of these control panels. If one.com won't change that setting, perhaps they'll give you your money back ?
    1 point
  17. Sorry i looked closer in Tracy and found this error:
    1 point
  18. I need to know whether the page list COPY button also works without an error. Sorry, just saw that reply. Other than that, I'm afraid my only other move is to look at the server directly because I don't understand the filecompiler problem without those other things I asked you to test also being a problem, because they are all coming from PW calls to set_time_limit.
    1 point
  19. And does it work, or give an error?
    1 point
  20. @ottogal You can change default grid mode to "vertical list"
    1 point
  21. It looks like you already have ProcessPageClone installed - do you have the "copy" button in the Page list action buttons? Not sure where to go from here - I feel like one.com should be failing on those PW core calls to set_time_limit() as well. Any chance you can give me access to the server - either this one, or another test one at one.com?
    1 point
  22. Can you try a few different things for me: 1) Empty the PW trash 2) Do a field export (from the main fields list page) 3) Install the core ProcessPageClone module and click the new "COPY" page list action button If those all succeed without error, I'll revisit, but otherwise I'll need to update Tracy to be PW 3.x only so that it avoids the FileCompiler completely. That would solve the Console and APIExplorer panel error. The PW Info panel error is due to the Versions List feature trying to check if the system allows runtime modification of max_execution_time so I could conditionally remove or deal with that, but I'd like to make sure those other core PW things work on that host first. It's also weird how one.com seems to disable set_time_limit / max_execution_time some other way - ie not in disable_functions - make it much harder to detect.
    1 point
  23. If the other bar says AJAX, then that is expected, but your screenshot didn't show that at all, hence my question. Looking at the error messages for the Console and API Explorer panels more closely, it shows it's actually coming from PW's core FileCompiler.php file on line 384. The PW core uses set_time_limit in many places: https://github.com/processwire/processwire/search?q="set_time_limit"&unscoped_q="set_time_limit" so I think your only decent option is a different host because from what I can tell, one.com doesn't let you enable set_time_limit.
    1 point
  24. @EyeDentify - could you also check whether set_time_limit is actually in the php.ini disable_functions list?
    1 point
  25. Hi @EyeDentify - what host are you using? Any chance it's nextcloud or one.com ? https://github.com/nextcloud/server/issues/16752 I can see why you might be getting the error in the PW Info panel, but am confused about the other two. Can you please try disabling the PW Info panel and see if that fixes the other two as well. If it does, then I think we might be able to do a try / catch for the PW Info panel that will fix it. Finally, do you know why there are two copies of the main Tracy bar - that looks strange to me.
    1 point
  26. Thank you for a fantastic module. Would it be possible to exclude the database from the backup? I ask because it get a timeout when running the backup, and I can move the database (which is quite large) by other means.
    1 point
  27. That's only part of the problem though. The main(?) issue is echo'ed scripts and styles are not getting output on the page.
    1 point
  28. Considered @Robin S I also have a bad connection (working with a 4G router) and it's definitely a good feature request. I will try to implement it asap, but I would like to release first the module with the native backup feature but I lack time. I will try to do my best. Thanks for the link @bernhard Thanks again guys, I hope you're all fine here ??
    1 point
  29. Thanks for the reminder - I just tried this for the first time and it works well. I still think it would be a nice feature to add to Duplicator because it's more efficient time-wise to download all the images you need in one hit while you have a coffee rather than page by page as you edit. Plus I reckon people will find other use cases for selectively including page files in a backup.
    1 point
  30. @Pretobrazza, OK (1) so i just made a small modification which will convert the extension to all lowercase before it checks the field settings - each field has a list of allowed extensions; i'm guessing you don't have both jpg and JPG, so this will solve this hopefully. (2) Processwire expects an integer for image width, so if there is a % in the width, i guess the imagesizer is fatal error. I don't think it is technically correct to have anything other than an integer in the width attribute, but I have updated the module to skip resize for any images that have a percent in the width attribute. (3) You can run a simple script in Tracy Debugger; $p = $pages->get([page id]); foreach($p->children as $c) { $c->of(false); $c->save(); } @Pete - sorry for not replying to your post, i wasn't following this topic for some reason, so i didn't see your post. I'll look into the multilanguage thing, so that it scans all of the languages. I'm. guessing that right now it doesn't work at all for importing images in a multilanguage RTE field.
    1 point
  31. It doesn't seem to be a files' permission issue. For instance, when the following files are accessed directly, they show up: classie.js, bootstrap.js, jquery-1.10.2.js,custom-root, vegas.min.js, bootstrap.css and vegas.min.css. I suspect there's an issue with the template file itself or the page we are seeing (the home page) is actually reading/using a different template file from the one you think it should use. For instance, in your code above, there is no markup for po-home.js yet it is getting loaded when we view your site (unless you just left it out in your first post). Are you able to copy and paste your entire .php (template) file here? (the one with all the markup in your first post). Confirm if the home page is supposed to use that template file. Your ProcessWire version.
    1 point
  32. Hi @flydev ??, A feature request... It would be awesome if there was a feature to enter a selector string that determined the pages whose files will be included in the backup. So that if the selector string was "template=basic-page" then in the backup the only directories inside /site/assets/files/ would be those belonging to a basic-page. My use case is that I sometimes need to copy a site to my local machine to do some work, but that work only involves one part of the site. My connection speed is not great where I live (particularly upload speed) so it would be a big help if I only needed to download/upload the related files and not all the site files. Thanks for considering. ?
    1 point
  33. I cannot see any place where you want to load the mentioned js scripts. But I spotted something in your js file, the only one that gets loaded (http://www.permaculturaorganica.info/site/templates/styles/assets/js/po-home.js). There you use a bunch of bg-images with relative (sub) pathes. Have you tried to use absolute URLs instead? // Slideshow Background. (function() { // Settings. var settings = { // Images (in the format of 'url': 'alignment'). images: { 'styles/assets/img/sfondi/po-index/bg0.jpg': 'center', 'styles/assets/img/sfondi/po-index/bg1.jpg': 'center', ... the above with absolute URLs for the images: // Images (in the format of 'url': 'alignment'). images: { '/site/templates/styles/assets/img/sfondi/po-index/bg0.jpg': 'center', '/site/templates/styles/assets/img/sfondi/po-index/bg1.jpg': 'center', ...
    1 point
  34. The way other is to simply change the name of the page to match the ID is a hook in your ready.php // rename page to match its page ID $this->wire()->addHookAfter('Pages::added', function($event) { $p = $event->arguments[0]; if($p->template != 'basic-page') return; $p->setAndSave('name', $p->id); }); One thing to note in your module - you are hooking on "save", so it will rename it every time it is saved. If you need the other functionality of your module, perhaps you can change to Pages::added ?
    1 point
  35. Just something I was trying out recently that might be useful to someone... With the following hook added to /site/ready.php you can adjust the CKEditor toolbar that a particular role gets for a particular field. Use the name of your CKEditor field in the hook condition. $this->addHookBefore('Field(name=my_ckeditor_field)::getInputfield', function(HookEvent $event) { $field = $event->object; // Define toolbar for a particular role if($this->user->hasRole('editor')) $field->toolbar = 'Format, Bold, Italic, -, NumberedList, BulletedList, Outdent, Indent'; }); Or what I find useful on some sites is adding extra toolbar buttons for superuser only that you don't trust editors to use. $this->addHookBefore('Field(name=my_ckeditor_field)::getInputfield', function(HookEvent $event) { $field = $event->object; // Add extra buttons for superuser only if($this->user->isSuperuser()) $field->toolbar .= ', Table, TextColor'; }); You could use the same technique to selectively define other CKEditor settings such as 'stylesSet', 'customOptions', 'extraPlugins', etc.
    1 point
  36. I just want to share my findings from today when I wanted to create one million pages quickly: First, via Tracy Console: ini_set('max_execution_time', 150); $last = $pages->findOne("parent=/data,include=all,sort=-id"); $last = (int)$last->title ?: 0; for($i=$last+1;$i<$last+1000;$i++) { // create page $p = new Page(); $p->template = 'basic-page'; $p->parent = '/data'; $p->title = $i; $p->save(); l("saved page $i"); $pages->uncacheAll(); gc_collect_cycles(); } d('done'); It started at 23 pages per second: And at the end of the 150 seconds it was already down at 4 pages per second: Testing without logging: Memory usage also increased proportionally. Finally running a PHP script from the command line that bootstrapped PW worked well: <?php namespace ProcessWire; $time_pre = microtime(true); include("../../../index.php"); // bootstrap ProcessWire $last = $pages->findOne("parent=/data,sort=-id"); $i = (int)(string)$last->title ?: 0; // multilang quickfix convert to string // foreach($pages->find('parent=/data') as $p) { // $p->delete(); // echo "deleted $p\n"; // } // return; $i++; $num = 0; while($i <= 1000000) { // create page $p = new Page(); $p->template = 'basic-page'; $p->parent = '/data'; $p->title = $i; $p->save(); $pages->uncacheAll(); gc_collect_cycles(); $num++; echo "done: $num ($i)\n"; $i++; } function convert($size) { $unit=array('b','kb','mb','gb','tb','pb'); return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]; } $time_post = microtime(true); $t = $time_post - $time_pre; $m = memory_get_usage(); echo "created $num pages in " . round($t, 3) . "s, " . round($t/$num, 3) . "s per page, used " . convert($m) . " memory\n"; Benefits: quick runs in the background and does not lock the site direct feedback via echo without creating huge log files cancel via ctrl+c any time easy persistant saving of your scripts
    1 point
  37. I found a way to solve my problem, the Post helped me too: The code looks the following and works with the TemplateEngineModule. If you want my solution to work without the TemplateEngineModule, remove the line $view->setFilename('person');. Template person_listing Settings in Backend: The allowed Page URL Segments: regex:^[0-9a-zA-Z\-\_]+$ Template person_listing.php Code: if ($input->urlSegment1) { $pagename = $input->urlSegment1; $match = $pages->get('name='.$pagename); if (!$match->id) throw new Wire404Exception(); $view->setFilename('person'); // Remove this line if you don't use TemplateEngineModule! echo $match->render(); return $this->halt(); } Hope this helps someone else.
    1 point
  38. Based on the screenshot menu_item is definitely a page field. $pages->find() gives you an instance of PageArray and like @diogo already mentioned, you can't ask field "menu_item" of that PageArray -- it contains multiple Page items and doesn't have any fields of it's own. You'll have to first get individual Pages out of that PageArray: // this gives you first Page object found with your selector; if you're sure // that there's never going to be more than one Page, this should be fine $items = $pages->find('template=menu, title=Toolbar Menu, include=all'); foreach ($items->first()->menu_item as $item) { ... } // another thing you can do to get only the first result is use 'get' instead of 'find' $items = $pages->get('template=menu, title=Toolbar Menu, include=all'); foreach ($items->menu_item as $item) { ... } // if there's a possibility of multiple 'menu' pages, you need to use another foreach $items = $pages->find('template=menu, title=Toolbar Menu, include=all'); foreach ($items as $menu_page) { foreach ($menu_page->menu_item as $item) { ... } } Got it?
    1 point
×
×
  • Create New...