Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/09/2021 in all areas

  1. https://www.kaumberg.gv.at/ Hello everybody! Today I want to share a project that I've been working on for a year or so: The new website for municipal Kaumberg - a beautiful village near Vienna. To be honest, this project was way more work than I initially expected. The site has tons of content and the client came with lots of good ideas during the process of building this site. For example after we launched the site several organisations of the village realized that the system works great and is easy to use, so they wanted their own section with their own color scheme... Right now the system is maintained by several user accounts that populate content to the site. Some of them only in the news-section, others are allowed to publish to the sub-sites (eg for the fire department). Recently we won the 2nd price out of 190 cities in lower austria - where Kaumberg was by far the smallest one also having the smallest budget of the top rated cities! ### NOTE ### This system was built with scalability in mind. If you know any other municipals (preferable in a german speaking country) that could possibly need a new website using my setup write me a PM. If you are a marketing guru and know how we can sell this product to 100s of municipals, let me know. I know how to do that from the technical point of view ? ### HIGHLIGHTS ### CONTENT Custom multi-level menu for managing loads of content pages that also works well with keyboard navigation ? --- EVENT MANAGEMENT Events are managed via the PW backend and presented as calendar on the website plus can be downloaded as PDF calendar in A3 format for printing: --- CONTENT BLOCKS I've developed a new (private) module called RockMatrix for versatile, easy and fool-proof content creation for this project. This setup ensures that even non-tech-savvy users can create content that looks nice and works on all devices from desktop to mobile: --- SITE SEARCH Another new module that was developed for this project is RockSearch. I hate site searches that do work on the first sight but do not on the second. For example if they show older results on top of newer ones. Or if they do not index content that is not stored within a regular text field but for example as image description. On the other hand I did not want to use ElasticSearch because it seemed to be overhead to send data to another service that is already stored in the database of my PW installation... RockSearch shows results based on different weighing mechanisms, for exampe a search for the garbage collection schedule first shows results that are nearer to the current date than others (both future and past). That means that a date two days in the future will be shown above one that is 10 days in the past. Also results get different score based on where the term was found - matches in the site title get higher scores than matches in the body or in image descriptions or the like. Each content block is a RockMatrix block that has a render() method to define the output on the website and - for RockSearch - has a method called "searchIndex()" that defines the content that is written to the search index that is queried for every search request: This setup makes it super easy to add new content elements and to add them to the search index ? --- SUB-SITES The client can create sub-sites for different organisations of the village having custom color schemes and managing user access: News can be tagged to show up on different areas of the website: --- OTHER The site uses no cookies and can therefore be used without an annoying cookie banner. Page hit statistics are gathered by PageHitCounter and shown by RockHitCounter Some other little features are short-links for social media (eg https://www.kaumberg.gv.at/goto-1027 ) or the possibility for creating custom subdomains for sub-sites like http://araburg.kaumberg.at/ I'm quite sure I forgot lots of great stuff, but I hope you enjoyed reading this article nevertheless ? Looking forward to your feedback!
    3 points
  2. Sounds like you can simply set a flag at runtime: <?php // your script that creates the json page $page = new Page(); ... $page->createdViaApi = true; $page->save(); Then your hook should be able to catch that flag: <?php $wire->addHookAfter("Pages::saveReady", function($event) { $page = $event->arguments(0); if($page->createdViaApi) { // check and throw exception } else { // check and show error to user } });
    3 points
  3. They should do a stateofjs article every month. There's always a new framework that is the flavour of the month
    2 points
  4. I think the easiest and arguably cleanest way to detect this would be wire('page'). In the Admin it will give you the system page with the ProcessPageEdit process, ID 10. When it’s your API it should be whatever page you set up as the endpoint. Or you could look at input()->url or something.
    2 points
  5. Hey Bernhard! First of all: congratulations, this looks and sounds like a brilliant project. And thanks for sharing all those details, always love to hear how things were actually solved ?? Your site search is something I'm curious about, so hoped you might shed some light particularly into the part about sorting. How did you go about that? Do you store the index content on PW fields, or do you have a custom data structure? Do you trigger multiple queries behind the scenes, or did you manage to handle sorting in a single query, in the database? Any SQL involved? Asking partly because this is a kind of a long standing issue / todo item for the SearchEngine module. Weighing is relatively simple to do with custom database tables / queries (or rather there are existing formulas for that), but with selectors... well, it's tricky. By which I mean that I haven't been able to figure it out yet without a) custom SQL queries or b) expensive in-memory operations. And yes, I'm kind of fishing for good ideas here... ?
    2 points
  6. Please read this blog entry. You can use images, links, a dropdown or your own custom solution for adding new matrix items: New Repeater and Repeater Matrix features (processwire.com)
    2 points
  7. I created a companion module for Fluency to translate all fields on a page at once: https://github.com/robertweiss/ProcessTranslatePage You can find the corresponding conversation about it in the Fluency thread (link below), but I decided to add the module to the official list so others who have a need for this have an easier time finding it.
    1 point
  8. I published a new update with the following changes: changed filename of css/js files to PageMjmlToHtml (instead of debug) changed module configuration value name templates to allowedTemplates to avoid confusion modified the js so the copy to clipboard code works on all browser modified getCacheName method so it also checks for LanguageSupport and LanguageSupportPageNames Regarding point 2: please double-check the "Templates to convert (...)" field in the module settings properly catched up your previous value Thanks again @wbmnfktr for his thorough tests!
    1 point
  9. And time for https://2020.stateofjs.com/ :) And here is more stats with broader view: https://almanac.httparchive.org/en/2021/
    1 point
  10. For whatever reason my response helped. At least it helps in whatever direction.
    1 point
  11. I think your solution works for a bigger context of where a lot of data on a page would be dependent on the context it was created in. I just needed to make sure that the hook for one field can determine at runtime whether the field was filled by a user in the PW admin or the Page API. Your solution from the PW admin side did make me think bigger picture which is also a possible solution for my application. This field is being used on pages that can be created/edited in the ProcessWire admin, but they can also be created/modified by a website REST API that other systems- in our case Salesforce- can use to create/modify data on the site. Calls to this website API are authenticated using ProcessWire users which have an API key assigned and a role of web-api-access. So rather than focus on verifying where the the page was created at the field level, I could check that the user creating the field is an API user at the page level. I got a little more into the weeds with that description, but your idea helped me think of a different approach.
    1 point
  12. 1 point
  13. Thx @teppo It's option a) custom SQL queries ? I can't share details here but it's quite complex ? I mean... it's easy to use but in the background the module creates a quite complex sql query based on indices that I define for the search.
    1 point
  14. Wow, great website ! Congratulations !!?
    1 point
  15. Translating only changed fields is quite a good idea, I just added it in v0.7 ? New radio option: Write Mode (replaces the checkbox Overwrite Existing Translation) Translate only if target field is empty Translate only changed fields Overwrite all target fields Caution: the »Changed fields«-option support is currently only one level deep. If you change any value inside a Repeater(-Matrix) or FieldsetPage field, the complete field will be translated. If anybody knows how to get the names of nested fields that changed inside the afterPages::saved hook, please let me know ?
    1 point
  16. Good catch. Now that I think about it, returning all repeaters makes sense in the admin context — otherwise you wouldn't be able to edit all repeater items on page edit screens. But as you said, you'll have to remember to properly mark/mask unpublished repeaters yourself.
    1 point
  17. Sure: https://processwire.com/blog/posts/processwire-2.5-changelog/#adding-pages
    1 point
  18. @dotnetic I picked it up after developing our API in Slim and looking at some best practices. It would be really great if this was the ProcessWire default.
    1 point
  19. I'm a little late to the game on this but wanted to throw out what we use on our PW sites. We keep all credentials in .env files in the root directory and then loaded using a package called phpdotenv. The .env file is loaded and then the credentials can be accessed at runtime via the $_ENV global. Some further details on this setup: .env files are automatically protected system files in Apache and will not be served (unless someone actively overrides this, but that would be bad). These files are not added to the Git repository and never stored. We have .env files for local, staging, and production. The contents of each file are stored in whole as a secure note in our password manager. The dotenv library is loaded once in config.php and the values are available globally. We also store credentials for external APIs and services. This allows us to store not only credentials, but any values that differ between local/staging/production. We store all of our config.php variable values in .env so that the config.php file is environment agnostic and we can always be sure that the .env is the single source of truth for the entire CMS configuration. We use Git to deploy to staging/production servers so using .env files allows us to push all of our code while knowing that sensitive information and data that changes between environments never gets mixed up. Also makes it very clear to anyone looking at the code that these values are stored in a dedicated system dot file. Here's the package, can be installed with composer https://github.com/vlucas/phpdotenv This is what a config.php file looks like with it in use: <?php namespace ProcessWire; // Load env variables from .env in root directory $dotenv = \Dotenv\Dotenv::createImmutable(__DIR__ . '/../'); $dotenv->load(); $config->debug = filter_var($_ENV['CMS_DEBUG'], FILTER_VALIDATE_BOOLEAN); $config->usePageClasses = filter_var($_ENV['CMS_USE_PAGE_CLASSES'], FILTER_VALIDATE_BOOLEAN); $config->useFunctionsAPI = filter_var($_ENV['CMS_USE_FUNCTIONS_API'], FILTER_VALIDATE_BOOLEAN); /** * Database Configuration */ $config->dbHost = $_ENV['CMS_DB_HOST']; $config->dbName = $_ENV['CMS_DB_NAME']; $config->dbUser = $_ENV['CMS_DB_USER']; $config->dbPass = $_ENV['CMS_DB_PASS']; $config->dbPort = $_ENV['CMS_DB_PORT']; $config->dbEngine = $_ENV['CMS_DB_ENGINE']; // Etc... Hope this might be useful to someone!
    1 point
  20. Here's a video demonstrating a RepeaterMatrix full page builder using PageAutosave with live preview. I really want to hear your feedback if you think "non-coders", but those with decent skills, could use such a builder successfully.
    1 point
  21. The item you want to give special treatment to is the last item in the WireArray, so you could use pop() to get that item and remove it from the WireArray: Alternatively here is a more flexible approach that you can use for any item in the WireArray:
    1 point
×
×
  • Create New...