Jump to content

Kiwi Chris

Members
  • Content Count

    82
  • Joined

  • Last visited

  • Days Won

    1

Kiwi Chris last won the day on November 13 2017

Kiwi Chris had the most liked content!

Community Reputation

148 Excellent

About Kiwi Chris

  • Rank
    Full Member

Profile Information

  • Location
    New Zealand

Recent Profile Visitors

964 profile views
  1. From what I understand, you want to list comments from each product page on the product brand page? Comments documentation is here: https://processwire.com/docs/modules/guides/comments/ If you look at the section in the docs titled OPTIONAL : Generating your own output it has this example code: foreach($page->comments as $comment) { if($comment->status < 1) continue; // skip unapproved or spam comments $cite = htmlentities($comment->cite); // make sure output is entity encoded $text = htmlentities($comment->text); $date = date('m/d/y g:ia', $comment->created); // format the date echo "<p><strong>Posted by $cite on $date</strong><br />$text</p>"; } Of course you can always replace the $page variable in that example with your own variable that returns a page, so you could do something like: $brandProducts = $page->children(); $foreach($brandProducts as $product){ foreach($product->comments as $comment) { if($comment->status < 1) continue; // skip unapproved or spam comments $cite = htmlentities($comment->cite); // make sure output is entity encoded $text = htmlentities($comment->text); $date = date('m/d/y g:ia', $comment->created); // format the date echo "<p><strong>Posted by $cite on $date</strong><br />$text</p>"; } } If your products aren't children of a brand, but simply have a brand field set using a page reference field for example, you'd need to use a selector instead to populate $brandProducts eg $brandProducts = $pages->find("brand={$page->brand}");
  2. I've found this module really useful, and thought I'd share an interesting use case I've come up with for it. I had a client who wanted both the functionality of pageTable, and PageTableExtended, ie they wanted a tabular summary like PageTable provides, but with the option to expand or collapse to display rendered detail from a template like PageTableExtended allows. It turns out, I was able to provide the desired functionality using PageTableExtended, and built in UI-kit classes in the template file I provided to PageTableExtended. <!-- This is the summary section, like displayed by PageTable --> <table class="AdminDataTable AdminDataList uk-table uk-table-divider uk-table-justify uk-table-small"> <thead> <tr> <th>BOM</th> <th>Cases to produce</th> <th>+/- or exact</th> <th>Notes</th> </tr> </thead> <tr> <td><?= $bom->title ?></td> <td><?= $page->cases ?></td> <td><?= $page->exact ?></td> <td><?= $page->notes ?></td> </tr> </table> <!-- Toggle to display detail section --> <a herf="#" class="toggleRenderedLayout"> <i class="toggle-icon fa fa-angle-right"></i> </a> <span class="renderedLayoutTitle">BOM Details</span> <!-- Detail section, hidden by default, using built in ui-kit css. --> <div class="renderedLayout hiddenOnStart"> <div uk-grid uk-margin-small-top> <div class="uk-width-1-3 uk-margin-small-top"><strong>Wine Variety </strong><?= $bom->wineVariety->title ?></div> <div class="uk-width-1-3 uk-margin-small-top"><strong>Brand </strong><?= $bom->brand->title ?></div> <div class="uk-width-1-3 uk-margin-small-top"><strong>Market </strong><?= $bom->market->title ?></div> <div class="uk-width-1-1 uk-margin-small-top"><strong>Orientation </strong><?= $bom->orienation->title ?></div> ... </div> </div> Screenshot, showing the tabular summary, with the detail section expanded.
  3. In the RTE, when inserting a link, there are several input fields that can be used to select a page, including a text input field that will auto-complete with pages on the site. When inserting an image, there is only an option to navigate the page tree. (equivalent to the second input option 'Select Page...' on the Insert Link screen from the RTE. When inserting an image from another page buried somewhere in the page tree, if you know the name of the page, it would often be quicker to use an auto-complete text field than 'Select Page...' option. It would be nice if the image insertion dialog offered the same functionality as the link insertion dialog so that when selecting a page it's possible to choose either to navigate the page tree, or have a text auto-complete field.
  4. Conditionally 2, provided the collapsible option is available. One of the things I like about Processwire is that it plays nice with mobile screens. Some other CMSs are clearly designed for desktops or large tablets only, but Processwire will work even on a smartphone. I can't say how often I'd actually use it on a phone, but it would be nice to have the option. I actually can think of a case where having the backend mobile friendly would be handy. I was at a market last year, and someone didn't have any cash, but did have a credit card. Of course the front end of my site is mobile friendly anyway, but it could be handy to have the backend mobile friendly too.
  5. If for any reason, you can't get terminal access, you can add the php code to any template that already exists in the /site/templates directory and then view any page based on the template to trigger it. You won't require the first require line in that case, and don't forget to remove the password reset code again afterwards.
  6. Beat me to it. It's one of the nice things about Processwire that the admin is simply a UI on top of the API, and anything you can do via admin, you can also do easily via a script.
  7. I'm trying this option, but I can't seem to get it to work. I've tried: public function ready() { $this->addHookAfter('Page::render', $this, 'updatePageViews'); $page = $this->page; } public function updatePageViews($event) { /** @var Page $page */ $page = $event->object; // don't add this to the admin pages if ($page->template == 'admin') return; if ($page->hasField('pageViews') and $this->user->isGuest) { //Update the number of page views for current page, but only visitor views not admin. $page->of(false); $page->pageViews ++; $this->pages->saveField($page, 'pageViews'); $page->of(true); } } and this way: public function ready() { $page = $this->page; if ($page->hasField('pageViews') and $this->user->isGuest) { //Update the number of page views for current page, but only visitor views not admin. $page->of(false); $page->pageViews ++; $this->pages->saveField($page, 'pageViews'); $page->of(true); } } But neither of them seem to do anything with template caching enabled. Any idea what I'm doing wrong? Edit: I found the problem isGuest needs brackets, ie isGuest()
  8. Update: In addition to the modules previously mentioned, the site now uses Padloper to add shopping cart functionality, and PaymentStripe and PaymentInvoice modules. I've also made some modifications to the MapMarker module so that I can use KML files from a separate files field as map overlays. This is really handy, as I can use Google Earth to define paths and areas that I can overlay on the map, which I can export and display with Processwire. In the process, of implementation with the payment modules, I discovered an issue with module dependencies and the modules cache in the database, which I've discussed and resolved here: https://processwire.com/talk/topic/19606-class-not-found-error/?tab=comments#comment-170031
  9. This was coming from an old CMS. I used Source: index.mvc?ArticleID={id} Destination: [[wid={id}]]
  10. It's great to see a government agency using Processwire. Here across the Tasman, I think Silverstripe has been mandated as the government CMS of choice which is sort of ok in some respects, but it's a lot more complex than it needs to be for many projects.
  11. Some people think that anyone who works in any form of IT is made of money, but sadly it's not always the case. I know the feeling about dying laptops. About a year ago, when it was just over 3 years old, the motherboard on my laptop died. Fortunately I was able to track down a replacement part on Ebay, and after carefully removing a lot of screws, swapping over the CPU and heatsink, and convincing Windows that I wasn't running a pirated copy, I managed to get up and going again. My desktop is a bit long in the tooth too, but since I upgraded the hard drive in my laptop and added an external screen and keyboard, the desktop tends to get less use now, although it was a lifesaver when I needed to get online to order the replacement motherboard for the laptop, and do some work while I waited for the part to arrive.
  12. I could use a field like this. I have a directory of local businesses and non-profit organisations, but sometimes their websites change or they go out of business, so it would be really handy to be able to run an automated script that can either hide or un-publish any listings that don't have a valid address. That would save on manually checking every one on a periodic basis to make sure they still exist. Of course I'd probably still double check manually any that get deactivated before removing them, but it would make the process a lot more efficient.
  13. Thanks. I didn't think to look there. There do seem to be a few dire warnings in that post about being careful with using advanced mode, but image fields are very much a core functionality, so hopefully there won't be any issues.
  14. A number of field properties can be specified on a per-template basis that override the field definition. For example it is possible to set minimum and maximum length for text fields, so that it is possible to use the same field on several different templates, but with some different specifications on different templates. It would be nice to be able to do this with image fields, as sometimes I've found I've needed to create multiple image fields simply because on different templates I want to enforce different maximum dimensions. I'm not sure how complicated this would be to implement, but in some scenarios it could potentially cut down the number of fields required quite substantially.
  15. I've managed to resolve the problem. I actually still think the issue might be a core ProcessWire one, but at least I know how to fix it now. Yes, I'm using the PW3 branch of Padloper, and it's working fine on other sites on my WAMP setup. I'm using AIOM+ on many sites with PW3 and it's working fine on all the others. I tried manually deleting all the entries in the cache table in phpMySQL and that allowed me to get into the site admin again temporarily, although it gave some notification about some modules that actually are present not being installed. I went to modules, and did a refresh, and the error came back. One thing I noticed that I wonder about, but don't know enough about how Processwire handles loading modules, is looking at the Modules.site/modules/ entry in the cache table, the modules seem to be listed in alphabetical order, and the offending module that is generating the error is listed before the module that it depends on, which it claims can't be found. I'd hope this shouldn't matter, as it could have serious implications for module naming, as the offending module was working previously, but it seems it does. I manually edited the order of the modules listed in the cache entry via phpMySQL, and the error went away. I've tracked down the issue with AIOM+ I think. There was a namespace conflct in that a reference to a root PHP class was picking up the ProcessWire namespace and obviously not working. I think I must have added a namespace statement to the module so that the module compiler didn't have to do it, but forgot to check any possible conflicts. The good news is AIOM+ works fine without namespaces in Processwire 3.x I think the AIOM+ problem might have actually been a red-herring with me trying to add namespaces to everything to try to get the first error to go away. The real culprit here is that if the Modules.site/modules/ gets regenerated somehow, it seems it can potentially break a site, as it will add modules in alphanumeric order, and if a module depends on another one that comes later in the sort order, then the class will not be found. This can be fixed with careful naming of modules so that a module that has dependencies will always be listed after any dependencies, so in the case of PaymentInvoice, since it depends on PaymentModule, it probably should have been called PaymentModuleInvoice which would ensure that regenerating the modules cache would always load it after PaymentModule.
×
×
  • Create New...