Jump to content

Peter Knight

Members
  • Posts

    1,374
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by Peter Knight

  1. I have a structure as follows

    Department A
    - meet 
     -- John
     -- Will

    Department B
    - meet
     -- Lisa
     -- Amy

    I want to give Department A and B the same template with a general selector that will list only the people in its child 'meet' folder.

    Normally I'd just specify a parent id but because both Departments need to list their people, I am looking to list by a path.

    <?php 
    $pages->find("template=a-person");
    foreach($page->children(has_parent=/meet/) as $meet) {
    echo "

    IE

    Department A will only list John and Will

    Department B will only list Lisa and Amy

    I'll keep hammering away at it ...

     

     

     

     

  2.  I have a template where a slider widget appears within my clients body tag. It’s never in the same place twice and client wants freedom to add and remove it as they need  

    And I wondered if I am up to date on my options in PW to achieve this..

    A) use the pro fields matrix field type to allow client to add the premade slider. They can then follow this by adding another body/content field. 

    B) make the slider a Hannah code chunk. Client can then add manually or use the Hannah code plugin to insert. 

    Are they my 2 main options ? Sometimes the latest methods mentioned in the recent blog posts don’t really make sense to me until I really need a new way to do things and someone says “hey checkout markup regions” etc. there’s possibilly newer ways to execute this. 

    Cheers

  3. Hi guys

    A few pages on my site are required to output a random quote from a bunch of 5 which are associated with that page.

    IE 

    About has 5 quotes
    Home has 5 quotes
    Company has 5 quotes

    Normally I'd just make a few child pages for each parent and give it it's own template. Using a selector to do that would be easy.

    However, I've decided to go down the route of adding each pages 5 quotes to a repeater field.

    I can output ALL the pages quotes using this...

    <?php
    foreach($page->one_liner_group as $one) {
    echo "{$one->one_liner}<p>"; 
    }?>

    but I'm not so sure where to add (limit=1) and getRandom when using repeaters within a page.

    Thanks

     

  4. Hi guys

    I'm building a homepage with a full screen, responsive video background.

    The client wants the video file to be hosted on their own server and I wondered if instead it should be hosted on YouTube instead.

    I'm thinking that YouTube will have much better bandwidth detection etc and handle the playback more intelligently than simply throwing an MP4 on a server.

    If anyone has any experience with both scenarios, can they confirm or deny?

    Thanks

    P

     

  5. Hi 

    One more question

    I have 2 FTP applications here successfully connecting to a destination server over FTPS SSL/TLS 

     

    When I add the exact same credentials to Duplicator, I get the following

    Quote

    2018-09-06 15:00:43:  - job finished in 110.8802sec
    2018-09-06 15:00:43:  [FTP] error: cannot upload file <2018-09-06_14-58-52-www.domain.co.uk.package.zip> on server.
    2018-09-06 14:59:40:  FTP: starting upload of /home/sites/domain.co.uk/public_html/site/assets/backups/2018-09-06_14-58-52-www.domain.co.uk.package.zip
    2018-09-06 14:59:40:  FTP: directory listing of Backups successfull.
    2018-09-06 14:59:40:  FTP: retrieving directory listing of Backups...
    2018-09-06 14:59:40:  FTP: directory listing of Sharey01 successfull.
    2018-09-06 14:59:40:  FTP: retrieving directory listing of Sharey01...
    2018-09-06 14:59:39:  FTP: logged in.
    2018-09-06 14:59:39:  FTP: connection established.
    2018-09-06 14:59:39:  FTP: connecting to myserver.com:21...
    2018-09-06 14:59:39:  - package built successfully in 46.558444sec

    So it looks like Duplicator is successfully building the package, logging in to the server and listing the directory files. It only fails to actually upload the ZIP

    There are no size restrictions on the server and there are I have disconnected the other FTP apps to ensure that's not the issue either.

    Any ideas why the upload might fail? This only happens on TLS/SSL and not under 'regular' unencrypted FTP

    Thanks

     

    • Like 1
  6. On 2/12/2016 at 9:45 AM, iNoize said:

    1and1 check your htaccess 

    I know this problem there 

    
      # RewriteBase /
      # RewriteBase /pw/
      # RewriteBase /~user/
    
    change to 
    
        RewriteBase /
      # RewriteBase /pw/
      # RewriteBase /~user/
    

    Worked for me too. Thanks for the tip.

    Interestingly if you think it'd the database connection error, please try the above first.

    I couldn't connect to the database remotely (since learnt this is disabled) or via their own php test scripts. Was convinced it was database until the above worked.

     

  7. 10 minutes ago, LostKobrakai said:

    A php setting can never override what htaccess does. PHP is not even started when the htaccess file is read/executed.

    So the config setting ($config->noHTTPS = true; ) is ineffective if there’s a htacess setting of always use https ? 

    That seems a bit odd as any site running Http would probably have this htaccess directive enabled for SEO reasons. 

  8. Thanks, Ryan for the https config setting.

    Few Qs if you've got time

    • Does this need to be manually included in a config? I just updated to  3.0.110 © 2018 and noticed it's not there (possibly is not meant to be).
    • Even after including this, I notice the HTTPS setting in the htaccess file over-rides this. it's be great to have a config that over-rides both the HTTPS and www V non www settings too

     

  9. The current PW homepage has a few screenshots of the admin featuring the old UI.

    @ryan For what it's worth and because I had 5 minutes I remade it in the new UIKit theme. It's just a screengrab - nothing fancy.

    Might not even be the right size but it's been annoying me irrationally for months ?

     

    screenshot-fields2.png

    • Like 5
  10. On 5/7/2016 at 2:19 PM, Ivan Gretsky said:

    @Peter Knight: I believe it is this option:

    
    'current_class' => 'active'

     

    This doesn't seem to work. It only applies 'active' to the active child link.

    On a drop down menu any page/link that is active should have it's root parent marked as active too.

    On my example a user has no obvious indicator of what 'section' they are on just by looking at the top navigation bar.

    active-root.png

  11. On 7/17/2018 at 6:28 PM, adrian said:

    Hi @netcarver - thanks for your thoughts.

    Anyone else have any thoughts on how best to proceed to ensure no-one breaks there site when upgrading to my new version? Maybe I just need to add an upgrade() method that prevents the module from updating old installs?

    I'd simply call it a new version with a different fork . Put a notice on the current version that a new version is available.

    Perhaps a user like me can have V1 installed and then simply install separately install V2, test and then remove V1.

  12. 3 hours ago, gebeer said:

    @Peter Knight What do you want to do with products that do not have images? In your foreach you define the $image variable only when there are images. Then you echo the images even if there are none. This will give you a PHP notice for $image is undefined. You'd need another if condition within your echo to check for isset($image) and only output the image if there is one.

    The way you setup your images field it should definitely return an empty array if there are no images so the 

    
    if (count($prod->images))

    should work as expected.

    Makes sense. Wasn't aware of isset so I'll look forward to using ?

  13. Thanks @gebeer

    That's not having any effect.

    My images field has the following properties

    Max Files allowed
    0

    Formatted value
    Automatic

    Just to recap, I am trying to

    1. check that an images field is populated
    2. if so - create a variable called $image
    3. safely output an image based on the 1 and 2 above being tru
    <?php
    $products = $page->children();
    foreach ($products as $prod){
    
       // Check that images field is poulated	
       if (count($prod->images))
       { 
       // Create variable from first image in field
       $image = $prod->images->first();
       }
    ?>
    <?php
    			echo"
    			<div>
    				<div class='prod-ov-wrapper'>";
    
    				// If the pages are the following (Rollers contain tall/thin images)
    				if ($page->matches('id=1129|1145|1160|1163'))
    					{
    					echo "	
    						<a href='$prod->url'><img src='{$image->url}' class='prod-preview-tall'></a> ";
    					} 
    				else 
    					{
    				// If any other page 
    					echo "	
    						<a href='$prod->url'><img src='{$image->url}' class='prod-preview'></a> ";
    					}
    				echo"
    					<div class='prod-ov-text'>
    							<span class='preview-title'><strong>Part No:</strong> {$prod->title}</span>
    							<br/>
    							{$prod->prod_summary}
    							<a href='$prod->url' class='uk-icon-button  icon-linky' uk-icon='icon: chevron-right'></a>
    						</div>
    					</div>
    				</div>
    		";}
    		?>

     

×
×
  • Create New...