Jump to content

Peter Knight

  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Peter Knight

  1. Hi I'm unsure why my code below doesn't limit the results to 3 as specified. I have a Repeater Matrix (pro fields) on my page with 10 items and I want to echo out slides 2,3,4 only IE Start from the second slide and limit to the next 3 $items = $page->matrix_slider('start=1,limit=3'); foreach($items as $slide) { echo " <div class='uk-width-1-1 uk-width-1-3@s'> <div class='desk-wrap uk-text-left'> <a href='{$slide->url}'><img src='{$slide->images->first()->size(640,320)->url}'></a> <div class='desk-wrap-content'> <h4><a href='{$slide->url}'>{$slide->title}</a></h4> {$slide->body_mini}<br/> <a href='{$slide->url}' class='uk-button uk-button-primary'>Read more</a> </div> </div> </div> Thanks
  2. Hi @Michkael I haven't read back through the previous posts so apologies if this is addressed above by someone else. Responsive Images I primarily use UIKit (v3) for my sites and one thing I really like is that images are responsive by default and don't require any extra markup. This is particularly useful for clients because they don't have to apply any CSS to their images. I like to keep things super-simple for my clients to save them having to remember CSS class names and it also keeps my support times down. Blog Overview Structure My blog 'Overview' page is very simple and here's a simple wireframe. To have the blog overview page populate with content, I am only asking my clients for a few simple items Create a page with template=blog-post Add a preview image (the thumbnail above) to an images field Complete a field called blog-summary The key thing here is really how you handle the preview image and there's a couple of ways to do this as outlined in the help docs FIRST IMAGE You can can tell your client that the first image in an image file will always be the preview thumbnail. This has worked well for me. // grab and output first image $image = $page->images->first(); if($image) echo "<img src='$image->url'>"; or IMAGE WITH TAG You can tell your client to 'tag' an image within an image field to make it the preview thumbnail. That works well too. // retrieve first image with tag 'mytag' $image = $page->images->getTag('mytag'); or SPECIAL IMAGE FIELD You could always create a specific images field just for the thumbnail and limit it to 1. That way your client has zero configuration. I know some of the guys like to keep their fields to a minimum and usually I too try to avoid this. I make a call based on the actual client and their level of experience with CMS etc. Blog Post Structure On the actual blog post, I almost always have the preview image as the first image in the post. Crucially, this is added automatically by my PHP / templating. IE client only adds an image once for it to be both thumbnail intro image For the other images within the body of a post (number 2 and 3 below), it's up to the client to add these to the images field and then apply via the text editor etc. So I never run into the issue you mentioned re CSS and images. I know there are ways to add CSS to the CK Editor and ask the client to apply them but I try to steer clear of that. To me, a CMS is a content tool. Not a design tool. Telling clients they have formatting options within the CKEditor field beyond H1, H2 etc opens up the possibility for them to get 'creative' and can quickly make the site content look messy. If I really, really had to apply CSS to the images within the body field, I would probably look at something called field templates which was announced a while back. I can't recall but i *think* this allows you to specify a mini field template. Within that you could probably target your images with something like .my-body-template img { // css rules } Might be worth a look.
  3. @ryan Can you clarify how those images options are accessed? I've installed the Module, have the latest ListerPro etc but am not sure where this appears within the UI.
  4. I'm looking at the Sanitizer API and don't see a way to echo a field as all lower case. Is that an issue? It seems we can convert to lower case but only if it's separated by an underscore or a hyphen Thanks
  5. Is this image a general image that appears within the main blog content. Or is it the thumbnail image which is used on some overview pages to represent the main thumbnail image of an article/post ?
  6. Which mobile framework are you using to build this? Are you using UIKit or Boostrap etc?
  7. Hi Michael Wether it’s a blog, or a news page or a product overview page, the fundamentals are the same. 1. This makes most sense and is a well organized structure. I like to create a page called blog. This is the blog homepage or overview listing a small preview of each blog post. In a sub folder under blog I actually store my blog posts in a sub folder called called posts. This is because within my blog folder I also have pages for tags and categories and archives I want to keep them all orderly. You’re probably not at a point where you want tags and categories but it means in future you have the foundations in place. But even if you started out differently and realized you need to re organize everything further down the road, it’s a trivial thing to make your blog work with a different structure and some small changes to your selector in your template 2 you can display a smaller image with css or look at the image api and specify a width or height etc 3 on your blog article template, create a field for each and then pull this info onto any page you wish wether it’s the blog home or the homepage etc 4 you would have 1 blog post template and every page would be based on this template Sorry this is so general with no actual examples but I’m typing on the phone.
  8. Solution available in today’s blog post. https://processwire.com/blog/posts/processwire-3.0.121-core-updates-and-more/
  9. 'Not progressive' apparently. They're large page background images so it's easy to see the difference. The one I did manually is visually smoother.
  10. Anyone tried to enable interlacing on their JPGs via the site/config.php? I've tried it on 2 sites now and never seemed to kick in. Cache cleared etc. I'm expecting to see a low-quality blurry JPG first and each pass improves this. $config->imageSizerOptions = array( 'upscaling' => true, // upscale if necessary to reach target size? 'cropping' => true, // crop if necessary to reach target size? 'autoRotation' => true, // automatically correct orientation? 'interlace' => true, // use interlaced JPEGs by default? (recommended) 'sharpening' => 'soft', // sharpening: none | soft | medium | strong 'quality' => 95, // quality: 1-100 where higher is better but bigger 'hidpiQuality' => 60, // Same as above quality setting, but specific to hidpi images 'defaultGamma' => 0.5, // defaultGamma: 0.5 to 4.0 or -1 to disable gamma correction (default=2.0) );
  11. Confirming this worked for me too. 🙂
  12. @Vikestart Did you paste this from your config in /wire/ to your config file in /site/ ?
  13. Someone suggested that an easy way to output a random image from a field was to use getRandom and then simply use limit=1 I'm not sure where I apply it to the following <?php $randomitem = $pages->get(1034)->images->getRandom(); foreach($randomitem as $item) { echo " <img src='{$item->url}' class='squares'> ";} ?> Does it go at the start where I define my variable or somewhere in the echo statment? Thanks
  14. Good to know - thanks. Do you mean choose option 2 below? FastCGI application served by Apache FPM application served by Apache FPM application served by nginx
  15. That's not a bad idea assuming I remove it before we go live with the site. I'll just check with @adrian that this is compatible with his page protector ?
  16. They are often logged into the site under PageProtector to view the front end AND logged in via /processwire/ too. Isn't there a way that a user can be kicked back into the pageprotector login screen if their session has expired?
  17. Thanks. I've added the sessionExpireSeconds to my config. There was nothing in place regarding this previously. I also enabled the Module Session Handler Database and had a PHP warning within processwire as follows I'm going to add that ini_set and hope it helps.
  18. I appreciate it could be a lot of things. 1. I'm using 5.5.60 2. Not sure 3. Not yet but we will be when the site goes live I think what's happening here is as follows. 1. Client logs in via page protector to their site 2. While browsing the site they leave a tab open and go into meetings etc 3. They come back 15 mins later and their session has expired 4. They try to browse the site but as their session has expired, they get a spinning / loading thing Does that sound like a plausible explanation? And if so, is there a way to extend someone's Processwire session cookie for an hour or so? P
  19. I have a demo site which I moved to a new VPS for client testing We noticed that leaving a page open and then revisiting the site can result in a 25 second(ish) to load time and will then throw a 500 Error. The hosting guys had a look and confirmed that the server is fine but the issue could be related to authentication or sessions. We are running Page Protector and ProCache so I wondered if there were any known bugs here and any recommended actions. My actual PW log doesn't show anything but the server log has plenty of these 2018-12-06 08:14:00 Error xxx.141.1x.101 500 POST /who-we-are/ HTTP/1.0 1.58 K Apache access 2018-12-06 08:14:45 Warning xxx.141.1x.131 mod_fcgid: read data timeout in 45 seconds, referer: http://demo.abc.not/who-we-are/ Apache error 2018-12-06 08:14:45 Error xxx.141.1x.131 End of script output before headers: index.php, referer: http://demo.abc.not/who-we-are/ Apache error 2018-12-06 09:03:18 Error xxx.141.1x.131 2614#0: *667 recv() failed (104: Connection reset by peer) while reading response header from upstream nginx error Thanks P
  20. I’ve often wondered how to do this. Especially when building with responsive grid systems. Thanks!
  21. Thanks @horst that worked. When I set sharpening to none, it was reflected on the final save window. I'm still getting a slight pixelation on the source jpg but it's probably non Module related. It's hardly noticeable but would be keen to hear if you think it could be.
  22. Hi Tom Thanks for this. I had unexpected results with this and I think I know why. My array consists of 4 items (Categories) so $Cats->prepend( $Cats->eq(4) ); works until I hide the current Category. Essentially this means the array only consists of 3 Categories and the page throws an error. That's only my guess. If I do $Cats->eq(3) etc or a lower number it works. Worked for me. Thanks @Robin S
  23. Thanks guys. I actually realized I’d asked this before. Sorry about the duplicate post.
  • Create New...