Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. Thanks a lot! I tried to do this, but using the table, as in the instructions, it did not work, I will experiment a little later. But for myself, I made a solution (simplified here) like this that works: <? php $output .= ""; $items = priceTable(pages()->find("template=page-lang, sort=sort") foreach ($items as $item) { $matrixRow = $matrix->find("row={$item->id}"); $output .="<div class='row py-1 border-bottom font-xs-sm'>"; $output .= " <div class='col-4 language'> <a class='link text-danger' href='{$item->url}'>{$item->title}</a> </div>"; foreach ($matrix->find("row=$item") as $value) { $output .= "<div class='col price text-right'><strong>$value->value</strong><small class='d-none d-md-inline'></small></div>"; } $output .= "</div>"; } return $output;
  3. Today
  4. Thanks for your help. Because we may end up with a lot of posts I am creating a JSON file in a hook (based on @MoritzLost's example) so there is almost no overhead on the front-end. $wire->addHookAfter('Pages::saved', function(HookEvent $event) { $page = $event->arguments(0); if ($page->template == 'news-item') { $pages = wire('pages')->find('template=news-item'); $years = []; foreach ($pages as $p) { $year = wire('datetime')->date('Y', $p->getUnformatted('newsDate')); if ($year !== null) { $years[$year] = isset($years[$year]) === false ? 1 : $years[$year] + 1; } } file_put_contents('json/news-years.json', json_encode($years, JSON_PRETTY_PRINT)); } }); Thanks. 🙂
  5. Just that and the next two posts :-). - workaround in the 2nd post. I am afraid not. Nice site, btw 😊.
  6. Thanks for that link, I skimmed the pages but there are a few in that post haha. I'm still curious about the it parameter though, any insight on why it exists or what ProcessWire does with it?
  7. I see. No, it doesn't, although someone posted a workaround here, just FYI.
  8. I did but it's a multi-language site and from what I understand that module doesn't support that unfortunately.
  9. We're launching a new version of our website and I need to create redirects from old pages to their new counterparts at different URLs. An example rule that I've created is Redirect 301 /solar-energy-for-business /solar-energy/commercial-solar/ However when I visit the redirected URL it shows up in the address bar as: https://staging.renovaenergy.com/solar-energy/commercial-solar/?it=solar-energy-for-business We're creating these redirects for SEO purposes and they need to not have additional URL parameters being added. This line in the .htaccess file is adding the original URL as a parameter. RewriteRule ^(.*)$ index.php?it=$1 [L,QSA] Does ProcessWire use this parameter for a purpose? What is the best way to create these redirects without this parameter?
  10. Sorry for the late reply @Aleksey Popov, If you mean sort the displayed table on the fly, then that's not possible currently. If you mean one off sort for the field in respect to how it retrieves pages for building the rows of the matrix, then you do this in the field's settings. See the details tab when editing the field. For instance, if using a selector, you would do it as shown below: I hope this answers your question. If not, please let me know.
  11. For what it's worth, I have the following working without any issues: website on a fresh digital ocean ubuntu 20.04 droplet with lamp stack (installed using sudo tasksel install lamp-server) processwire 3.0.168 php 7.4.3 mysql 8.0.22 database on digital ocean database cluster -- set this up just now specs: 1 GB RAM / 1vCPU / 10 GB Disk / Primary only / SFO2 - MySQL 8 mysql 8.x (8.0.20 based on the logs) (connecting using the default 'doadmin' user account, which should be using caching_sha2_password, not mysql_native_password); no connection issues ... I'm clicking around going to various pages and it doesn't feel "fast". Not slow, but not fast. I then upgraded to the 4gb/2cpu database cluster and it's still pretty slow. I just switched back to the local mysql server and it's way faster. Keep in mind both my droplet and my db cluster were in the same region (SFO2). Looks like I won't be using Digital Ocean's database cluster at least until it's faster or I figure out how to make it faster (if it's possible). Not sure why it's so much slower. Related: https://bensmann.no/running-wordpress-with-digital-oceans-managed-mysql-databases/
  12. @Broxden - if users are able to upload different CSV files, you might at some point come across an issue with the BOM, so it might be worth implementing this: https://stackoverflow.com/a/51789304/1524576
  13. Yesterday
  14. Note sure if it suits your needs or not, but it's really easy to include https://dibiphp.com/ into PW and then you can query those sqlite databases within your template files / modules. You can put this in your init.php file: require_once __DIR__ . '/vendor/autoload.php'; $this->wire("dibi", new Dibi\Connection([ 'driver' => 'sqlite', 'host' => hostname, 'username' => user, 'password' => pass, 'database' => dbname, ])); and then you can query using the global $dibi variable like this: $result = $dibi->query('SELECT * FROM mytable'); foreach ($result as $row) { echo $row->fieldname; }
  15. @netcarver Thanks! That's what I sort of thought. This project/client uses sqlite db's to sling datasets between apps and clients. I can certainly whip up some connectivity, but I would like to module-ize it and I'm not sure how to do it in such a way to be useful to anyone else.
  16. @Davis Harrison Dion Hello, whilst there has been sporadic chat in the forums regarding sqlite over the years, I don't think we are any closer to seeing core support for it. I'm also unaware of any third party integration that's using it. I'd be delighted if I were wrong about that though; perhaps someone lurking in here does know how it can be done.
  17. Yes, I always stick with the default (Uikit theme). You're correct that things don't change that much in the theme files, so long as you're happy keeping track of those and updating then you should be fine - it's just an extra hassle that I am not willing to deal with, but that doesn't mean others shouldn't change themes if they're willing to deal with the possible downsides.
  18. Hello, We're setting up a PW app that has a dozen sqlite databases it will use for various tasks and analytics. Does anyone know if there are any modules with any sqlite connectivity in them? I haven't seen any on first glance. I know this is nebulous, but is there any advise on how to best "fold in" sqlite connectivity AND data into PW's existing structure? Thanks!
  19. so this is really weird issue i am so confused about this, so i have setup 'images' field where i put images and the include them in CKeditor, should work right? well it works on some sites, i use it nearly in every page but at one page, the images included in that CKeditor only show up, when i am logged into processwire, when i turn on incognito mode the images dissapear, but only on this specific page, everywhere else it works perfectly, has anyone came across this issue? i have nowhere in the site login checker, i have no idea what is going on
  20. Thank you very much for taking the time to reply. I used your suggestion for a CSV file uploaded to a page field and it works perfectly!
  21. Thanks very much for your example, I'll give it a go tomorrow and let you know. 🙂
  22. I don't think you can do counts aggregated columns with ProcessWire selectors. There's Pages::count of course, but that only returns a single count. This isn't the most efficient solution, but should be fine for a couple hundred or thousand pages: $results = $pages->find('template=your_template'); $years = array_filter(array_map(function ($p) { $year = $p->getUnformatted('your_date_field'); return $year ? wire('datetime')->date('Y', $year) : null; }, $results->getArray())); $pagesPerYear = array_count_values($years); Below that you'll have to use raw SQL I think. Might also be possible with RockFinder3, not sure (@bernhard?)
  23. The reason it's not working is that you're giving fopen a relative path. This works fine with your test file if it's placed in the webroot, since the path is relative to that. But inside a template file, the relative path does not resolve correctly. For a static file, you can use $config->paths to retrieve an absolute base path that will always work: $f = fopen($config->paths->files . "1619/dundee.csv", "r"); If you want to read a CSV file uploaded to a page field, you can use Pagefile::filename instead: $filename = $page->your_csv_field->filename(); $f = fopen($filename, "r"); Make sure your CSV field is set to single file output. If your field allows multiple files, use $page->your_csv_field->first()->filename() instead.
  1. Load more activity
×
×
  • Create New...