Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/24/2017 in all areas

  1. Years ago before Wordpress had even been invented, I started work on a site providing information about my local region of New Zealand. Back then, most people were on dialup, and if you wanted a CMS you had to roll it yourself - if you could find a host that supported server scripting at an affordable price. This year, with a quiet patch with essentially no paid work, I finally decided it was time to make the move from a home-grown CMS using an obscure scripting language to something more modern, so I could spend more time adding content and features, and less time maintaining the core CMS. www.marlboroughonline.co.nz I love Processwire because it works the way I think, and when I was first introduced to it, I was up and running within 20 minutes of reading the documentation, vs several hours reading Wordpress documentation, and still not entirely sure how to create my own fields and create a theme from scratch. I come from a database programming background, particularly Microsoft Access, so being able to make fields and add them to a form or report, is the way I'm used to working, although it took a bit of getting used to Processwire not adding fields to a table by default, although I see Pro-Fields or custom field types can achieve this. (I haven't used Pro-Fields in this project as I'm essentially on a zero budget). The site itself doesn't use anything particularly fancy. I use the following modules: Map Marker Form Template Processor Social Share Buttons (With my own colour version of the button icons) AIOM+ (This is particularly handy as I'm using a customised version of Bootstrap, and it handles compiling all the LESS files) Jumplinks The biggest task was importing all the content from my existing CMS, but since I wrote it, it was easier than dealing with some third-party CMS. The site had been around for a long time, and had numerous inward links including a number from Wikipedia, and I didn't want to break them in the conversion. If you're converting a site to Processwire with a URL structure that can't be replicated in Processwire, Jumplinks is a must-have module, as it handles complex URL redirects very nicely. The site has quite a bit of content, much of it which needed updating in addition to changing the CMS, so there might be odd bits that don't look right, but that's certainly not Processwire's fault.
    11 points
  2. Yes, planning on this. May not be in the initial public/dev branch version though. Most definitely. I think that part of it should already work, but have not spent time testing it yet. That's probably one of the next things I'll be testing here, as this would be needed before adding it as a core module. It will work like the existing template/field import, i.e. you'll be able to un-check certain updates that you don't want to occur. Though for applying granular updates, the JSON copy/paste is really nice, as you can also just modify the JSON directly too. Not planning to pursue that. This is purely about page import/export. If it needs a particular Fieldtype module to be present in order to import a field, it'll let you know of the prerequisite. The info about required Fieldtypes are stored in the export, so that the import can look at that before attempting import. This one has already been in the core for awhile. See Setup > Templates, then see the Export/Import buttons at the bottom. We have the same for fields as well.
    5 points
  3. Yes, it is. Go to the Input tab on the field settings and add a value to "Columns of Checkboxes". I forgot to say that the options are going to be divided automatically, you cannot control the column order like you mentioned.
    4 points
  4. You can still use CSS in the admin if you feel so, eg. with Admin Custom Files or AdminOnSteroids, for example.
    3 points
  5. On the subject: https://blog.toggl.com/how-does-music-affect-work-infographic/
    3 points
  6. Added security...similar to wireRenderFile(). Yes you can specify a filename . FieldtypeRuntimeMarkup/fields/my-file. OK. I'll add that as a third option (or as the first option). Sure. But some people may prefer to create include folders in /site/templates/ and /site/modules/ that are shared across the site. Adding a third option above should cater for both worlds. We can't assume everyone will want to include a JS/CSS file . I don't like automating things TBH. I prefer for users to expressly declare a choice. OK. Imagine you are working on a runtime field and want to do some 'minor' JS changes. You are in your IDE and you would just have to create a new js file with the name of your field. But then you have to leave or you forgot to fully test your changes with other Inputfields present on the page and you lock up the whole page edit (yes, that's what JS will do...) . Or...you or a colleague renamed your field and forgot to rename your files... Please see above point. IMO, this is a minor inconvenience compared to the damage automation could cause. OK, maybe I exaggerate but I am not convinced automation is the best approach in this particular case. The field settings are just a click away. Yes, I could include an option to suppress errors but that's no good either. Errors need to be seen so that they can be rectified.
    2 points
  7. You should load your css file from within <head> cause currently you get quickly a version of the pages without css before the css is loaded.
    2 points
  8. The built-in image sizing methods are convenient but they're not the only way to resize an image. You could use a third-party PHP library such as WideImage and save your images with any naming or directory structure you need.
    2 points
  9. #2 makes sense. A quick test shows no problems and it seems that the fields settings are respected. I will do further tests the next days.
    2 points
  10. So maybe it is me who has not spent too much time on it? I see what you mean now. Yep, I guess the label did change but Page == Page Reference, so the latter is more appropriate.
    2 points
  11. Hi PW fanatics In this post I share two of my addHookMethods for those interested. As you surely already know (if not, time to take a look at it) the Wire::addHookMethod() and the Wire::addHookProperty() API methods can be used to "breath some extra OOP" into your projects. Using addHookMethods and addHookProperty are alternatives to "Using custom page types in ProcessWire". The methods I want to share: basically the idea here is to get the URL pointing to images uploaded in the admin without writing much code in the template files. With methods like these below, it does not matter what Formatted value is set to the images, because some predefined defaults are used in all circumstances. #1 Example template file code: <?php $img_src = $latest_article->siteFeaturedImage(); ?> <img src="<?= $img_src ?>" alt="<?= $page->title ?>"> addHookMethod goes into /site/init.php <?php /* Returns URL of the original Pageimage of Article. * Image field's value can be either null (default missing image), Pageimage or Pageimages. * * @return string */ $wire->addHookMethod('Page::siteFeaturedImage', function($event) { $page = $event->object; if ($page->template != "article") { throw new WireException("Page::siteFeaturedImage() only works on 'Pages of article template', Page ID=$page is not such!"); } $article_featured = $page->getUnformatted('article_featured'); //always a Pageimages array if (count($article_featured)) { $img_url = $article_featured->first()->url; } else { $img_url = urls()->templates . "assets/img/missing-article_image.jpg"; //we show this when image is not available } $event->return = $img_url; }); ?> #2 Example template file code: <?php $img600_src = $page->siteProductImageMaxSize(600, 600, ['rotate' => 180]); ?> <img src="<?= $img600_src ?>" alt="<?= $page->title ?>"> addHookMethod goes into /site/init.php <?php /* Generates image variations for Product images. Returns URL of Pageimage. * Image field's value can be either null (default missing image), Pageimage or Pageimages. * * @param int arguments[0] Max allowed width * @param int arguments[1] Max allowed height * @param array arguments[2] See `Pageimage::size()` method for options * @return string */ $wire->addHookMethod('Page::siteProductImageMaxSize', function($event) { $page = $event->object; if ($page->template != "product") { throw new WireException("Page::siteProductImageMaxSize() only works on 'Pages of product template', Page ID=$page is not such!"); } $width = isset($event->arguments[0]) ? $event->arguments[0] : 48; //default width $height = isset($event->arguments[1]) ? $event->arguments[1] : 48; //default height $options = isset($event->arguments[2]) ? $event->arguments[2] : $options = array(); //default empty options $product_image = $page->getUnformatted('product_image'); //always a Pageimages array if (count($product_image)) { $img_url = $product_image->first()->maxSize($width, $height, $options)->url; } else { $img_url = urls()->templates . "assets/img/product-missing-image.jpg"; //we show this when image is not available } $event->return = $img_url; }); ?> BTW, you can find more examples here: How can I add a new method via a hook? Working with custom utility hooks Adding array_chunk support to WireArray addHookProperty() versus addHookMethod() Have a nice weekend!
    1 point
  12. Glad PW worked well for you And thanks for the Jumplinks recommendation. Did you make good use of wildcards? v2 is, sadly, being pushed and pushed as I just have too much on the plate these days... Edit: I see you're using ID-based jumplinks. I assume you used mapping collections / destination selectors?
    1 point
  13. Fixed. The time of modified, created and changlog(module) is reading the database server timezone. I am using a remote database, so the timezone is different from the web server. The issue fixed after changing the remote database server timezone.
    1 point
  14. A Page Reference field will work great for your "Homepage Listung" field. It's no problem to set a Page Reference field using data from a CSV import. You don't say how you are importing the CSV data, but let's say you are using the ImportPagesCSV module. The module readme says... Probably the easiest way in your case is to use the title of the page. So a basic outline of what's involved... The template for the pages in your Page Reference field should contain the "Title" field and a "Label" text field. Create the pages for the Page Reference field - one for each option that might occur in your CSV data. For the page Title use the value that appears in the CSV data. For the page Label use the label that belongs to that value. Example... Title: "NE2", Label: "n. Endkundenrelevant" Create the Page Reference field and add it to the template used for the pages you will be importing. Specify the pages you just created as the "Selectable pages". For the "Label field" setting, choose "label". Import your CSV data using the ImportPagesCSV module. Done.
    1 point
  15. Maybe I'm just going mad but I sat down to start working on my site today, and I couldn't add a "Page" field type. Existing Page fields say their type is "Page Reference" The Page field type is installed as usual. Did I miss a change where Page Ref and Page were consolidated?? I thought they were different things. I'm really confused. I have a funny feeling someone is going to reply and tell me they're the same thing and I'm an idiot, but I'm confused as to what has changed. This is the first 3.0.6x site I've done, guess I just missed some change?
    1 point
  16. Scrap what I said about Notifications. I'm still very confused. If anything I think I've spent too much time setting up Processwire Fields Ok to simplify, I'm making a new field. Here's the last site I worked on (3.0.42) And here's my current site (3.0.62): Seems like the latter is showing field type titles and not field type names? Is that the only difference?
    1 point
  17. Thanks @bernhard, that tip will come in handy a bit down the road when I'll have to build reporting tools for this project. Great stuff!
    1 point
  18. Aha, yes! Thank you! I keep forgetting that we have unformatted values too. I updated both methods in my original post. Cheers,
    1 point
  19. Nice tutorial, thanks! You could simplify the methods a little by making sure you always get the Images field as a Pageimages array, e.g. $wire->addHookMethod('Page::siteFeaturedImage', function($event) { $page = $event->object; if ($page->template != "article") { throw new WireException("Page::siteFeaturedImage() only works on 'Pages of article template', Page ID=$page is not such!"); } $article_featured = $page->getUnformatted('article_featured'); // always a Pageimages array if (count($article_featured)) { $img_url = $article_featured->first()->url; } else { $img_url = urls()->templates . "assets/img/missing-article_image.jpg"; //we show this when image is not available } $event->return = $img_url; });
    1 point
  20. as a next step i would recommend you try the processhello module soon! i was somehow afraid of building process modules but it really made "click" in my head once i got it. and it's often a lot easier to create a processmodule than hooking and modifying the page edit forms or messing around with runtimemarkup fields. give yourself 30 minutes, copy the processhello to a sandbox site and then see somas thread about building forms via the API. this will warp you to the next level using the InputfieldMarkup you can build your own custom HTML easily that has the look&feel&features of all the other admin fields: public function ___execute() { // set headline + browser title $headline = __('Awesome!!'); $this->wire('processBrowserTitle', $headline); $this->headline($headline); // create form $form = $this->modules->get('InputfieldForm'); $form->action = './'; $f = $this->modules->get('InputfieldMarkup'); $f->value = '<h2>wow!</h2><div>you can do anything now with that knowledge ;)</div>' $form->add($f); return $form->render(); } untested
    1 point
  21. @heldercervantes Sounds good. I had a similar need for custom email templates and built a module for that too (along with a helper module.) You might find it useful in your application, too. Both modules are fairly old now - YMMV. Best wishes!
    1 point
  22. Here's the solution I've found: disabling tags on the image field sorted all problems. Tags were enabled for that image field but not used.When I disabled tags, everything came back to normal and the site shred off all excess processing time. First byte time is 1s or less now. @ryan, is it a bug or there's an explanation for this behaviour? Enabling tags brings back the slowness again. All of that is happening on A2 reseller hosting (shared hosting with LiteSpeed, PHP 7.1 running as lsphp process) while speeds were satisfactory on my small VPS (2 cores, 2Gb RAM, Apache + PHP 5.4).
    1 point
  23. Ok, I've found the bottleneck that causes many seconds delay in processing time. When I uncomment the lines below in different foreach loops, processing time drops by 6s. The images->first statement is called about 9 times for the home page. $block_img = $pageblock->images ? $pageblock->images->first() : null; and $img = $block->images->first(); I'm running the latest version of PW. Edit: When I had a look at the "images" field in Setup > Fields I noticed that opening that page also took 10+ seconds that is weird. I suspect that I have a trouble with that field somehow but how to debug this issue?
    1 point
  24. Feeling the love for ProcessWire today. Two sites launched and owners over the moon happy. Two additional sites ordered by existing clients and both specified ProcessWire as the platform. New sites: 1. https://flywithmehorses.com.au/ Owner is just starting out in business and had already spent $100's dollars and 6+ months on a 'free' website without success. She helped me so I sponsored development of her site. Client's comment: "OMGOSH this is sooo exciting!!!!!!! YAY!! Thank you alot!!!!! Can't wait to tell everyone!!! THANK YOU!!!" ProcessWire 3.0.63 2. https://cttcfilmcourse.com/ Original site built in WordPress. Over 1000 lines of code on the home page and the https://validator.w3.org/ bombed out at line 124 with "Too many errors". Google's page speed insights were cringingly bad. Project was to keep the visuals and rebuild the site in PW with a solid foundation. Job done. No validation errors and vastly improved page speed insights. Also added search and better site navigation. Client's comment: "So good!" ProcessWire 3.0.63 Looking forward to working on the next two sites, both of which will be website apps with workflows rather than informational sites. As ever, grateful for comments/feedback to improve either site.
    1 point
  25. I woke up this morning and this was the very first forum topic I had read. I was really happy to start the day with a ProcessWire success story, it made my day. Thank you for sharing it with us and keep up the good work! Cheers from the other side of the Globe
    1 point
  26. i am having this issue as well. it happens when i try to save certain pages on the back end. i click save, it takes me to the error page, when i go back to the page i was trying to save, the content i added is missing.
    1 point
  27. Are you sure about namespaces? Do you declare them in _header.inc.php?
    1 point
  28. @bernhard CronjobDatabaseBackup and ProcessDatabaseBackups are siblings. I put them a little closer together.
    1 point
  29. Which cache? Template cache you would go to the PageRender module settings and delete cache.
    1 point
  30. More use cases for pages-as-image-picker: News sites - a generic article with no photos gets a generic accompanying image, e.g. an EU flag for EU stories, a police car for police stories, etc. There can easily be hundreds of such stories, and dozens of such photos. It's not very elegant to make users upload the same photo 200 times. Donated images - It's common for nonprofits to be donated use of photos for x years, but they must ensure the photos are properly described and credited every time they're used, and are replaced when the contract is up. This is pretty much impossible without central image management, especially with multiple users.
    1 point
  31. +1 for this. As LostKobrakai pointed out, this wouldn't be an extension of FieldTypeImage. Maybe just an InputField like that used for Image, but storing a reference similar to a Page fieldtype. One case where this would be very useful is for selecting the image that will be used in the og:image meta tag. You want a single-image inputfield that selects from the images that have been already loaded to Image fields on the page. I'd love a field that has a setting for which page(s) images would be selectable from. So you could fix a page or pages (e.g. current page) in the settings, or allow the selection of a page from the inputfield (like what is possible in an RTE field). I think a field like this would be a great asset in PW - if there are use cases for selecting images from external Image fields within an RTE field then there are bound to be use cases for selecting them in a dedicated "image reference" field.
    1 point
×
×
  • Create New...