Jump to content

casey

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by casey

  1. I'm attempting to make a photoblog type of site and was wondering if there's a clean way to get the image directory path when using the $image->size method.

    The purpose of this is so the user can upload their large images, display as a thumbnail and click to view a medium version no taller than 800px within a modal.

    As you can see, I've had to hardcode the site/assets/files directory. Is there another method?

    (*the getThumb function refers to another installed module)

    foreach($page->images as $image) {
        echo '<a href="site/assets/files/'.$page->id.'/'.$image->size('','800').'"><img src="'.$image->getThumb('thumbnail').'" alt="'.$image->description.'"/>';
    }
    
  2. Hi, I'm just getting started with ProcessWire and am attempting to make the conversion from ExpressionEngine. My PHP skills are a little rusty, so please bear with me...

    So I'm trying to make a simple "Related Entries" field. I went with a Pages field type and am accessing the values through the PageArray/WireArray method. Before I get too deep into this, I was wondering if someone could look at this and tell me if I'm going about this in the right way in terms of syntax and native functionality.

    $a=$page->related;
    
    $array = explode("|", $a);
    
    if ($a->count()) {
    	echo '<h2>'.$a->getTotal().' Related Entries</h2>';
    	echo '<ul>';
    	foreach ($array as $key => $value) {
    		$link	= $pages->get($value)->httpUrl;
    		$title	= $pages->get($value)->title;
    		$out = '<li><a href="'.$link.'">'.$title.'</a></li>';
    		echo $out;
    	}
    	echo '</ul>';
    }
    
  3. I'm new to PW and wanted to say thanks for such an awesome, elegant tool. I'm really looking forward to working with it. I hope to be able to help out and contribute some day. Really, though. I'm just blown away. Great job on your own site as well.

    • Like 13
×
×
  • Create New...