Leaderboard
Popular Content
Showing content with the highest reputation on 07/21/2017 in all areas
-
This week we've got more to tell (and show) you about our upcoming page export/import feature, along with several screenshots of the progress: https://processwire.com/blog/posts/processwire-3.0.68-and-more-on-page-export-import/11 points
-
@ryan thanks a lot! I had a little use case where I couldn't resist to use the new feature. It was only for pages with text fieldtypes. I used two little bootstrap scripts to export & import some pages. export.php import.php7 points
-
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(); } untested5 points
-
I forked this module and made it PW3 compatible. See the readme and the commit for details of what was changed. https://github.com/Toutouwai/ProcessBatcher If folks want to test it and report back I can make a pull request for @Wanze. @tpr, I hid the AdminOnSteroids datatables filterbox and the title case-change button because the layout was a bit messed up. Maybe you could take a look at that when you have time?4 points
-
@Vayu Robins, to be honest I wouldn't be surprised if it wasn't. Repeaters, I believe, are somewhat supported, but Repeater Matrix is a lot more complex, at least as a concept. I'll look into this as soon as possible. @apeisa, I'll look into that image issue too. Unless that's really easy to fix, it might be time to release a 3.x branch of this module though. Could probably solve a bunch of things more cleanly now. API level tests still look good, so I'm thinking that this file issue might have something to do either with the "recent" UI updates, or perhaps the temp file thing..3 points
-
3 points
-
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!2 points
-
This will make a great update, thanks! Is multilanguage support planned?2 points
-
Thank you @ryan, pretty impressive so far! Just one question: are we going to be able to save "presets" too? So that predefined export/import settings can be made available when needed.2 points
-
Damn were you right. I'm hooked. Refactoring a bunch of stuff with a grin from ear to ear.2 points
-
How easy you find converting a static template for PW will depend very much on your experience with PHP. You don't need to be an expert, just comfortable using variables and a few loops. Take a look at the site profiles that come with the PW download, and see how they are structured. There are many different ways to organise your template files - probably as many different ways as there are PW users! Finding a system you are comfortable with is probably the trickiest bit. Take a look at this tutorial specifically, and try to work out how to apply whichever strategy you prefer to the template you have. <aside>I'm sure somebody did a video on converting a downloaded theme but I'm damned if I can remember the details. If no one has, then someone should.</aside>2 points
-
That's a good one. The MailChimp one is good too. https://templates.mailchimp.com/resources/inline-css/ I'd love to keep the amount of steps for my client right down but at some stage they'll probably need to use this maually. Thanks for the link2 points
-
This module tracks changes, additions, removals etc. of public (as in "not under admin") pages of your site. Like it's name says, it doesn't attempt to be a version control system or anything like that - just a log of what's happened. At the moment it's still a work in progress and will most likely be a victim of many ruthless this-won't-work-let's-try-that-instead cycles, but I believe I've nailed basic functionality well enough to post it here.. so, once again, I'll be happy to hear any comments you folks can provide https://modules.processwire.com/modules/process-changelog/ https://github.com/teppokoivula/ProcessChangelog How does it work? Exactly like it's (sort of) predecessor, Process Changelog actually consists of two modules: Process Changelog and Process Changelog Hooks. Hooks module exists only to serve main module by hooking into various functions within Pages class, collecting data of performed operations, refining it and keeping up a log of events in it's own custom database table (process_changelog.) Visible part is managed by Process Changelog, which provides users a (relatively) pretty view of the contents of said log table. How do you use it? When installed this module adds new page called Changelog under Admin > Setup which provides you with a table view of collected data and basic filtering tools See attached screenshots to get a general idea about what that page should look like after a while. For detailed installation instructions etc. see README.md.1 point
-
Nice one. Just another way to skin the cat... <?php $testimonials = $page->testimonials; $testimonials->shuffle(); $firstTestimonial = $testimonials->shift(); ?> <div class="jumbotron jumbotron-fluid bg-color"> <div class="container"> <h2><?= $firstTestimonial->title; ?></h2> <p><?= $firstTestimonial->testimonialBody; ?> - <i><?= $firstTestimonial->testimonialReviewee; ?></i></p> </div> </div> <div class='container'> <div class='row'> <div class='col-6'> <?php foreach($testimonials as $index => $testimonial): ?> <?php if($index == ceil(count($testimonials) / 2)): ?> </div> <div class='col-6'> <?php endif; ?> <h2 class='py-3'><?= $testimonial->title; ?></h2> <p><?= $testimonial->testimonialBody; ?></p> <p class="font-weight-bold text-muted">- <i><?= $testimonial->testimonialReviewee; ?></i></p> <?php endforeach; ?> </div> </div> </div>1 point
-
1 point
-
@Robin S Thanks for your work! I will gladly merge a pull request to make this module PW3 compatible1 point
-
Actually, this seems to work: <?php namespace ProcessWire; ?> <?php // get PageArray of all testimonials (which is a repeater: title, testimonialReviewee, testimonialReviewee) $arr = $page->testimonials; // shuffle them $arr->shuffle(); // grab the first one $firstTestimonial = $arr->first(); // grab the others $otherTestimonials = $arr->not("$firstTestimonial"); // get total of half the array $numberInFirstHalf = ceil(count($otherTestimonials) / 2); // return new PageArray (half of $otherTestimonials) $firstHalfArr = $otherTestimonials->slice(0, $numberInFirstHalf); // return new PageArray (halfway to end) $secondHalfArr = $otherTestimonials->slice($numberInFirstHalf, $numberOfItems); ?> <div class="jumbotron jumbotron-fluid bg-color"> <div class="container"> <h2><?= $firstTestimonial->title; ?></h2> <p><?= $firstTestimonial->testimonialBody; ?> - <i><?= $firstTestimonial->testimonialReviewee; ?></i></p> </div> </div> <div class='container'> <div class='row'> <div class='col-6'> <?php foreach($firstHalfArr as $testimonial): ?> <h2 class='py-3'><?= $testimonial->title; ?></h2> <p><?= $testimonial->testimonialBody; ?></p> <p class="font-weight-bold text-muted">- <i><?= $testimonial->testimonialReviewee; ?></i></p> <?php endforeach; ?> </div> <div class='col-6'> <?php foreach($secondHalfArr as $testimonial): ?> <h2 class='py-3'><?= $testimonial->title; ?></h2> <p><?= $testimonial->testimonialBody; ?></p> <p class="font-weight-bold text-muted">- <i><?= $testimonial->testimonialReviewee; ?></i></p> <?php endforeach; ?> </div> </div> </div> I get one main one featured at top, 3 in left column and 2 in right column, total of 6 testimonials.1 point
-
@heldercervantes Sounds like one of my older modules. Welcome to the world of module authorship!1 point
-
Hi Robin thanks for checking in. Yes, I have fixed the problem and it will be part of the updated release in the next couple days. Thanks,1 point
-
Hello @madknight and welcome to the ProcessWire Forums, Have you already seen this? https://processwire.com/docs/tutorials/ especially: Installing a CSS Framework How to structure your template files also, in the newest versions of ProcessWire we have Markup Regions: https://processwire.com/blog/posts/processwire-3.0.62-and-more-on-markup-regions/ and Field Rendering: https://processwire.com/blog/posts/processwire-3.0.7-expands-field-rendering-page-path-history-and-more/ I use the above two to better structure my template files. In my setup Markup Regions is used for various page layouts where I can also dinamically add additional script and css files to a given page when needed (e.g. only the home page needs a slider JS and its CSS, etc...) I use filed rendering to render the "Main Content div" and also some fields when appropriate. I also use include when rendering fields is not possible (there are no such fields...), eg.: include __DIR__ . '/../../partials/article-lead-home.php' But there are various ways to do it. Some use templating engines for example, such us Twig, Latte, etc... You can find modules which support working with them more easily. In ProcessWire first you need to figure out your own way of setting site profiles up. It takes time, but it is worth it because you can build your "frontend theme" – which we call Site Profiles BTW – the way you want. Hope this helps. Also you can seach the forum for more ideas. Just use Google like this or similar.1 point
-
Figured it out. I needed to enable it under Admin>Setup>Fields>Body>Input>CKEditor Toolbar by adding ‘Styles’ there, and then editing the ‘mystyles.js’ and adding its path to ‘Custom Editor JS Styles Set’. Works like a treat.1 point
-
Hi Ryan Great module as it lets less able users do updates (even though they aren't required - people feel more comfortable keeping their site up to date). These days I think it is a required part of any program (even if it is more only for comfort not security!!!) I tend to ship out Processwire to my clients to change content and leave it up to them. This means that a couple of them have found the Update module and I end up getting calls about what all the versions are and which one is the right one (they're all used WordPress and updates messing things up so they don't want to do anything wrong I had a look around the module to added a check mark in the config section that would only list the One Master version so that it was clearer as to which version (only the one) needed updating (or not) but I couldn't make heads nor tails of the rest of it [no time for a deep analysis]. I've included the updated ProcessWireUpgradeCheck.config.php which just adds a 'dontuseDeveloper' variable/array. If you think it would benefit people to include it otherwise maybe just a quick point in the direction of how to list only the one Master update that would be great. Thanks for the great modules you do... and of course for Processwire itself - which is a very welcome relief from WP and the other bloated CMSes. ProcessWireUpgradeCheck.config.php1 point
-
@robinc, check out this module code in a Gist by @adrian: https://gist.github.com/adrianbj/2b3b6b40f64a816d397f1 point
-
Some new filters in v049 (eg. srcset) and an easy way to clear Latte cache by appending ?clearcache to the URL. I've added a sidebar to the GitHub wiki so filters and macros are more easier to find.1 point
-
I do something like this, see the 'includes' and 'views' folders. I find it easier structured like this but you can do it any way you like I set templates to 'main' in the alternate template section: ...then once you've created a page using the 'about' template (created in the admin), when you visit 'site.com/about', main is used to output the contents of 'views/about.php' and a couple of includes: // main.php <?php namespace ProcessWire; ?> <html> <head></head> <body> <?php include("./includes/_header" . ".php"); ?> <?php include("./views/{$page->template->name}" . ".php"); ?> <?php include("./includes/_footer" . ".php"); ?> </body> </html> I never got used to the delayed output. I like the simplicity of this approach. This is just one of the many ways you can do things in PW, experiment, have fun hope this helps.1 point
-
1 point
-
Thank you teppo!. Now the app is fully working with the latest news1 point
-
1 point
-
This is because the module extends Fieldtype Textarea but removes certain config inputfields (including contentType) that are not to be used with Fieldtype YAML. I'm guessing that the core Fieldtype Textarea has added an inputfield dependency for contentType since the Fieldtype YAML module was created, hence the warning. @owzim, maybe the module could set the unused config inputfields to hidden rather than not including them in the field config at all? foreach($parentInputfields as $inputfield) { if(in_array($inputfield->name, $forbidden)) { $inputfield->collapsed = Inputfield::collapsedHidden; } $inputfields->append($inputfield); }1 point
-
One of my older module just got some love! So, just wanted to mention that the Module was updated to v2.0.0 with some changes. 1. Its now compatible with PW2.4+ and PW3+. 2. Some changes were made to how it works. It was replacing core function to create the page list labels thus some newer features were missing. Which was kinda pain in the ***. Now it's just hooking after and prepends the image. Done. 3. It also now is not enabled/configured through the template custom label anymore. You can configure templates via a textfield on the modules configuration screen. Just enter template names along with the image field you wish to use: basic-page,image Or basic-page,image.landscape document1,image.portrait 4. It now supports also FieldtypeCropImage (v1) FieldtypeCroppableImage (v2) FieldtypeCroppableImage3 (v3) ... Thanks @adrian for the patience to fix some old problem, and give a hint at new PW3 menu issue. Strange looking at it after years1 point
-
This should do the trick! $f = $fields->get("body"); echo '<i class="fa '.$f->icon.'"></i>'; PS make sure you load this on the page: <link rel="stylesheet" href="/wire/templates-admin/styles/font-awesome/css/font-awesome.min.css" type="text/css">1 point