Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/14/2020 in all areas

  1. @ngrmm Yes, you can set regular cookies as mentioned in my first paragraph, though they won't be accessible through ProcessWire's $session API. But why would you load 87kB of library bloat for something that you can do in one line? ?
    4 points
  2. Those numbers seem pretty normal. Just for comparison: The doc (HTML) part of a fairly complex site I recently finished takes ~600-900ms when I'm bypassing ProCache. This is from browser, though, so could be a bit different from what you're measuring (not sure how exactly you got these numbers). With ProCache I'm getting consistent < 100ms. ProCache serves content directly from disk (via Apache), bypassing PHP and database, so it's naturally quite a bit faster. Took a cursory glance at a couple of (also relatively complex) WordPress site that I know for a fact are well built and hosted on pretty powerful hardware, and load times for these were somewhere between ~1.5-3 seconds uncached, 200-400ms cached (static cache using nginx, I believe). In my opinion 1-3 seconds would still be "pretty good" for just about any ProcessWire or WordPress site without proper caching. Anything below 4-5 seconds is in the "pretty normal" range, while 5-10 seconds is just plain wrong (but sadly not that rare). 5+ seconds is usually a sign of really bad hosting, or really bad implementation ? Might be worth noting that, in my experience at least, PHP is rarely the real bottleneck: if the server returns the markup in a few hundred milliseconds but then there's blocking JavaScript, CSS, or perhaps a large image that takes hundreds of milliseconds to seconds at worst to finish loading and/or executing, it would be better to focus on that. Just saying; developers (including yours truly) have a tendency to focus way too much on shaving milliseconds off one end, even if at the other end it might be possible to shave off seconds ? Template cache loads the page from the disk and doesn't execute any of your markup generating code, but it still has to go through ProcessWire, so there's definitely some overhead there compared to ProCache. How beneficial template cache is (in comparison to non-cached site) depends a lot on how complex the site is and how well it's already optimized. Kind of covered this already, but to reiterate: it would definitely make a difference. ProCache is usually low maintenance, but this depends a bit on how your content is generated — such as whether it's all from stored with/in ProcessWire, or if you have parts that are loaded (especially with PHP) from other sources. Typically ProCache gets flushed based on predefined rules when pages are saved, so if your content isn't stored on pages, that could be a potential issue. In which case you may even need to programmatically flush it (via cron or some other method). You can configure the preferred lifespan, so technically you can make ProCache stick to cached data almost indefinitely, and thus ProcessWire/ProCache will very rarely need to regenerate it. Though, again, in my opinion this is something that folks tend to pay too much attention to: if your typical page render (non-cached) takes 1-3 seconds at most and your cache hit ratio is 99+%, cache warming has so little actual effect that it's (in my opinion) mostly just wasted time and effort ?
    3 points
  3. Agrio is a medium-sized publisher with more than 70 employees and offers a leading cross-media agricultural portfolio. In the more than 30 years that Agrio has existed, we have managed to gain the position of market leader, with the highest reach in the agricultural in the Netherlands. In addition, our customers know where to find us for various printing, web design, copywriting, video productions and graphic design. Agrio does all this with a lot of passion and a proactive attitude. Farmer sobriety predominates. Independence, job satisfaction and growth are important core values within the organization. There is always room for new talent. We currently have room for a PHP Developer in our Media and Design department. https://www.agrio.nl/vacatures/php-developer/
    2 points
  4. I think ProCache will always bring benefits as it basically turns the website into a static website, routing requests directly to html files. It will always have the bottleneck of the first request after the cache expire, so there's that (unless you do some work around it with cron for example). But as long as you configure your cache to expire correctly after page updates, there shouldn't be much trouble if your site is brochureware.
    2 points
  5. I added a feature for this in todays 0.3.0 (not pushed the release tag yet, as there was a lot of rewriting to implement this feature). If you want to show an opt-in element instead of the consent-required element, just add a data-attribute data-ask-consent="1". Here is an example: <iframe src="" data-src="https://www.example.com/" data-category="marketing" data-ask-consent="1" frameborder="0" height="400" width="400"></iframe> In this case, the iframe gets only loaded, when cookies of type "marketing" are allowed. If not, the user will be asked for consent. The text of the consent-window is configurable in the module config. The markup of this message also includes an css class with the type of cookie, if you want to style them specifically. privacywire-ask-consent.mp4
    2 points
  6. you're right. I'll use the localStorage and hide/minify the modal with js/css if modal is dismissed.
    1 point
  7. You can't save data to the session in the browser, because session data is stored server-side. The only thing the browser stores regarding the session is the cookie that identifies the current session for the server. If you need to access the stored value both client- and server-side, you can just use a regular cookie. By omitting the expires field it will only be valid for the current browser session, the same as ProcessWire's sessions. However, if you don't need to access the value server-side (which I assume you don't for a modal), you can use sessionStorage or localStorage instead, which do the same thing as cookies but with a cleaner API. Use localStorage if you want the stored value to persist across sessions (for a dismissable modal this is probably what you want) or sessionStorage to store a value only for the current browser session. const dismissalKey = 'modal-dismissed'; // user clicks on modal button $('.modal_button').click(function(){ // 1. store dismissal in the sessionStorage OR the localStorage localStorage.setItem(dismissalKey, '1'); // 2. toggle class $('.modal').toggleClass('off'); }); // somewhere else, check if the modal has been dismissed const modalIsDismissed = Boolean(localStorage.getItem(dismissalKey));
    1 point
  8. Yes, it should. As long as you tell the JS what criteria to use to filter things. I don't know if you are using vanilla JS or some library but the principle is the same. You will filter out/in items to either remove/hide OR add/display depending on whether you filtered out or in. This is how we do it in Menu Builder, giving us flexibility to create all sorts of menus. If you have more questions specific to your use case (including the JS), please open a new thread so that we stay on topic in this thread. Thanks.
    1 point
  9. What's your use case? Deeply nested arrays can get unwieldy and depending on how big they are, consume a lot of memory. I find it simpler to work with flat(ter) arrays with in-built relationships between the members. I then run that through a recursive function. Something like this: <?php namespace ProcessWire; $menu = array( 1 => array( 'id' => 1023, 'title' => 'Menu item 1', 'parent' => null, // this menu item does not have a parent/top level ), 2 => array( 'id' => 1024, 'title' => 'Menu item 2', 'parent' => null, ), 3 => array( 'id' => 3000, 'title' => 'Child 1 of Menu item 2', 'parent' => 1024, // its parent is item with ID 1024 ), 4 => array( 'id' => 3001, 'title' => 'Child 2 of Menu item 2', 'parent' => 1024, ), 5 => array( 'id' => 3003, 'title' => 'Child 1 of Child Menu item 2', 'parent' => 3001, ), 6 => array( 'id' => 1027, 'title' => 'Menu item 4', 'parent' => null, ), 7 => array( 'id' => 3009, 'title' => 'Child 1 of Menu item 4', 'parent' => 1027, ), 8 => array( 'id' => 4001, 'title' => 'Child 1 of Child 1 of Menu item 4', 'parent' => 3009, ), 9 => array( 'id' => 4002, 'title' => 'Child 2 of Child 1 of Menu item 4', 'parent' => 3009, ), );
    1 point
  10. BayTech360 is a System Integrations Specialist serving the US out of San Francisco. They wanted to revamp their website and asked Pigtail Pundits to help with it. The new website is built to storytelling standards of StoryBrand and other direct response advertising frameworks. This site features, sell-focussed copy which is our trademark. This is mapped to an elegant, clean design. Built atop ProcessWire, our favourite CMS, with ProCache for speed. Check it out at: https://www.baytech360.com/
    1 point
  11. $markup = array( 'item_content' => "<div class='InputfieldContent {class}'>{out}{error}{description}{notes}</div>", );
    1 point
  12. Since you are using Bootstrap, there is also a class "rounded-circle" for that. ? https://getbootstrap.com/docs/4.5/utilities/borders/#border-radius
    1 point
  13. You only changed the image, wouldn't it make more sense to use CSS to create round images? https://www.w3schools.com/howto/howto_css_rounded_images.asp
    1 point
  14. Where are you getting the error, and where are you declaring the variable? If you're trying to access a variable in the template file corresponding to the page template that has been declared in the _main.php, this won't work because the _main.php is executed last. The template files are included in the following order (assuming your config above): _init.php -> [current-template].php -> _main.php So if you want to declare a variable to use in all templates, you need to do that in the _init.php All the template files should have the ProcessWire namespace. Not sure about the undefined function errors, those functions should be available in the ProcessWire namespace. Would need to see the file to diagnose.
    1 point
  15. I found this random picture generator the other day but kept forgetting to post it here. It's basically lorem ipsum but for photos. They have quite a nice feature set too.
    1 point
  16. Hi arjen, You must give your editor role this permission : "Administer users (role must also have template edit access)". + the Editor needs edit permission on your User template. Can the editor see the users now if you move the Page outside of "admin"?
    1 point
×
×
  • Create New...