Leaderboard
Popular Content
Showing content with the highest reputation on 04/05/2017 in all areas
-
Hi guys, after several months I finally released my most complex ProcessWire project so far: https://ricardo-vargas.com About the client: Ricardo Vargas is a specialist in project management and strategy implementation. He's an accredited professional and author of several books. Since 2007, he publishes a bilingual podcast about project management with millions of episodes listened. From 2012 to 2016, he worked for the United Nations Office for Project Services (UNOPS) in Copenhagen, Denmark. He currently lives in Portugal. The previous site was developed in 2009 using Wordpress by my team at the agency I was working for. In 2011, Ricardo invited me to work with him and I started to maintain the site ever since. The front-end side was good, performance-wise, but the backend started to become horrendous to work with so in 2012 I started my quest to find a better CMS and found PW. After developing small projects and messing around with it I convinced my client/boss last year to let me develop his new website with PW. I did all the stuff (design, frontend, backend, and server ops) so if you find something buggy or strange, let me know, please! I'll appreciate! The site is currently running on Digital Ocean droplet with 2GB of RAM. Nginx and Cloudflare (for SSL mostly). I'm using forge.laravel.com to manage it. Approx. 3,000 unique users per day doing 72,421 requests (Cloudflare stats). Key features: Pages are loaded with ajax using https://github.com/miguel-perez/smoothState.js so the podcast player (Soundmanager ) can continue to play the podcast episode as the user navigates other pages. Member area where the user can see the books his own (and download their files) and also see his bookmarks and reports. I imported and the users (+ 4k) from the WP database and decided to get rid of passwords (the future!) so after some research and tests, I chose Auth0 login system. I've mentioned the member area on this topic (there are a couple of screenshots there): Modules used AdminLinksInFrontend AdminOnSteroids AdminTemplateColumns Auth0Login (Custom made) BatchChildEditor ClearCacheAdmin FieldtypeRuntimeMarkup FlickrAPI (Custom made) FormBuilder InputfieldCKEditor MarkInPageTree MarkupLoadRSS PageReferencesTab PageViews (Custom made) PduReport (Custom made) PrevNextTabs ProCache ProDrafts ProcessDatabaseBackups ProcessJumplinks ProcessSendyAPI (Custom made) ProcessWireUpgrade ReaderAreaManager (Custom made) SlideshareAPI (Custom made) TemplateLatteReplace TextformatterAccordion TextformatterHannaCode TextformatterMarkExternalLinks TextformatterMultiValue TracyDebugger UserBookmarks (Custom made) WireMailMailgun importPagesCSV12 points
-
Hey! This is a very early/experimental/alpha not for production environments release of a new module I'm working on. Just testing the possibilities and the interest that might be for such a thing. The idea is to be able to quickly create fields while working inside the template files without having to go to the admin. For example, in an early stage of development when creating a layout, insteading of putting a placeholder headline and then going to the admin to create the headline field where the real content will be, you can create the field directly from the template file by doing: <h2><?=$page->field("A nice headline", "headline", "text")?></h2> This will create a new "headline" text field when it doesn't exist in the system and add it to the the template of the page you're working on and add "A nice headline" value to it. On a second run the module will recognize that the field already exists on that template and will simply return it's value. The method accepts three string parameters in the order ( value, field name, field type ). Value and name are required but field type will assume "text" when omitted. $page->field("A nice headline", "headline"); // creates a text field $page->field("A nice paragraph", "body", "textarea"); // creates a textarea field The method also accepts a boolean parameter in any position: TRUE forces the value to be saved into the field on that page, FALSE (or omitted) sets that value to the field when it adds it to the template, but leaves it how it is when the field already exists in the page. This is the only situation when this module can be destructive, and it's only concerning the value of the field on that page: $page->field("Another nice headline", "headline", TRUE); // will create or add a text field and add the value to the page even if the field already exists there The method also accepts an array as parameter. This array will be used as options for the creation of the field. The options array will override the string parameters when they clash. $page->field("A nice headline", "headline", array( 'name' => 'subtitle', 'label' => 'Subtitle' )); // will ignore the name "headline" and use "subtitle" instead As soon as the fields are created and added to the template, all the method will do is return the value, just like if using $page->headline, unless you use the TRUE parameter which will override the value of the field by the value in the first parameter. -- With this module you can, for instance, convert an existing HTML template quickly, just by pasting the html into a template with no fields created yet, and going through all the code, replacing the content by calls to my field() method. In the end you should have a working page with all the fields created in the template. Now you just need to go to the fields and adjust their preferences. So, just download it > install it > test it > tell me what you think! dynamicPageFields.module.zip -- Edit: Multilanguage fields threw an error but they don't now. You can create a multi lang text by doing: $page->field("A nice headline", "headline", "textlanguage"); that third parameter is just a case insensitive simplification of input field names to make it easier to write. You can still use the original input field name like "FieldtypeTextLanguage" if you prefer.9 points
-
I'll have a look on the above issues/requests later, nowadays I'm busy with a 4.04 kg newborn who thinks he can steal all the hours in a day (and night)4 points
-
What's up is that the size() method accepts a 'quality' setting in its $options array: https://processwire.com/api/ref/pageimage/size/ And you can define the default quality setting used for the image sizer in /site/config.php via $config->imageSizerOptions: https://processwire.com/api/ref/config/3 points
-
Sure It's the second and I thought the first one is on steroids... Now I know I was very wrong3 points
-
3 points
-
Code snippets are very hard to read on small screens due to lack of white-space: pre CSS property on <pre> tags. This causes very weird text wrapping. Adding this allows code to scroll sideways, which also preserves the whitespace properly. Here's the problem and proposed change in action Readable on large screens, overflow works ✓ Unreadable on small screens, text should not wrap ✘ Proposal: add white-space: pre on <pre> elements. See it in action 2017-04-05_20-18-03.mp4 (770KB) or GIPHY link2 points
-
By default PHP's bundled GD 2 library is used. If you're using a recent ProcessWire 3 version, ImageMagick is also supported (if you can have it installed on your server of course). Perhaps you could have better results. https://processwire.com/blog/posts/processwire-3.0.10-expands-image-resize-options/ NB: in /wire/config.php you can also see some settings, copy them to /site/config.php and modify them...2 points
-
Unfortunately not yet. I am planning to implement them. But I am a bit busy now and it would definitely take some time to implement it. For now, you will have to do it some other way. Sorry2 points
-
2 points
-
Thanks @Sérgio! Just some minutes ago I added the possibility to create multi language fields and uploaded a new zip file. This doesn't let you add the language values, it only allows you to define the field as multi language. I'm not sure how useful it would be to add the possibility to add the language values, since it can get really complicated in sites with lots of languages and I thought of this as a fast development tool. I would check how to support all major field types first, and then think of multi language.2 points
-
Thanks, @Robin S! Yes, it's a great feeling! After everything was running apparently fine, it was like removing a heavy weight from the shoulders. The project took more time than as I was expecting for some reasons, it was developed in "waves" as I have to stop it for 2-3 weeks many times to handle some other of our projects. I didn't track the time but I can estimate that if done without stopping, it would have taken at least 9 months. But now that I know more about PW's advanced features, like building modules and how to create a member area, it would take 33% less time I think. The project has 66 templates and 1849 pages so far, some of them with lots of content like the ones on Consulting and Training sections, so a lot of time was spent importing content. -- Very strange you had problems in the book section rendering, could you tell me what browser you used? I'm using a Mac and also tested in Firefox on Ubuntu and Edge and IE11 on Windows 10.2 points
-
Nice to see a few of my modules in such a big project! FYI with AOS you can replace TemplateAdminColumns, and with TemplateLatteReplace filters/macros TextfomatterMultiValue and even ALIF, provided if you are not using their advanced features.2 points
-
Big thumbs up to Sérgio! And thank you for sharing the info of the "tools" used. Both smoothState.js and Auth0 looks "interesting" Also, I spotted that you use @tpr's TemplateLatteReplace. For the whole site?2 points
-
Nice work! Must be a good feeling to have such a big task completed and live. I'm always interested to hear how much time goes into larger jobs like this undertaken by a single developer: any idea how long you spent on it? I noticed a couple of minor display issues on the Books page. You can see both in the screenshot below: "Book recommendations" item seems to be missing expected content. Side column layout issue at some device widths. Edit: one more on this page... the "Powered by Goodreads" link is malformed. Again, a really great site.2 points
-
You have to perform the check for the template name inside your hook function. $this->page or wire('page') returns whatever page in which the module code is executed (admin page editor, custom page with the code...). Pages::save on the other hand is called with the page object being saved, which is what you're looking for. public function init() { $this->pages->addHookAfter('Pages::save', $this, 'syncMobileDE'); } protected function syncMobileDE(HookEvent $event) { $page = $event->arguments(0); if($page->template->name == 'TemplateName') { // Run your code } }2 points
-
NOTE: This thread originally started in the Pub section of the forum. Since we moved it into the Plugin/Modules section I edited this post to meet the guidelines but also left the original content so that the replies can make sense. ProcessGraphQL ProcessGraphQL seamlessly integrates to your ProcessWire web app and allows you to serve the GraphQL api of your existing content. You don't need to apply changes to your content or it's structure. Just choose what you want to serve via GraphQL and your API is ready. Warning: The module supports PHP version >= 5.5 and ProcessWire version >= 3. Links: Zip Download Github Repo ScreenCast PW modules Page Please refer to the Readme to learn more about how to use the module. Original post starts here... Hi Everyone! I became very interested in this GraphQL thing lately and decided to learn a bit about it. And what is the better way of learning a new thing than making a ProcessWire module out of it! For those who are wondering what GraphQL is, in short, it is an alternative to REST. I couldn't find the thread but I remember that Ryan was not very happy with the REST and did not see much value in it. He offered his own AJAX API instead, but it doesn't seem to be supported much by him, and was never published to official modules directory. While ProcessWire's API is already amazing and allows you to quickly serve your content in any format with less than ten lines of code, I think it might be convenient to install a module and have JSON access to all of your content instantly. Especially this could be useful for developers that use ProcessWire as a framework instead of CMS. GraphQL is much more flexible than REST. In fact you can build queries in GraphQL with the same patterns you do with ProcessWire API. Ok, Ok. Enough talk. Here is what the module does after just installing it into skyscrapers profile. It supports filtering via ProcessWire selectors and complex fields like FieldtypeImage or FieldtypePage. See more demo here The module is ready to be used, but there are lots of things could be added to it. Like supporting any type of fields via third party modules, authentication, permissions on field level, optimization and so on. I would love to continue to develop it further if I would only know that there is an interest in it. It would be great to hear some feedback from you. I did not open a thread in modules section of the forum because I wanted to be sure there is interest in it first. You can install and learn about it more from it's repository. It should work with PHP >=5.5 and ProcessWire 3.x.x. The support for 2.x.x version is not planned yet. Please open an issue if you find bugs or you want some features added in issue tracker. Or you can share your experience with the module here in this thread.1 point
-
http://caniuse.com/#feat=css-grid The CSS standard Grid Layout will soon be usable in the stable versions of the leading browsers. It should hit Chrome and Firefox in March. It is in Safari tech preview, but no clear date. MS Edge is working on updating support. I guess support in mobile browsers will follow. 2017 is the year to use it on sites, where it is OK to experiment with bleeding edge stuff. A complete guide to the system on CSS Tricks Learn by examples (includes video tutorials) Rachel Andrews summarizing use cases for Grid, Flexbox and Box Alignment in a single article on Smashing Mag (note: heavy with Codepens) News on all things CSS Layout curated by Rachel Polyfill support is unfortunately dragging behind with no contributors stepping up to help Fremy1 point
-
..., and you should enable the IMagick Imagesizer Engine if your server supports it! (under PW 3) ..., and additionally to the quality-value, you can try out differend sharpening values (none, soft, medium, strong)1 point
-
Keep up the good work! You need to keep your sanity so that you will also be able to have fun with the third one too1 point
-
@Nurguly Ashyrov Hi, is there a way to add images/files to a page with the updatePage method ? If not, do you plan to implement it or do I have to do this another way ? Thanks again1 point
-
Great, that will work! I think it will be very useful to have the short texts translated right away when creating the template and after that we can go to the admin to translate the long ones.1 point
-
@Sérgio just to let you know. I did a small test, and without making any change, the module already has kind of multilanguage support because the value will be set in the language of the user visiting the page. So, if you set the TRUE parameter to force the value and visit the page with another language, it will actually set the values in that language to the values that are currently set in the value parameter. Not sure if that's more useful than editing the page in the admin though.1 point
-
For a project I've posted yesterday I built a basic module to subscribe users to a Sendy installation. I love Sendy and my client too as we use it to send lots of emails using Amazon SES costing almost nothing at all. Do guys think that's worth to post about? It's very basic now, it doesn't use Sendy's API at all, it just send the data using POST to subscribe the users to different lists.1 point
-
This looks really promising @diogo! I like it a lot and I'll sure try it on a next project. One question, what about multilanguage fields, do you think it's possible or should we avoid it to not overcomplicate the module?1 point
-
Thanks! But I know that there's a lot of places where I can improve it. I had some problems with the plural translation on some other pages but got a workaround. I still have to update the module and start using your news filter and macros. About my custom filters/macros, I have to refactor some of them, and I guess you probably have almost all of them but with different names. Thumbnail is just a dumb filter to get the page image and resize it, I actually not using it anymore, forgot to remove the commented code from the page. Here's the number_local and cutAt: And yes, I'm planning to get rid of the "noescape" filter in the future.1 point
-
I think I deleted it by mistake but thanks to you I put it back. And thanks for the tip of using spoiler! Much better indeed! I also changed the link so the new page shows all the code blocks with related stuff: https://ricardo-vargas.com/podcasts/cost-estimating-part-1-of-3/1 point
-
For our in-house printing house Leitz Medien we have build a small landing page to feature their qualifications. The website has as background multiple illustrations, which are sorted randomly on every page load. The layout uses Masonry and the paths of the illustrations are animated using vivus.js. You can access every modal under its own Url, which are added to the browser history using the replaceState method. www.leitzmedien.com Modules used: ProCache Markup Sitemap XML Email Obfuscation (EMO) Tracy Debugger Regards, Andreas1 point
-
1 point
-
Many thanks for all your modules, @tpr! They are excellent and helped a lot! Yep, I was planning to replace TemplateAdminColumns in all templates but had to release the project before that. I do it later. The same thing about ALIF, I started using it before AOS I think, so I just kept it there. But what can I use to replace TextfomatterMultiValue ?1 point
-
FYI: I just checked the LoginPersist module and it's working for me in PW3.1 point
-
Loading of regular pages might benefit a tiny bit from using my module, but managing images would still be prone to the same delays if you put all images into a single library (which is just a page behind the scenes). You might still be able to make use of it if you can separate images into different libraries (e.g. by categorizing them into logos, photos, product images etc.) so numbers stay manageable. Media Library uses PW's native tools (file/image fields, CKEditor pwimage plugin), and I have to admit, I haven't tested those (and my module) with a big number of images - the module is a result of an internal requirement at work, where the number tends to stay well below 100. I'd say give it a quick try in a test system (perhaps in conjunction with the FileFieldTweaks option of @tpr's AdminOnSteroids). If you find you need something more elaborate though, @kongondo's Media Manager pro module might be worth a look.1 point
-
This sounds great to me! Tricks and tips can be useful, but if you have the time, a tutorial can be more helpful, but obviously requires more time. The topic of "newsletters and frontend users" is worth the effort, I think. I'm thinking of targeting somewhat experienced developers new to ProcessWire, so you should not have to delve into all the details, but provide working example code with comments and some explanation, just like you did in the case of your Beginner’s modules tutorial, but this time it would be more lengthy I think.1 point
-
might address this somewhat with the revamped subscribers module which im going to be working on soon... what did you want to see? I though of putting together a site profile job site as an example of how to use it in production.1 point
-
You can double-click the bin icon on file/image fields to mark all items for deletion.1 point
-
You might also try conditional hooks: https://processwire.com/blog/posts/new-ajax-driven-inputs-conditional-hooks-template-family-settings-and-more/#new-conditional-hooks1 point
-
Needs the Pages class in there somewhere. Either: public function ready() { if($this->page->template->name == 'TemplateName') { $this->pages->addHookAfter('save', $this, 'syncMobileDE'); } } Or: public function ready() { if($this->page->template->name == 'TemplateName') { $this->addHookAfter('Pages::save', $this, 'syncMobileDE'); } }1 point
-
The page object is not available in init(). You need to use ready()1 point
-
Hi, welcome to PW forums. Looks like you have not the right PHP syntax. Try this: public function init() { // you need a condition that will result to true if($this->page->template->name == 'templateName') { $this->addHookAfter('save', $this, 'example1'); } }1 point
-
Hi there, I created a new module called TextformatterMixcloudEmbed. It is based on the Soundcloud Embed Textformatter by Marvin Scharle and the Textformatter Youtube Embed by Ryan and is working the same way. I hope you like it! Download: https://github.com/TomasKostadinov/TextformatterMixcloudEmbed Screenshots:1 point
-
Just reporting back that for my case this turned out to be very easy using just WireHttp alone and no Oauth client library needed. $http = new WireHttp(); $consumer_key = 'my_key'; $consumer_secret = 'my_secret'; $auth_token = 'my_auth_token'; $auth_token_secret = 'my_auth_token_secret'; $time = time(); $nonce = md5(uniqid(microtime())); // OAuth authorization header $http->setHeader('Authorization', "OAuth oauth_consumer_key=$consumer_key, oauth_token=$auth_token, oauth_version=1.0, oauth_timestamp=$time, oauth_nonce=$nonce, oauth_signature_method=PLAINTEXT, oauth_signature={$consumer_secret}%26{$auth_token_secret}"); // Parameters $params = [ 'member_listing' => '123456', 'rows' => '20', 'photo_size' => 'FullSize', 'return_metadata' => 'false', ]; $params_str = http_build_query($params); // Get JSON response from Trade Me $json = $http->getJSON("https://api.tmsandbox.co.nz/v1/Search/Property/Rental.json?$params_str"); Because of the circumstances of my case I can hardcode $auth_token and $auth_token_secret. But more often with OAuth you would need to get these values in a separate query and store them.1 point
-
1 point
-
The approach is fine, just a couple of minor problems, one being the if($img) conditional. The others are the "return" at the end of the first couple of checks that are exiting right there. Try this: <?php /** * Module for generating Gravatar URLs for ProcessWire users. * * Use it like this: * * Get URL only with all defaults: * $user->gravatar() * * Get image tag with different size: * $user->gravatar(array('img' => true, 's' => 200)); * */ class Gravatar extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Gravatar', 'version' => 1, 'summary' => 'Gravatar hook for users', 'singular' => true, 'autoload' => true, 'icon' => 'smile-o', ); } public function init() { $this->addHook('User::gravatar', $this, 'methodGravatar'); } public function methodGravatar($event) { $u = $event->object; if ( ! $u instanceof User) return; if ( ! $u->email) return; $params = ($event->arguments(0) ? $event->arguments(0) : array()); // Default options $defaults = array( 's' => 100, 'd' => 'retro', 'r' => 'g', 'img' => false, 'attrs' => array(), ); $opts = array_merge($defaults, $params); extract($opts); $url = '//www.gravatar.com/avatar/'; $url .= md5(strtolower(trim($u->email))); $url .= "?s=$s&d=$d&r=$r"; $url = '<img src="' . $url . '"'; foreach ($attrs as $key => $val ) { $url .= ' ' . $key . '="' . $val . '"'; } $url .= ' />'; $event->return = $url; } }1 point
-
It's probably as simple as temporarily disabling this language inheritance for each field only for the request, where you're building the list. foreach($multiLangField as $f) { $f->langBlankInherit = LanguagesPageFieldValue::langBlankInheritNone; } // Check all your fields // Make sure non of the fields is saved before exiting1 point
-
Just in case someone stumbles across this in the future - forceLogin() is now available (since 2.6.8): https://processwire.com/blog/posts/processwire-2.6.8-brings-new-version-of-reno-admin-theme-and-more/#new-session-gt-forcelogin-user-method-to-login-user-without-a-password1 point
-
On the edit page of the user role, below the checkboxes, it says: To do this, go to Setup→Templates and edit one of your templates. To keep it simple, you may choose the template of your Frontpage, as all other pages will inherit the permissions you set here. In the Access tab, check page-edit for the roles of your choosing.1 point
-
Just for the record, here's how PW itself (in current dev branch) is doing it: $config->cli = (!isset($_SERVER['SERVER_SOFTWARE']) && (php_sapi_name() == 'cli' || ($_SERVER['argc'] > 0 && is_numeric($_SERVER['argc']))));1 point
-
@bracketfire: that's a cool way to do it, but whether it's the best approach depends on what you're trying to achieve. It's entirely possible, although quite rare, for $_SERVER['HTTP_USER_AGENT'] to be missing from non-cli requests too (it's a header after all), so checking for cli use doesn't entirely prevent this notice from appearing. If the underlying issue is that $_SERVER['HTTP_USER_AGENT'] isn't found and it's necessary for this module to work at all (haven't checked the code so can't really tell), it would probably make more sense to simply check for that specifically with isset(). On the other hand, if the module isn't useful in cli use at all and $_SERVER['HTTP_USER_AGENT'] isn't necessary for it to work properly in non-cli use case, it would make most sense to apply your fix (skip the module entirely for cli users) and add an isset() check to prevent unnecessary notices for non-cli clients that don't, for any given reason, send this header (Sorry, meant to point out something simple, but this turned into a kind of a long rant anyway..)1 point