-
Posts
1,465 -
Joined
-
Last visited
-
Days Won
10
Everything posted by Peter Knight
-
Hi guys I have a PW API call which normally outputs all pages as follows <?php if ($page->Related_Downloads->count()) { echo " <ul class='uk-tab' data-uk-tab> <li class='uk-active'><a href='#'><strong>Download</strong></a></li> </ul>"; echo " <div class=' side-promo '>"; foreach($page->Related_Downloads as $download) { $thumb = $download->images->first(); echo " <div class='download-wrapper'> <div class='download-thumb'> <a href='{$download->file->first()->url}' target='_blank' ><img src='{$thumb->url}' class='download-img'></a> </div> <div class='download-info'> <strong>{$download->title}</strong> <br/> {$download->summary} <br/> <a href='{$download->file->first()->url}' class='uk-button uk-button-primary'>Download</a> </div> <br clear='all'> </div> " ;} echo "</div>"; } ?> if I just want to get the very first page that matches my foreach, why does following throw an error? foreach($page->first()->Related_Downloads as $download) {
-
Just a suggestion but it'd be really useful if there was a Description field available when creating a HannaCode. I like to keep my HC names short and choppy and a description would greatly help users later on establishing what the HC is for or does a Description column on the HannaCode overview page too pulling in above Description It would also be great to be able to see a list of pages where HCs are used within RTEs or templates but that (for me) isn't such a biggie.
-
Off the top of my head ... 1. Is pagination enabled on that template? 2.
-
Thanks Ryan Will try that laters. Just backing up everything for the moment and relieved to have it back. Appreciate the advice though.
-
Thanks @kongondo I tried that in tandem with switching to 5.6.30 and something worked. Site back online now. On a side note, I'm not sure why the site crapped out and threw an upgrade warning when I wasn't upgrading. Ah well.
-
Just tried installing a Module (AutoSmush) on one of my sites and am now getting following error It was a 3.0.21 site running on PHP 7.0.18 Any tips? I can't find any references to this error online. Cheers
-
That's it @Robin S. Thanks. I previously had a width and height specified and when I removed the height I had forgotten to change 'size' to 'width'.
-
Hi guys. Another image question :-/ I'm using the lazy sizes script which allows for loading of a low-res image before the lazy loaded image kicks in. It's just a case of specifying the img src as the low quality image. The code below works but generates an image 1 pixel high. I can't see where / how the 1px height is being generated as I'm not specifying any 1px high parameter // Make a very low res version $options = array( 'quality' => 5, ); echo " <img src='{$port_item->images->first()->size(414,$options)->url}' class='lazyload portfolio-thumb uk-overlay-scale' data-srcset=' {$port_item->images->first()->width(750)->url} 750w, {$port_item->images->first()->width(414)->url} 414w, {$port_item->images->first()->width(320)->url} 320w' data-sizes='407px' alt=\"{$port_item->images->first()->description}\" > Resulting HTML <img src="/site/assets/files/1211/myphoto.414x1.jpg" If I remove the $options array, I get a proportional image <img src="/site/assets/files/1211/myphoto.414x0.jpg" Even though the above seems as if the height should be 0, the image is correctly scaled Cheers
-
Might be the best option. Thanks @Zeka
-
Hi guys Is there a way with the image API to convert an image to B&W? I don't see it mentioned in the docs. This is my echo at the moment // Generate a very low res version $options = array( 'quality' => 1, 'upscaling' => false ); I'm basically trying some lazy loading with Lazy Sizes and this allows you to create a default low-res image until the proper image is loaded. http://afarkas.github.io/lazysizes/#examples I know I can fall back to CSS but thought I'd check when you do.
-
That's it - thanks @tpr I had another small error which is fixed now too. I needed to surround the $item->title in double quotes. Cheers
-
Hi guys I have a simple echo statement as follows echo " <h3 class='uk-accordion-title'> $item->title </h3> " I want to add a script provided by ZOHO which tracks clicks on certain web page objects. <a onclick='$zoho.salesiq.visitor.customaction("Track-signup-button")'> SignUp </a> This would be the resulting code when I add that echo " <a href='#' onclick='$zoho.salesiq.visitor.customaction('$item->title')'> . </a> <h3 class='uk-accordion-title'> $item->title </h3> " When the HML is output, it almost works BUT the variable $zoho gets removed every time. <a href='#' onclick='.salesiq.visitor.customaction('Our Location')'> . </a> <h3 class='uk-accordion-title'> Our Location </h3> Is this a bug with my method or some escaping issue? Thanks
-
<?php if ($page->path == "/blog/posts/"){ echo "<script type='text/javascript' src='//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-55e5693b9add30c6'></script>"; } ?> I'm trying to output a script on my blog posts only. They're all children of /blog/posts/ so I thought the above might work. That seems to work only when the page loaded is exactly /blog/posts/ How can I tweak this to work on any page containing /blog/posts/ in it's URL / path and not just /blog/posts/ ? I've been to the API and tried a few variations using the following if ($page->path *= "/blog/posts/") but I think they're more selectors for fields?
-
Sorry - I've managed to confuse you. I wondered if 'local' meant the optimizers *should* be installed on a server or a local machine. I'm pretty sure they're server based but I normally understand 'local' to mean the desktop / laptop on front of me. Anyway, I'm sure optimizers are installed on the host server. No need to revert and thanks again for the help.
-
Thanks for the info. Forgive my ignorance but when you say 'local optimizers' are these installed on my VPS or on a local machine?
-
Not a problem. Thanks for getting back to me. I don't see anything obvious but not entirely sure what to look for. progress.json only has 1 line: {"percentComplete":"1","counter":"Optimizing image 32 out of 2039 - 1% complete","percentNew":"0","error":null,"file":"phoot-security.0x100.jpg","basedir":"1079","url":"https:\/\/www.domain.co.uk\/site\/assets\/files\/1079\/phoot-security.0x100.jpg"} Error log displays a list of files and their reduction and then there's one in error in particular 2017-03-22 12:15:00 Error optimizing /var/www/vhosts/domain.co.uk/httpdocs/site/assets/files/1072/085---dc3420.0x100.jpg, 404 BTW I'm using the online service for all of these. Perhaps I should try install a local optimization tool too?
-
That worked. Thanks matjazp I have a site with about 1951 images to be uploaded and downloaded to reShmush.it server I realise this can be CPU intensive but am running some tests. I always have an error at around 2% of upload Each image is well below 5MB. I wondered if there was a limit to the amount of actual images which can be processed at any one time?
-
Nice - thanks
-
Hi Adrian Thanks for the tip. I normally do install via class name but CI 3 at the time had a more recent version which was only available from GitHub as a ZIP. At least I think that was the case. Thanks anyway for the help.
-
I think I've found the issue. My uploaded CI folder still have the "-master" name. Seems to be working now.
-
I have a recurring prob on PW 3.0.42 and CI 3 v.1.0.0 on PHP 7.0.16 Anytime I try to edit a page which uses an image crop, I get the following error I've refreshed the Modules several times (that worked before) but the problem persisted. I thought perhaps ProCache wasn't helping so I disabled that too temporarily. Anyone have similar issues ?
-
It's wierd alright. This works on it's own <?php if($page->home_hero_image->count > 1 ) { $bgimage = $page->home_hero_image; echo '<script>$("#bg-home").backstretch(["'; echo $bgimage->implode('", "', "url"); // results in url", "url", "url echo '"], {duration: 5000, fade: 1000});</script>'; } ?> Might even be an issue with the whole if, then logic.
-
Hi guys related to above. I have working code which I need to adapt so that $.backstretch becomes $("#bg-home").backstretch Full example below. Everytime I try to surround the #bg-home with double quotes or even escape it, I get a syntax error. <?php // if home_hero_image field contains more than 1 echo images in a slideshow // Mainly for Homepage if($page->home_hero_image->count > 1 ) { $bgimage = $page->home_hero_image; echo '<script>$(#bg-home).backstretch(["'; echo $bgimage->implode('", "', "url"); // results in url", "url", "url echo '"], {duration: 5000, fade: 1000});</script>'; } else // otherwise echo a single image on its own // Mainly for all other pages if($page->home_hero_image->count == 1 ) { $bgimage = $page->home_hero_image; foreach ($bgimage as $image) { echo" <script> $(#bg-home).backstretch('$image->url'); </script> "; } } ?> <!--END Backstretch--> Why would $(\"#bg-home\").backstretch not work on this occasion?
-
Thanks @Soma That was it.
-
I just had same issue after an upgrade to 3.0.51 and it couldn't be fixed by flushing the Modules.