Leaderboard
Popular Content
Showing content with the highest reputation on 08/10/2020 in all areas
-
Do you mean the part about "$this->runHooks('event-name', $args)"? ? If so, what I meant is that you could register your "listener" by hooking into some non-existing method in the TemplateFile object (or class), and then "emit an event" by running hooks: // somewhere early; prepend file or something: $this->addHook('event-name', function(HookEvent $event) { echo "<!-- I'm " . $event->arguments['what'] . " -->"; }); // alternatively you could add the hook in module or init/ready.php: wire()->addHook('TemplateFile::event-name', function(HookEvent $event) { echo "<!-- I'm still " . $event->arguments['what'] . " ->"; }); // then "emit an event" in the template file: $this->runHooks('event-name', ['what' => 'listening']); It's not quite the same thing, there's no queue, syntax is a bit crude... but as I said before, this might be enough, depending on your actual use case ?4 points
-
Processwire and the whole community is AMAZING, but the only thing that I think is missing... is the part where developers start to create, sell and maintain their plugins. By creating a premium PW plugin marketplace the following scenario will probably happen: 1. @ryan will/can receive a comision on each sale. This will be a well deserved token of appreciation for all his amazing work invested to build and maintain PW. 2. Plugin creators will be constantly motivated to build, maintain compatibles and improve the quality of their plugins. 3. The developers that will pay and use the premium plugins and they will save thousands in development time. Probably their clients will be happier with smaller project fees and shorter delivery times. I’m suggesting this since I’m always looking in Craft cms plugin marketplace and I have the feeling that they have a plugin for everything. Some are silly some are amazing... i know.. But in the moment you browse it, you always have the feeling that the only thing you have to do in order to create a big project is just to put the puzzle pieces together. If PWmarketplace would be a real thing... What would be the premium plugin that you will want to buy RIGHT NOW?3 points
-
Not sure if this is documented anywhere, but you can use the RepeaterMatrixPage::matrix() to get the label: // get the label in the current language $page->my_repeater_matrix_field->first()->matrix('label'); In recent versions of RepeaterMatrix, you can also call RepeaterMatrixPage::getMatrixInfo() to get an array of information, including the label: $page->my_repeater_matrix_field->first()->getMatrixInfo();3 points
-
I think in its basic it can be something like https://www.php.net/manual/en/class.splobserver.php ?3 points
-
https://github.com/ryancramerdesign/ImportPagesCSV for all your import needs. I have moved Drupal sites, Wordpress sites, Joomla sites. As long as you have a good export routine, this module works flawlessly for me.2 points
-
An SQL "expert" with records with duplicate keys? That starts alarm bells ringing for me. Generally any SQL table should have a primary key which by definition must be unique for each record. Of course it's possible they have some sort of composite key based on multiple fields that needs combining to correspond to a unique page name in ProcessWire. There are certainly cases where I've build SQL tables with composite keys, with one scenario being many-many relationships, and that's something that Processwire doesn't handle too well, although there is a module that makes many-many type relationships possible, although it doesn't compare to what you can do with pure SQL. Processwire does handle One-Many relationships fine via page reference fields or Pagetable fields. If you really must have a direct relationship between SQL commands and table structure and your CMS, I actually wonder whether ProcessWire is your best option. I've been doing a bit of investigation of Directus which looks promising, although it's headless, so no templates for output like ProcessWire, just a REST API, from what I can see, no full text indexing, and being more of a direct SQL - CMS mapping, it also lacks the hierarchical parent-child structure that ProcessWire handles so well, as it doesn't make any assumptions about what sort of data structures you have, whereas ProcessWire, while generally very un-opinionated does treat everything as a page in a page hierarchy. For websites, that's generally a pretty reasonable assumption, but if you really don't want that, and just want pure SQL tables then there are alternatives. While something like Directus will give you a direct SQL to CMS mapping, it won't fix bad SQL data, so if you've already started down the ProcessWire path, you want to be really sure it's worth the effort to change. I come from a pure SQL background myself, and it only took me about 20 minutes of reading the ProcessWire documentation to understand how it works, so I don't think it should be hard for someone from an SQL background to adapt. Maybe there's room for a blog post or tutorial showing how to "do it this way in SQL" and ProcessWire equivalent along with what's different.2 points
-
This week we’re proud to announce the newest ProcessWire master version 3.0.164. Relative to the previous master version (3.0.148) this version adds a ton of new and useful features and fixes more than 85 issues, with more than 225 commits over a period of 7 months. There were also a lot of technical changes in the core, including some pretty significant refactoring of several classes to further optimize and improve upon our already solid core, making it that much better. I’m confident this master version is one of our best and if you are running an older version I’d encourage you to upgrade when convenient to do so—I think you will really like what this version brings! Read all about what’s new in the latest blog post: https://processwire.com/blog/posts/pw-3.0.164/1 point
-
The ecumenical city pilgrim trail in Villingen, Germany is a small trail through the city where you can visit churches and other places of interest. This Progressive Web App is a small website to guide visitors through these places and give additional informations. You can install it on your smartphone or tablet and walk the trail with it. app.stadtpilgerweg-villingen.de Features: Interactive Map Progressive Web App Interactive Map Before entering the map you get a little tutorial where you can choose between two routes, the standard trail or a more accessible trail. You can track your position on the map and click on the markers. Each marker is a view with additional information to the place. The views can contain texts, quotes, images or a chat element. The map was realized with Leaflet and styled with Mapbox. Progressive Web App The website can be installed as Progressive Web App on your smartphone or tablet for a better experience. The PWA remembers the last visited view and has no unnecessary browser navigation. It can also partly work offline and caches almost everything. The PWA was realized with the help of Workbox. Modules used: Repeater Matrix ProCache Map Marker (Google Maps) Sitemap ProcessWire Upgrade TOTP two-factor authentification Tracy Debugger Regards, Andreas1 point
-
Temporarily comment out the following line in Page.php: throw new WireException("You may not modify '$key' on page '{$this->path}' because it is a system page"); This will allow you to clone the home page via the API: $homePage = $pages->get('/'); $pages->clone($homePage, $homePage, false);1 point
-
I could give you a hand as to how the script works and overall execution, but I can't provide the script. It's honestly nothing complex though... it just grabs the feed and does the processing the site needs to get the data into the site as pages (or deletes old listing pages based on other criteria). Given your experience with ProcessWire, it's nothing too out of the ordinary.1 point
-
By the way, here's a filter I often use to enrich the path for files or images directly with the corresponding pageID, so that you only have to prefix the file path. <?php namespace RockFinder3Column; /** * Column type for multi-value fields like options, page reference, etc */ class FileWithID extends \RockFinder3\Column { public function applyTo($finder) { $finder->query->leftjoin("`{$this->table}` AS `{$this->tableAlias}` ON `{$this->tableAlias}`.`pages_id` = `pages`.`id`"); $finder->query->select("GROUP_CONCAT(CONCAT(`{$this->tableAlias}`.`pages_id`, '/', `{$this->tableAlias}`.`data`) ORDER BY `{$this->tableAlias}`.`sort` SEPARATOR ',') AS `{$this->alias}`"); } } This results in the string for example: "1234/myfile.jpg" and now just prepend with "$config->urls->files" in the output and you have the full path to the file. Maybe it helps somebody and is looking for exactly that. ?1 point
-
I finished 10 years using Gnu/Linux for everyday purpose and zero Microsoft ... ?1 point
-
On the one hand, I was more or less forced to switch to RF3 because RF2 no longer worked with the new PW-Master 3.0.164. Somehow the bindValues in the selectors were not processed correctly anymore, so that no PageIDs and paths were resolved correctly in the SQL statement. For this reason I have migrated completely to RF3. That was not a big problem either. In general, not much has changed from the public functions. In addition, it is also much more comfortable in RF3 to create and manage your own filters. Well done! I also wrote my own table aliases in the SQLs in RF2 quick and dirty, which RF3 now handles very cleanly itself. My application case has not changed. I continue to use RF3 to load masses of fieldset pages within repeater items, which contain lots of fields with design options for the repeater item. As already described in the RF2 thread below: In this context, once again many thanks for this module and the further development! ?1 point
-
The Joomla site was done decades ago. Sure we could have updated and stayed with Joomla, but it often feels like an overkill for what the site requires, leaving you with removing what you don't need instead of adding what you need. Same goes for Wordpress. Processwire gives you a blank markup to build on. That was the selling point. And we had to re-build the entire markup since it's so outdated. Lister itself (included with any new PW installation) is quite helpful and comes close to what a non-relational database looks like. Lister Pro, as mentioned, if I can figure out how to bulk import as well, I guess would be the best of both worlds, and would come close to the way the client is used to handle the data. I don't think we're well advised to yet again change horses, Directus would probably bring other complications, no CMS is perfect after all.1 point
-
I think that should be a lot easier. You can setup any vhost you want on your server to access your website, eg website.com, website2.com, or as subdomain admin.example.com. So you setup 2 vhosts, one that points to the root dir with the folder containing your pw installation, so that you can access the frontend (example.com/app) and one that points directly to the app folder (eg admin.example.com) In admin.php you add some PHP to check for $config->httpHost and block access to the admin if the request comes from example.com or www.example.com. In ready.php you add some PHP that redirects requests coming from admin.example.com to admin.example.com/yourpwadminurl --> if anybody visits admin.example.com he/she will be redirected to admin.example.com/yourpwadmin --> users visiting example.com/app/yourpwadmin will be redirected to example.com/app (or blocked via 404, as you like)1 point
-
1 point
-
Just to add to the discussion....how Laravel does it: https://laravel.com/docs/7.x/events1 point
-
Generally I think event handling can quite easily happen outside of processwire with something like https://event.thephpleague.com/2.0/.1 point
-
A while ago I added an event listener / event queue feature for Wireframe objects: https://github.com/wireframe-framework/Wireframe/blob/master/lib/EventListenerTrait.php. The rough idea is that the object itself keeps track of events and listeners, and if an event is emitted ($this->emit('event-name', $args)), related listeners will be notified. This concept was loosely based on the Vue.js events system. This might be overtly complex for your needs, though. Something as simple as $this->runHooks('event-name', $args) would likely work just fine (though it depends on your use case) ?1 point
-
Not sure, but I don't think so. It's primary function is to list and edit existing pages. Might be there's an action for bulk import / creation, but I haven't seen it yet. But again, if your client absolutely needs something like that, why not build a simple interface that will allows them to batch create pages? See the example code above by @Kiwi Chris, it's literally that simple. I've even done some imports directly from the Tracy Debugger Console before, and it took like 15 minutes ... all you need is a couple of lines to create a new page, and then assign values using the field names in your template. Add an file_get_contents to read from a CSV file or something, a foreach loop and you've got your reliable and simple pages import.1 point
-
Not sure I fully understand what you're doing, but if you want to submit a search query with AJAX you need to post it to the same URL that you normally would post it to — if your search page is /search/, then that's where the AJAX query should go as well. Note, though, that by default SearchEngine responds to GET requests, not POST requests, so that may be one reason why you're not getting the results you'd expect. Might want to switch to jQuery.get() or change the method from POST to GET in your jQuery.ajax() call. Just for the record, SearchEngine has a built-in way to render results as JSON. This is what I typically use for AJAX search features. JSON data is pretty easy to handle with JS, and this way I'm not stuck with whatever markup the search results list on the regular ("full") page is using. When you asked if "Is it possible to realize showing results with AJAX like on the pics", the short answer is "it sure is" — but you'll have to create the markup and the JS parts yourself, since SE doesn't provide those out of the box ?1 point
-
Hello @Greg Lumley, From what I understand (and I am not an expert as are the others here) there are two ways to process an ajax request: 1, create a page with corresponding template and php file (preferred/common method), or 2, create a php file outside of the site folder. Which method you choose has different requirements. The common method is to create a php file (in templates folder) named ajax_contact.php to handle the ajax request, assign that file to a template named ajax_contact, and create a page for that template named ajax_contact. Your ajax url them becomes the name of that page, ie, /ajax_contact/. Note that the page should be published or PW will ignore it during your request. Method two I think requires that you initially load PW (index.php) in your ajax_contact.php file since you are outside the document root referenced during the processwire installation. In this case, your ajax url would be the actual php file name; ajax_contact.php. I don't know which method is preferred, but I use the first method simply because that is the way processwire handles normal page request. I think you have both methods implemented in your script at the same time when it should be one or the other. I hope this helps. I'm sure someone more knowledgeable will provide you with a better answer, and hopefully correct me as well.1 point
-
@dragan, thanks for chiming in. The site is a small site, and the home page template is used on other pages as well. It is a salessite, where I started with one major salespage as the homepage, but now want to add another page as home page, that is why I want to clone the homepage rather than rebuild it with around 30 carefully built repeater matrix fields on it. "PW-like" to me means to be able to do what is needed. It would be great if there was an option to specify which page to be used for the homepage. How simple can that be? I do not like wordpress (to put it mildly) but I have a few sites running on it, just to try out stuff that I then port to processwire. This particular site is a port of some funcionality that we ported from thrive themes, which now allows me to build very good salespages with an great amount of variety, through the use of repeater matrix. But once a page is built it is so much easier to clone it rather than rebuild by hand. Oh, BTW your suggestion did not work, even with all the settings you specified - which are standard on my site anyways, I do not have the option to clone the homepage. Anybody else know how to do this1 point