Leaderboard
Popular Content
Showing content with the highest reputation on 03/14/2018 in all areas
-
I've played around a bit with setting up a blog in PW using @kongondo's blog module and, since I'm anything but not a designer, incorporated the free "Striped" template from HTML5UP. The result is Striped Travel Blog Template (Responsive). Update: link now points to the official module repository. The layout is classical (some might say "very nineties" ) but I do like sidebars on the left and content starting close to the top. Features are: You can the sort order for lists that are sorted by date to ascending or descending. This is the "killer feature" I'm missing everywhere else, and as an avid reader of hiking blogs (mostly long distance, so long series of blog entries) I always hate when "next" buttons take me backwards (in time) and lists have to be read top down. Post lists are paginated Since it uses the blog module, comments and email notifications for them are a given Contact form using @justb3a's Simple Contact Form module Auto-generated sitemap.xml using @Pete's XML Sitemap module The usual stuff like recent comments, recent posts, recent tweets Calendar for the current month with links to dates with pages 3-column home layout with posts, configurable number of posts shown there "Sticky" option for posts to glue them to home RSS feed Already added all templates with translatable strings to site translation files Todos: Add post overview by year and month Allow paging through the calendar widget by month I'm a bit of two minds whether to show the full posts in lists or just summaries and still have to decide on that As written in the title, it is still in development, and I'm not completely happy with the lack of integration of my additional site-wide settings with the blog module's settings widget. I just thought I'd share it. Of course, I'd be happy about any feedback. Screenshots:11 points
-
made huge progress on this Example query with all the features: $pages->findObjects('template=item, limit=100', [ 'title', // page title field 'field1', // regular textfield '(SELECT #data# FROM field_field1 WHERE pages_id = pages.id) AS `sql`', // custom sql query (multilanguage) 'images:description', // imagefield + description 'pagetest:status:created:templates_id', // pagefield + page status + created time + template id 'pagetitle' => function($page) { return $page->title; // example of a closure }, ]); Explanation: regular textfields can easily be queried just by defining their name as string any custom sql query is possible, even multilanguage when using #data# keyword images:description syntax works for all file fields page:status:created works for all pagefields and last but not least a very nice helper for fast and easy queries and small amounts of data: closures Output (default language): And the same query as datasource for a datatables field: This will be really, really awesome @theo I plan to add a lot of other stuff to my datatables module and that will take some time. I put the new pageFinder in a separate module. You can have a look here: https://gitlab.com/baumrock/RockSqlFinder Maybe you want to test it? Also @adrian might be interested? Currently it supports FieldtypeText, FieldtypePage and FieldtypeFile - but it should be easy to add others... Like Repeaters for example. Any other fields could be queried via custom SQL queries... And for really complex joins there will be another module3 points
-
A PageTable field perhaps? That way, you can factor most options out of module settings pages. Or just use regular (hidden) pages without a dedicated php template under an extra page in the page tree and allow creation of new pages in the field's options (parent and template need to be configured for that to work smoothly). It's also possible to add your own pw-modal link to edit and create new encoder pages from a custom process module. That's not really a problem. See for example @kongondo's blog module. It adds a toplevel entry in the navigation bar for its process module. There's also a wealth of information on that topic in @bernhard's blog entry on building admin pages. Either just make them pages, or give your module (best not the process module) a method that returns the stream data and call $modules->get("YourModule")->yourMethodThatReturnsStreamdata() in the frontend template. @formmailer's Schedule Pages module might already be quite close to what you want.3 points
-
For a page $p with images field "images" and an array of image paths/URLs... $p->of(false); $u = new WireUpload('image_check'); foreach($image_paths as $image_path) { // Get path parts $parts = pathinfo($image_path); // Convert filename to PW format $image_name = $u->validateFilename($parts['basename']); // Look for filename in images field if(!$p->images->get($image_name)) { // Image does not already exist in field, so add it $p->images->add($image_path); } } $p->save();3 points
-
I too was wondering how to best approach this, as I needed a base configuration that sped up the design layout for each template a client requested. I just spent too much time on this than anything else. Because I am a one man show, and this isn't my primary job, I finally think I found a happy medium, using the following: A combination of using: One main template which is used to build any layout Repeater Matrix Fields as html blocks/containers, which build html code based on the UIKit v2 framework (grid classes, subslasses, etc...) I tried to code in a function which uses the recent Item Depth settings for a Repeater Matrix field to know when to open and close div elements with levels of code blocks, but couldn't quite get it right, as my math and coding skills aren't that great yet, but if anyone manages to get something like this working, it would be great! So instead I just created a bloated if else statement, but I still use the item depth feature to see how the blocks of code would be indented for easy readability within the backend. Backend templates for each widget, so I can add configurations and settings to each particular widget, and a way I could call this from a page reference field A 'Page Reference' field to select which widgets I wanted to show in these containers. A 'Selector' field to target which pages these particular html blocks/containers should be visible. I would love have this in some kind of installable module, but I'm just not skilled enough/don't have the time I hope though that this has given someone an idea of how you can use the above combination to take the hassle out of building page layouts, without touching the front-end code continually I have attached a screenshot to make it a bit clearer on what I am doing... (or trying to do!)...3 points
-
Brain dumping here, but on one end of the spectrum, we have good-ole' templates, which is what ProcessWire is all about. Then on the other end, we have these infinitely configurable, drag-and-drop page builders. Popular ones include: webflow.com (arguably the most elaborate) grapesjs (looks like open-source webflow clone that they encourage CMS's to integrate) yootheme pro (a wordpress builder; Yootheme is the company that makes UIkit, so their approach particularly appeals to me since I'm all in on UIkit); it's interesting to see how a pure, truly inspired uikit builder would be imagined, and yootheme pro is it other wordpress builders: gutenberg, divi, beaver builder, + a million others Of course, if you have a site that has highly relational data and templates, PW is perfect, but then there's those one-off pages, or sections within templated pages, that need the flexibility of a builder so the non-coder editor who's editing the page can do what he needs to do. I think these builders need to take the end-user into consideration... with too much flexibility and an editor without a strong understanding of how they work, it's more likely the resulting builder page that has been created is going to be sub-par. The images might be way too big, the fonts may be off, spacing, etc. etc. Honestly, even when I as a web developer use those builders, it doesn't feel right, but perhaps that's because I'm totally biased. I feel having a strong set of components/blocks that each have a bit of flexibility to them via various options is the better way to go if it makes sense for a site. RepeaterMatrix does this perfectly and because it's through RepeaterMatrix, you can use PW's API to query things if need be. The trade-off is doing column layouts is a bit trickier (not impossible), it's not 100% visual/drag-and-drop, and you have to create a defined list of blocks/components/matrix-types (which is another way of setting up some expectations of what is and isn't possible).3 points
-
Thanks for pointing that out. I only changed this after I removed all the test posts that triggered the pager I have updated the repo.2 points
-
Thanks to you and ( @kongondo' , @Pete , @justb3a ) for a great blog profile which is a good alternative to wordpress ... I noticed a very small error in ready.php, the translation function lacks ... Error: Uncaught Error: Call to undefined function _() in /srv/http/proc-blog/site/ready.php:12 "nextItemLabel" => _("Next Page >"), "previousItemLabel" => _("< Previous Page"), "nextItemLabel" => _("Next Page >"), "previousItemLabel" => _("< Previous Page"), Just add double underlining to translations __() Yeah, thanks a great profile for once.2 points
-
@adrian Here you are. Please take a look. I am not sure I put it well enough. https://github.com/processwire/processwire-requests/issues/165 Gideon2 points
-
2 points
-
A couple of tweaks today. 1) The "Template Info" section in Request Info panel now properly shows the data for the template being edited when you are editing the settings for a template in the admin. 2) The User Switcher now has an option to limit the list of available users by restricted roles. I had a site where I was using the Users system to store details for frontend members so the list was ridiculously long. Now I can exclude that member role to keep the list concise and easy to use.2 points
-
In my _init.php file, the first thing I include is _login.php: <?php // Handle logouts if(isset($input->get->logout)) { $session->logout(); $session->redirect($page->path); } // If they aren't logged in, then show the login form if(!$user->isLoggedin()) { // check for login before outputting markup if($input->post->user && $input->post->pass) { $user = $sanitizer->username($input->post->user); $pass = $input->post->pass; if($session->login($user, $pass)) { // login successful $session->redirect($page->path); } else { $session->login_error = 'Login Failed. Please try again, or use the forgot password link below.'; } } ?> <!DOCTYPE HTML> <html lang="en"> <head> <title>Login</title> <link rel="stylesheet" href="/build/css/app.css"> </head> <body> <div class="container py-5"> <form action='./' method='post'> <div class="row"> <div class="col-12 col-sm-6 offset-sm-3"> <h1>You must be logged in.</h1> <div class="login"> <? if($input->post->user && $input->post->pass) { echo "<p class='error'>" . $session->login_error . "</p>"; }?> <p><input class="form-control" type='text' id="user" name='user' placeholder='Username'/></p> <p><input class="form-control" type='password' id="pass" name='pass' placeholder="Password" /></p> <p><input type='submit' class="btn btn-primary" name='submit' value='Login' /></p> </div> </div> </div> </form> </div> </body> </html> <? die(); // don't go any further if not logged in } If I go to site.dev/whatever, I am met with a login. After logging in, it takes me straight to the URL I intended to go to before needing to log in. You could change the $page->path to $pages->get('/events/')->httpUrl; - would that work?1 point
-
That module is excellent and works great in PW 3 - if you look at the support thread, @netcarver has been active very recently.1 point
-
Perhaps I'm the only one who does this but I usually load the site's main css into ckeditor. This way the look is much closer to the final result, at least for font size, family, color etc. If I need to exclude a style from ckeditor I use body:not(.cke) in css (if I remember right for the classname).1 point
-
De-installed is not quite the same as physically removed. If you de-activate a PW module, it will still be on your server. But all DB-related stuff will be removed (not every module uses the DB). Hint: Most old modules not tagged with "PW3-compatible" can be easily enabled with adding PW3 namespaces at the very top of the php (.module) file: <?php namespace ProcessWire;1 point
-
Doh! I had, but not correctly, I guess. Once I echoed '$modules->get("MarkupGoogleRecaptcha")->getScript();', it worked. Thanks for your help. Now I need how the rest of it works. Cheers, Paul1 point
-
Thanks for that - I have commented on your request and also provided a very simple hack this get it working right now by including the tracy core file in the index.php at the root of your site. It seems to work brilliantly - great for debugging PW core files even. Would be great if others could add their +1 to this please!1 point
-
1 point
-
From the API Reference page for WireArray class:1 point
-
Most of them work because ProcessWire compiles them automatically. I'd suggest you spin up a local test installation to be sure.1 point
-
Hi @flydev. Great module. I'm using it on a custom form. I'd like to add it to an existing site where I've used Ryan's Form Template Processor module. (It's a long form; I'd rather not start from scratch). I've had a look at what you did with the log in form above; would I take a similar approach? Is there an easy way to slot the Captcha form in before the submit button (instead of outside the generated form)? I'm pretty new to hooks, if that's what's needed. Any suggestions appreciated.1 point
-
Thank you @kixe, yes sorry for the _x() I didn't know, thank you for your explanation. I was try also without _x() and before didn't work. But Now I have understand my error, I didn't call ed $user->. Now when I switch between languages the tag lang change! because it recognizes the language that the user user has selected. Thank you again!1 point
-
@MarcoPLY Where did you set the vars $hreflang and $language? Maybe in the last turn of the foreach loop? If so, not a good idea. The function _x() provides the option to translate a given string in a specific context. This is useful for hardcoded text strings in modules or templates. If you put $leng in quotes and translate this string again under SETUP > LANGUAGES > ANYLANGUAGE > Button: Find Files to translate it maybe will work but it is useless. You don't need _x() here. Your variable $leng is already translated in the database. The following code is enough and should work if you have properly implemented a language switcher which changes the language of the current user. <? $lang = $pages->get(1)->getLanguageValue($user->language, 'name'); ?> <html lang="<?php echo $lang ?>">1 point
-
array( 'name' => 'markup', 'label' => 'Markup', 'description' => '', 'notes' => '', 'type' => 'markup', 'value' => '<strong>Test Markup</strong>' ),1 point
-
1 point
-
1 point
-
Most of the time you can debug modules just fine - it all depends on the load order of things. I have asked Ryan via PM if he'd consider a special hook so that Tracy can be loaded earlier so that it's always available for all modules. Perhaps we need a Github feature request for this? Maybe it should come from someone other than me?1 point
-
Latest v1.8.3 further improves checkAllCheckboxes feature. Now its state properly corresponds to individual checkbox changes and also fires a change event (without that showIf fields wouldn't react).1 point
-
1 point
-
1 point
-
I also always create custom fields for a published date for being used on the frontend. PW's created/modified/published dates are more for "auditing" than for public display, I think. However, for the record you can do things like this:1 point
-
There is an option in template settings (Advanced tab -> Template toggles -> Allow the 'created user' to be changed on pages ) Is that what you are looking for?1 point
-
The first thing I'd check after any up-/downgrades are file permissions and ownership.1 point
-
Sure that these pages really don't exist (perhaps just PageTable entries that live under tree-info)? Not directly related (as it might cure the symptom but not the issue): for a site-wide search, it's often a good idea to limit the templates targeted in the search.1 point
-
@adrian Thanks for the feedback - I like the idea. It needs a take account of the chosen time format (that's just one of the ones on offer), but this should be possible. Will see what I can do.1 point
-
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.1 point
-
Thanks for the answers @kongondo. Both Media Manager and Visual Page Selector look like useful and clever modules, although the cost/features ratio favours MM. I think what would be really fantastic is something in between the feature set of MM and VPS, and this could perhaps be accomplished by borrowing some of the features developed for MM into VPS. To explain, something I think PW is missing is custom fields for images (and I'm not alone: this GitHub request from today has 4 upvotes in 2 hours). There are loads of use cases for this, but one example: you are using images in your site that have a Creative Commons Attribution license. To fulfill the terms of the license each image needs the following fields attached: Author (text), Source link (URL), License (Page select), License link (URL, although in fact you'd probably store the URL for each license in the License page field). The ImageExtra module only supports textarea custom fields so it's not the right solution. What would work is a page-per-image approach with the custom fields for the image stored in the image's page. VPS is a big step towards making this a workable solution, but to use this as a replacement for a standard image field some extra features are needed beyond what is currently offered... 1. There needs to be an easy way to edit the image's custom fields from the Page inputfield. A modal link to Page Edit is all that's needed to begin with - this is something that's possible with existing inputfields such as AsmSelect. Somewhere down the line this could maybe be enhanced with AJAX loading of the custom fields into the list view of VPS, as per repeaters (just dreaming here). 2. There needs to be an easy way to add an image (page) from the inputfield. This is possible with most existing Page inputfields if the template and parent for allowed pages is defined. Basic support for this would be to open the Add Page form in a modal (the Page Field Edit Links module does something like this). But to be a closer match to existing image field functionality it would be nice to be able to upload multiple images at once. This feature is in MM - could it be added to VPS? (when template and parent are defined for the field). 3. There needs to be an easy way to embed an image into CKEditor. This feature is in MM - could it be added to VPS? Really keen to hear your thoughts on this. Thanks!1 point