Leaderboard
Popular Content
Showing content with the highest reputation on 08/07/2019 in all areas
-
Hello folks! Recently we published a new website for Brightline, a Project Management Institute (PMI) initiative together with leading global organizations dedicated to helping executives bridge the expensive and unproductive gap between strategy design and delivery. The previous website was made in Hugo as in the beginning it was a very simple website, but as the business needs changed, I decided to build this version in ProcessWire. Nothing fancy occurs behind the curtains, the need was more on getting some data in a way that makes it easier to create reports and to give access to PW's great admin to another team member. For the other website, that you can see here, I didn't implement a CMS on top of Hugo because for me it was quicker to edit the files and push to the repository. Some content is still being copied but 98% is done. A quick list of modules used: - ProCache, FormBuilder, ProFields, SeoMaestro, PageHits, TracyDebugger, MenuBuilder, AutoSmush, and other custom ones. I'm biased, but there a lot of good and useful content created by us and also by partners and all is free to download. :)5 points
-
3 points
-
2 points
-
Forgot to mention that as I had little time to create this new version, I built the front-end using UIKit to harness its Javascript power but the main design is made using Tailwind CSS as I can build an interface much quicker using it. I became a huge fan of it. Still need to do some code cleanup, replacing uikit's classes on some elements, but had to ship it this way.2 points
-
Moderator note: this is not a tutorial thread, so I'm moving it to the General Support area of the forum instead. Please keep in mind that the tutorial area is only intended for the posting of helpful tips and solutions. Thanks!2 points
-
Hi @ryan, This is indeed an ingenious little helper! Thx for sharing this idea with us! One problem though: When I'm only in the backend, the url and filename methods get never called. Could you please make the setFilename method hookable so that this method also works when the page is just edited in the backend? It would then only need this simple hook and all files are downloaded on demand: $wire->addHookAfter('Pagefile::setFilename', function($event) { $file = $event->object->filename(); if(!file_exists($file)) { // download file from source if it doesn't exist here $src = 'https://example.com/site/assets/files/'; $url = str_replace($this->config->paths->files, $src, $file); $http = new WireHttp(); $http->download($url, $file); } }); Or is there a better way of doing it? Edit: Ryans version does of course work without issues - just make sure to have the proper PW version installed ^^2 points
-
The limit of 128 characters has been in place for many years now. Personally I don't see a huge issue in raising it, or at least allowing longer names but making this an optional feature, but in the end that's a decision for @ryan. You can always open a new issue at the processwire-requests repository, requesting support for longer page names and explaining your use case and need for these. I can't remember if the reason for this limit has been discussed before. Browsers have some kind of limits in place, but these days those should be pretty much a non-issue as far as I can tell. Database level scalability probably shouldn't be a massive issue here either. That being said, I must add that this might be the first time I've heard anyone requesting longer than 128 character page names – so while it may seem messed up to you, it seems to me that your use case is actually not a particularly common one. In fact for most sites page names longer than 128 characters would very likely result in usability issues, and – just for an example – for the sort of projects I usually work on I definitely wouldn't want to allow that. 128 characters is already much longer than what makes sense ? As for workarounds, depending on your use case you might be able to use URL segments here instead. That's just one idea, though. The name field in the pages table is varchar(128), so that's at least one place that will enforce the limit.1 point
-
Because of this I either move the name filed to the content tab (which is OK for a non multilanguage site, but for more than one language it is wasting a lot of valuable space at the top of the edit page) or display the name right under the Title field's label, which is not editable but at least not so hidden as the Setting tab. There is room for improvement is this area for sure. WP's solution is very good, except that it is single language and I've never seen their(?) multilanguage solution.1 point
-
I'm in the "URLs should never change" camp myself ? To clarify: page names should remain constant even if titles are changed, and it's a good thing that they do – for UX, for SEO, and for various other reasons as well. While automatic redirect from old URL makes things better in some ways, it still isn't nearly as good as a constant URL structure. That being said, one problem I've ran into quite often is that name is (by default) "hidden" on the Settings tab, and I've never had much luck in explaining to non-technical clients that the Settings tab indeed contains values that should sometimes be changed (or checked after making changes). So yeah, cloning is indeed one of those actions that quite often result in nonsensical URLs. But since (unless I'm missing something here) built-in clone feature doesn't allow changing (or setting) the title while cloning the page, there's currently no intuitive way to handle this. If cloning did ask for a new title, it would make a lot of sense to redefine the name based on that new title as well, but changing it after the page has already been created is not such a great idea (in my opinion). Just for the record the way WordPress displays URL ("permalink") below title but still as a "non-editable by default" field (i.e. there's a separate edit button) is, in my experience, a good compromise: this way it's much harder to miss, but still "less prominent" and clearly not just a regular field among other regular fields. ... but that's probably a sidetrack here.1 point
-
That was an issue until v. 3.0.85, but apparently was fixed in 3.0.86. What PW version are you running?1 point
-
While working on the comments form of my blog, I thought to add an honeypot field in comments form to reduce spam. ? Honeypot is simply an hidden field added to a form. Honeypot field can have any name and is made invisible normally with a css directive {display: none}. Web users, being unable to see the field, will not fill it, while spam bots majority will not detect its invisibility and will populate the field. Once the form is submitted with a not-empty honeypot field it is very likely we are dealing with spam. ? In this post you can find more details about honeypot technique. While studying FieldtypeComments module and in particular CommentForm.php, to my great surprise ? I realized that PW already supports honeypot for Comments Form. ?? This feature has been introduced with PW 3.0.40. Normally this honeypot field is disabled, so it was enough to understand how to enable it! And as often is the case with PW ... it is super easy. ? If in your profile you are directly working with CommentArray, you will just have to enable honeypot passing it as an option to the renderForm() function of CommentArray class, example below: $comments->renderForm(['requireHoneypotField' => 'email2']); And .. we are done! ?? If you will look at the html of your Comment Form you will see an additional line CommentFormHP, that's the hidden honeypot field. In case you are using the Uikit 3 Site/Blog Profile, the renderForm() function is called in _uikit.php, ukCommentForm() function. If you wish that honeypot field is applied to every comment form of your site, just add the requireHoneypotField option to the list at the function start: ... 'errorMessage' => __('Your comment was not saved due to one or more errors.') . ' ' . __('Please check that you have completed all fields before submitting again.'), requireHoneypotField' => 'email2', // >>>>> ADD THIS LINE ); ... Otherwise if you wish to add honeypot in comment form on selected templates only, do not modify ukCommentForm(), but pass the option requireHoneypotField when calling the function in your template: ukCommentForm($comments, ['requireHoneypotField' => 'email2']); Now that we enabled it, let test if honeypot works. ? In the browser development section let's select the honeypot field and disable css {display:none} to show it. A new field will appear: If the spam bot is going to fill the field with a value and submit the form, an error is returned and comment will not be submitted ? That approach is great as spam comments will not be even saved inside the table field_comments. ? I hope this can be of help if somebody needs to enable this PW comments feature.1 point
-
1 point
-
@Mithlesh, After looking at your template code, I do see the following (lines 18-29) <section class="map-image"> <div class="container"> <div class="row"> <div class="col-md-12 col-sm-12 col-xs-12"> <div> <img src="<?php echo adapt($page->header_image->last()); ?>"> </div> </div> </div> <!-- Tab Address --> </div> </section> All of this is coming in after the $form rendering on line 13. If you were to remove the section I posted above, the header image would not display.1 point
-
I'm running into this issue on my localhost (MAMP) where it reports PHP’s standard "Fatal Error: Maximum execution time of 120 seconds exceeded" before even 1 second occurs. It does this regularly, but not all the time. But if I'm clicking around pages, I'll see often (maybe 1 out of 7 requests), and it halts the request. The file reference is always somewhere in either ImageSizerEngineIMagick or ImageSizerEngine, though a common place is on the line that instantiates the IMagick instance in the processResize() method: // start image magick $this->im = new \IMagick(); I looked into the ImageSizerEngine::setTimeLimit() method in detail, but there's no problem I can spot in there. I have no idea what the issue could be, but just replying here since @Mikie also ran into it, so it seems to be reproducible. Though it's a weird anomaly that we should never see unless 120 seconds actually passed (but they didn't, not even close). I haven't observed it occurring on any live servers yet, just my localhost environment on PHP 7.2.10. I'm guessing the issue might be PHP version specific or IMagick version specific since it appears to be PHP outputting an error with false information. Posting here in case anyone else has insight on what it might be.1 point
-
Hey @bernhard If you like, I would to share my experiences with Tabulator inside of PW (without using your module). I implemented working PW panel links inside the Tabulator, that update the table after changing a page (but the solution is not yet optimal) and virtual rendering and also grouping. I think these things would be great for RockTabulator. If you like to get some information, you can contact me on Skype. I do not have enough time to write a tutorial right now.1 point
-
I've used template prefix syntax for my fields in one project and it is really annoying now ? You might find some inspiration here: https://processwire.com/blog/posts/making-efficient-use-of-fields-in-processwire/1 point
-
Hi eydun, I try to reuse fields if they have the same use-case. No template-prefixes. When your site gets more complex, you can use tags for your fields to get a better structure in your fields-overview.1 point
-
I think that having different page titles and names is not what a user wants 90% of the time. I think it would be great to have it synched by default (eg a checkbox that enables custom pagenames only if the user really wants to). This could then also work when a page is cloned and the title is changed. The pagename would automatically change.1 point
-
1 point
-
What does everyone think of the cloned page keeping the name of the source page? I am using my PageRenameOptions module so this doesn't affect me, but I expect most site editors who use the copy button won't expect that they have to re-"name" a new page to match the title.1 point
-
What the others have said. In addition, note that you can use your own param string when you build your modal URL and check that instead. However, I have found that param strings are not as reliable as url segments. I tend to use the latter more. For instance, for my process module's modal landing pages, I append some pre-determined url segments and check that instead. Below, some rough examples of both approaches (untested, mostly written from memory :-)). // using custom param string (popup) $url = $this->wire('config')->urls->admin . "your-process-module-name/some-page/?modal=1&popup=1/"; $input = $this->wire('input'); if((int)$input->get->popup == 1){ // in modal } // OR using custom url segment (popup) // create URL with segment $url = $this->wire('config')->urls->admin . "your-process-module-name/some-page/popup/"; $input = $this->wire('input'); if($input->urlSegment2 && $input->urlSegment2 == 'popup') { // we are in a modal } else { // not in a modal } Something along those lines...1 point
-
1 point
-
Okay, I see where you are going wrong. You need to enable pagination for the template that is listing the results, not for the template of pages you are getting in your find() selector.1 point
-
Hi Jeevanish, For the most point some of these are just buzz words. Headless CMS is basically the CMS exists away from the website and talks via an API such as JSON / XML / GraphQL (This allows you to use the data anywhere on the web or an internet connected drive, lets say for an APP) Hybrid CMS is something that seems relatively new, and it seems to be that Headless CMS doesn't have great editor functionality, hybrid seems to be a buzz word around it's a great easy to use CMS with Headless functionality, I guess if you installed GraphQL to ProcessWire it would be considered hybrid. Digital Experience Platform seems to be a platform that all talks to each other using different mediums. Lets say you have a train station, that system lets you book a ticket, that then updates a message board letting them know how many tickets are left, which updates their website and also sends to the ticket attendents which shows that the ticket is for that train. This is just an example. This system can be accomplished with Headless or Hybrid.1 point
-
There is a great module by horst that can be found here (support forum) which also supports attachments. There are example uses found in the forum.1 point
-
Thanks for pointing these out. Latest release (2.1.0) includes improvements to spacings and the position of the triangle. Just for the record, the positioning is of the triangle was actually intended to be consistent with Admin Theme Uikit, where it's also off-centre, but I've now centered it in Admin Bar anyway ? In 2.1.0 the problem with "add new" button has been fixed. My initial idea was indeed to leave these buttons out if they have no purpose, but opted to leave them as-is, because that's how it's always been. For the same reason I was slightly hesitant to remove the full stop: this change will break existing translations. I've now done it anyway, since it's a relatively small thing. Note that 2.1.0 is actually bigger update than I anticipated. Class names have changed a bit, all themes had to be updated slightly, there's new JS, layout is now based on flexbox instead of floats, etc. So far things seem to work as expected (better than before), but let me know if there are any new issues ?1 point
-
I'm using this now on a site that needs that extra level of metadata. It's working great. Thank you.1 point
-
In case anyone is interested, cloning also doesn't update the createdUser and modifiedUser values. I have submitted an issue: https://github.com/processwire/processwire-issues/issues/927 but in the meantime, I am using: $this->addHookAfter('Pages::cloned', function(HookEvent $event) { $p = $event->arguments(1); $p->createdUser = $this->wire('user'); $p->save(array('quiet' => true)); $sql = "UPDATE `pages` SET `modified_users_id` = '".$this->wire('user')->id."' WHERE `id` = '".$p->id."';"; $this->wire('db')->query($sql); }); Modified can't be changed via the API, hence the SQL. I suppose created could also be done this way, but hopefully this is just a temporary fix assuming Ryan agrees to change the current behavior.1 point
-
Thanks @horst For clarity, setting max_execution_time is seemingly working, in that if set to 0 I get "Maximum execution time of 0 seconds exceeded". I have checked a bunch of the things you mentioned, but will double check, there is definitely something amiss. I read on some website earlier today (can't find it now, will hunt down the link) that there can be some buggy behaviour with this setting in php, and that other services can cause it like the server (apache has a max execution time as well, default 300). Also noticing that imagemagick is 1000% maxing all 6 of my cpu's on these transforms, although I guess that's what they are there for. Edit: link mentioned above http://bafford.com/2016/12/02/php-misleading-error-maximum-execution-time-of-0-seconds-exceeded/1 point
-
Using Database class is actually quite straightforward. It's nothing but a wrapper around PHP's PDO class with some PW specific features. You prepare a SQL statement using prepare() method, then bind input values, execute() it and fetch() the results. <?php namespace ProcessWire; // sanitization $tableName = inputPost()->text('table'); $columnName = inputPost()->text('column'); $id = inputPost()->int('id'); // this is where you'd sanitize user input to prevent SQL injection $table = database()->escapeTable($tableName); $column = database()->escapeCol($columnName); $q = database()->prepare("SELECT `$column` FROM `$table` WHERE id = :id"); $q->bindValue(':id', $id); // always bind values instead of concatenation // $success = false; $values = null; try { $success = $q->execute(); $values = $q->fetchAll(); } catch (\Exception $e) { wire()->log($e->getMessage(), Notice::log); } if (!$success) { // handle error } if ($values) { // use values } To see how PW utilizes this class, check out Fieldtype.php, FieldtypeMulti.php, PagesEditor.php and PagesLoader.php from the core.1 point
-
Definitely, as long as you are working with the pages api. There are cases though where you have to query external tables. And in that case it could be a bit more developer friendly than standard PDO. @Zekathanks, will look into that. What I was suggesting is simply an abstraction to always use the same api, no matter if you are inserting, querying, using prepared statements etc.1 point
-
foreach ($pages->find('template=basic-page, limit=50') as $p) { $p->of(false); $p->title = "My New Title";// if using a new title...otherwise comment out this line $p->name = $sanitizer->pagenName($p->title); $p->save(); $p->of(true); } If renaming in the thousands let us know so that we can adjust the code...1 point