Jump to content

mike62

Members
  • Posts

    30
  • Joined

  • Last visited

Posts posted by mike62

  1. Thanks @adrian! That helped me track the problem down. Turns out there are two fields on this site for store hours, for some reason, and the one I needed was store_hours_content, not store_hours. :S

    I wish there was a way to see the field name when you're editing the page itself, rather than having to dig through the Templates and Fields areas of the backend.

    Anyway, chalk this one up to user error. :/

  2. It's PW v 2.3. I checked the publish settings, and it was set to "Hidden: Excluded from lists and searches". I tried unchecking that box but I still get a zero. The id for the page is right in the URL when you're editing the page, right?

    This is the URL when I edit that page:

    /admin/page/edit/?id=1006&s=1 

    Yeah, it's really weird, because like I said, I'm already using the exact same technique to echo a field from the homepage, but it's not working for this other page. :S

  3. I'm trying to echo a field from another page, in my footer. I have a Website Settings page (id 1006) with several fields for general site settings, like store hours (field is named store_hours). In the footer, I have this:

    <?php $settingsPage = $pages->get(1006); 
    	echo $settingsPage->store_hours;
    ?>

    Shouldn't that output the contents of that field? Right now it's printing a "0" (zero) on the page.

    Elsewhere in the same footer template file, I have this code and it works fine:

    <?php $homepage = $pages->get(1); 
    	echo $homepage->body;
    ?>

    Does it have anything to do with the fact that the field is organized into one of these tabs, at the top of the page editor?

    (disclaimer: I'm new to PW, and have inherited this site from another developer; that's why I don't know how or why some of this stuff is set up the way it is).

    Thanks!

    Screen Shot 2017-11-27 at 12.51.31 PM.png

  4. Thanks everyone for all the tips! Some notes:

    The screenshot I took shows the image *in PW* on the left (I clicked on the thumbnail in the backend and it opened the lightbox; that's what you're seeing there). So yes, that is a direct comparison of the uploaded image, to the resized image.

    Looks like ImageMagick requires PW 3.0.10... :'( The site I've adopted is a mess of old modules, and I can't update it past 2.3.0.

    But... good news! I tried downloading the original image, opening it in Photoshop, using their legacy "Save for Web" export dialog, making sure it's set to sRGB, re-uploaded it, and bam! Thanks @Robin S

    Screen Shot 2017-11-23 at 6.56.10 AM.png

    • Like 2
  5. Please see attached screenshot. The image on the left is the original image that was uploaded. The image on the right is what it looks like after it was resized to fit into a template by ProcessWire using

    <img src="<?php echo $featured_image->size(854,0)->url ?>" />

    This is a significant loss of color for these images. Is there a way to prevent this from happening — other than forcing client to crop the images to the exact dimensions ahead of time, and not resizing with PW?

    Screen Shot 2017-11-22 at 2.21.50 PM.png

  6. Thanks @AndZyk and @dragan. I've updated jQuery to 1.11.1, and the code to be:

    <link rel="stylesheet" type="text/css" href="/site/templates/scripts/slick/slick.css"/>
    <script type="text/javascript" src="/site/templates/scripts/slick/slick.js"></script>
    
    <?php // if (count($page->home_header_image) > 0): ?>
    	<div class="home-featured-image slick-carousel">
    	<?php foreach($page->home_header_image as $image): ?>
    		<div class="slide"><img src="<?php echo $image->size(1280,420)->url; ?>"></div>
    	<?php endforeach ?>
    	</div>
    <?php // endif ?>
    
    <script>
    jQuery(document).ready(function() {
    	jQuery('.slick-carousel').slick();
    })
    </script>

    Now it's telling me that slick is not a function! 

    TypeError: jQuery('.slick-carousel').slick is not a function. (In 'jQuery('.slick-carousel').slick()', 'jQuery('.slick-carousel').slick' is undefined)

    Seems weird to me, because the slick.js file is definitely being loaded... :S

  7. I've implemented Slick sliders on WordPress sites many times, but I've never had this error before.

    The site is here.

    The template code I'm using is:

    <link rel="stylesheet" type="text/css" href="/site/templates/scripts/slick/slick.css"/>
    <script type="text/javascript" src="/site/templates/scripts/slick/slick.js"></script>
    
    	<?php // if (count($page->home_header_image) > 0): ?>
    		<div class="home-featured-image slick-carousel">
    		<?php foreach($page->home_header_image as $image): ?>
    			<div class="slide"><img src="<?php echo $image->size(1280,420)->url; ?>"></div>
    		<?php endforeach ?>
    		</div>
    	<?php // endif ?>
    
    <script>
    (function($) {
    	$('.slick-carousel').slick();
    })( jQuery );
    </script>	

    The JS error I'm getting is:

    TypeError: $.proxy is not a function. (In '$.proxy(_.autoPlay, _)', '$.proxy' is undefined)

    As you can see, I tried wrapping the JS call in noconflict, but that doesn't help. 

    What am I missing?

     

  8. The problem I'm having is not to do with the browser's cache. I am updating home.php, uploading it, emptying the cache, and I'm still not seeing the changes I just made. It's very frustrating.

    EDIT: It seems like the solution is to use this setting (see screenshot) for the template itself. Then to be able to see the changes I make:

    1. Upload home.php via FTP.
    2. In the ProcessWire admin, open the Home page and save it.
    3. Switch to Chrome and empty its cache.
    4. Switch to the tab with the site's homepage and refresh.

    Is this correct? Is this the most efficient way to develop a site with PW? Seems arduous at best.

    Screen Shot 2017-11-02 at 8.05.54 AM.png

  9. So, this isn't as "solved" as I thought it was. I'm still having caching issues, even though I've removed the Pro Cache module completely. On one browser, it's loading the most recent template files, but only when logged in, and it's still not loading the most recent CSS file. On another browser it'll load the most recent CSS file, but not the template files. It's making me crazy! Am I missing something obvious? This is making development extremely difficult. :(

  10. I'm working on a page and it's showing up differently when I'm logged in. It's not that a field is set to private or anything, because it's still pulling data from that field. It looks like the "public" view is simply using an old version of the template (home.php), and the logged-in view is using the current version of home.php. See attached screenshots.

    Is there something that caches template files? Is there a way to force it to use the most recent version of the template?

    EDIT: I found the Pro Cache module and cleared it. That seemed to help. 

    Thanks,

    -Mike

    logged-in.png

    not-logged-in.png

  11. @kongondo The site was handed to me like this, and there's too much to rework to start from scratch, so I'm just doing a re-skin. 

    @horst I don't need to update the site. Just mildly concerned about using outdated (and possibly not secure?) software.

    The below code now works great, thanks for the tip!

    <?php 
    	$image = $page->home_header_image->first()->size(1280,420);
    	echo "<img src='{$image->url}' alt='{$image->description}' />";
    ?>

    I had no idea that the "Image" field was for more than one image. I don't see a way to make a "single image" image field... am I missing something? I don't really need it at this point, since the code change works. Just curious. Thanks again!

  12. I am new to PW, and am trying to get an image to display, from a field in my template. Here's the code I'm using:

    <?php 
    	$image = $page->home_header_image;
    	echo "<img src='{$image->url}' alt='{$image->description}' />";
    ?>

    I'm following the tutorial on this here.

    When I save the template and reload the page, the path to the image is incomplete. If just echoes:

    <img src="/site/assets/files/1/" alt="">

    It omits the name of the image, at the end of the path.

    Here's the site I'm working on:

    http://dev.delucaswpg.webfactional.com

    A couple caveats:

    1. I'm using ProcessWire 2.3.0 (tried updating the site and everything went berserk because of some plugin dependencies; point being: I can't update to the latest PW).
    2. I tried using the ->size thing and it gave me an error, saying it couldn't use 'size' in this context. Which I also thought was weird.

    Any ideas? Thanks!

×
×
  • Create New...