Jump to content

Peter Knight

Members
  • Posts

    1,358
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by Peter Knight

  1. Hi guys

    I have something working and I'm not sure it's the most efficient API usage. 

    I want to display some content if the page is Vets or any sub page below Vets.

    My tree structure looks like this:

    Home
    Doctors
    Vets (ID 1116)
     - Vets sub page 01
     - Vets sub page 02
     - Vets sub page 03
     - - Vets sub sub page 01
     - - Vets sub sub page 02
     - Vets sub page 04
    Pilots
    Gardeners

    My working code is:

    <?php
    
    if  
    	(
    	$page->matches('id=1116') // Page is Vets Overview
    	||   // OR
    	$page->parent->matches('id=1116')  // Parent Page is Vets Overview
    	)
    
    	{
    	echo "My conditional content";
    	}
    
    ?>

    Thanks
    P

  2. Hi again @tpr

    I notice on the code below I am getting both a data-srcset and a srcset too. Is this correct?

    My input

    <?php $myimage = $page->Images->first(); ?>
    <img 
         class="lazyload"
         data-src="<?php echo $myimage->url ?>"
         data-srcset="<?php echo $myimage->srcset('800x0, /2, /3') ?>"
         alt="" 
     />

    My output in browser

     <img class=" lazyloaded" 
     data-src="/site/assets/files/1/photo-steps-video.jpg" 
     data-srcset="
                  /site/assets/files/1/photo-steps-video.800x0.jpg 800w,
                  /site/assets/files/1/photo-steps-video.400x0.jpg 400w,
                  /site/assets/files/1/photo-steps-video.266x0.jpg 266w" 
    alt="" 
    srcset="/site/assets/files/1/photo-steps-video.800x0.jpg 800w,
             /site/assets/files/1/photo-steps-video.400x0.jpg 400w,
             /site/assets/files/1/photo-steps-video.266x0.jpg 266w" 
    src="/site/assets/files/1/photo-steps-video.jpg"
     >  

     

  3. 3 minutes ago, cb2004 said:

    I wouldn't explore multi-site anymore. You could spit out a feed from site A and read it on site B. You could even import them into site B. I am on mobile right now, but we do this quite regularly so could post an example when I am in the office. RSS, XML, lots of options. 

    Thanks. That all sounds good. 

  4. Hi guys

    Is it possible to have a PW site display content from another PW site?

    I've been reading about ProcessWire's Multi-site options and I don't think either is a way forward for me.

    Both PW sites are separate installs with separate databases but crucially they are on the same VPS. So I'm hoping that's a good thing.

    Basically, Site A has approx 100 reviews consisting of these fields

    • Reviewer name
    • Review
    • Date

    Instead of setting up the fields onto Site B and duplicating work and creating 100 pages, I want to *somehow* get site B to use a selector to fetch the necessary content from Site A.

    In future, if I need to update the reviews, I can goto the 'source' Site A to do this.

     

  5. On 3/1/2019 at 7:47 PM, wbmnfktr said:

    Everything worked as expected as far as I can tell by now and I should be able to replace my previous set of fields with this module 

    Are you replacing these manually or with some script?

  6. Thanks guys.

    I have it working now and see the relevant php docs

    Quote
    $a++ Post-increment Returns $a, then increments $a by one.

    That's cool. So we put $count++; at the end of the echo because when it loops back around, it uses this new value as the starting number. Good to know.

     

     

     

     

    • Like 1
  7. I am trying to assign an incremental number to each image starting from 0 

    <li uk-slideshow-item="0"><img src="images/photo.jpg"></li>
    <li uk-slideshow-item="1"><img src="images/dark.jpg"></li>
    <li uk-slideshow-item="2"><img src="images/light.jpg"></li>

    The API docs mention I can use the following

    Quote
    
    $a->eq($n)

    But when I apply it below, I get the following error

     Method Pageimage::eq does not exist or is not callable in this context 

    Here's my usage

    foreach($item->images as $photo){
    echo "
    <li uk-slideshow-item='{$photo->eq($n)}'><a href='#'><img src='{$photo->size(150,100)->url}'  alt=''></a></li>
    ";}

    Thanks again

    P

  8. I have 2 repeater types working with the Repeater Matrix.

    To keep things simple, I have

    1. image gallery
    2. a downloads gallery.

    I can't quite figure out how to echo the contents from within a product_gallery. 

    I can get the code below to display the text 'An image gallery' but not the bunch of images within this.

    I'm not sure though if it's my variable trail or my nested echo statement.

     

    <?php
    foreach($page->components as $item) {
      if($item->type == 'product_gallery') {
        echo " An image gallery...";
    
            foreach($product_gallery->images as $photo) {
            echo "
    	An image
    	<image src='{$photo->url}'>
            ";
                }
        }
           
    
    
        else if($item->type == 'downloads') {
            echo "
             A download gallery...
              ";
         
        }
    }
    ?>

    Thanks

    P

  9. 15 minutes ago, Autofahrn said:

    For me removing the uk-width-expand from the inner div (the one with class=' uk-width-1-1@s uk-width-1-2@m uk-width-4-6@l uk-width-expand pk-col-bod') seems to fix it (not verified other aspects of the layout). But I won't consider a width of 1700 pixels to be a quite big resolution nowadays.

    amoss-ie.thumb.jpg.c381745f4f248c50f3b65ce406744dd7.jpg

    Agreed. I just need to add some custom widths to the pk-col-bod to make it mimic the previous layout etc.

    • Like 1
  10. 1 hour ago, Tom. said:

    Hi @Peter Knight

    Change uk-width-expand to uk-width-1-1

    IE11 has some strange bugs with flex - I believe the issue is with flex: 1 and max-width, it's respecting both but it's treating it like space-between. For whatever reason, I don't know. As you have a max-width defined in this instance uk-width-1-1 will work fine. 

    Thanks Tom. That largely works ok. I've yet to test it fully.

    The tricky part here is that the layouts across the site are using bespoke widths and stepping outside the normal UIKit columns widths etc.

    But that's a huge help and seems promising enough to start testing from. 

     

    • Like 1
  11.  

    Hi guys

    I know some of you are UIKit fans like me. I built a site recently using UIKit 3 and I'm having some layout issues on IE 11 and largest breakpoints.

    You have to set quite a big resolution or have a large monitor to experience this as it only happens on largest breakpoints.

    The main column in the above URL is successfully centered in most browsers except IE11.

    On IE 11, it shifts to the right. Basically it's a DIV using the uk-width-expand selector and then I have a custom max width and a margin in there to centre the content horizontally.

    Here's a simple CodeKit and JSFiddle of the issue

    https://codepen.io/edenstudios/pen/qvWpGo

    https://jsfiddle.net/EdenSt/auekfgqt/8/

    Thanks
    P

     

     

  12. This is probably more a server issue with Plesk etc but relates to Processwire.

    I have a very long web form which takes the average user 3-5 minutes to complete. I know it's crazy but it's a client-driven thing.

    Occasionally, my client has been emailed by users that when they eventually his Submit, they get a general 500 server error.

    I did some research and looked at some logs and it seems to be some type of time-out issue. I guess that makes sense if the form takes minutes to complete as the first two fields of the web form are attachment uploads. I'm thinking that attaching files establishes some type of session but that session expires by the time the web form is actually submitted.

    Does that sound plausible enough?

    I plan to suggest moving the attachment fields to the end of the email, disabling the webform CSFR too and seeing if things improve.

    Does my theory about file uploads and session time outs sound plausible?

     

  13. Idea: A way to push/pull or simply copy an image from Images field 01 to Images field 02 (or vice versa).

    I primarily need this for two image fields on the same page but I imagine some would find it useful for 2 images fields on different pages.

    Use Case

    Client has a general images field on every page of their site with all the images they need.

    We now need to create a second images field dedicated to a particular type of image.

    This image is based on an image already in the first images field. 

    Being able to push/pull/copy would save them a heap or re-uploading etc

     

    I understand the flexibility of image tagging, croppingm using first() etc etc but we genuinley need a second images field and for it to be quicker (than re-uploading) to duplicate an image into this second field.

     

     

     

     

  14. I'm getting this too

    Quote

    Exception: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '41-0' for key 'PRIMARY' (in /var/www/vhosts/domain.com/httpdocs/wire/core/FieldtypeMulti.php line 295) 

     

    I have notifications turned on too. I wonder has @ryan any advice here if it is notifications. It's hard to replicate.

  15. I was having some issues logging into a site with PageProtector turned on using Chrome on Android. My users would hit login and either nothing would happen. occasionally, a 500 error would be displayed.

    In the end, I transpired that a setting called 'Data Saver' was enabled. Once you disable this, my logins worked.

    Alternatively, you can run your site over HTTPS to bypass this. I've yet to try it but if you're logging into sites etc then HTTPs should be the default anyway 🙂

     

×
×
  • Create New...