Jump to content

ngrmm

Members
  • Posts

    421
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by ngrmm

  1. @teppo thanks

    here the final code:

     

    	<div class="pagination">
    	<?php
    	$prevPage = $page->prev;
    	$nextPage = $page->next; 
    	if($page != $pages->get(1019)->children->first()) {
    		echo "<a class='link next' href='" . $prevPage->url . "' >";		
     			foreach($prevPage->image as $image) {
    				$thumb = $image->height(60);			
    	    		        echo "<div><img src='" . $thumb->url . "'/></div>"; 
        			        }
    			echo "<span>". $prevPage->title ."</span>";
    			echo "<span class='date' >". $prevPage->teaser_date ."</span>";
       		echo "</a>";
       		}
    	if($page != $pages->get(1019)->children->last()) {		
    		echo "<a class='link prev' href='" . $prevPage->url . "' >";
    	 		foreach($nextPage->image as $image) {
    				$thumb = $image->height(60);	 		
    		    	        echo "<div><img src='" . $thumb->url . "'/></div>"; 
       		 		}		
    			echo "<span>". $nextPage->title ."</span>";
    			echo "<span class='date' >". $nextPage->teaser_date ."</span>";
    		echo "</a>";
       		}
       		?>
    	</div>
    
  2. thanks Marttijn

    i edited the code but still getting Internal Error

    there are always at least 3 children of that page (1019). and all of them aren't hidden.

     

    	<div class="pagination">
    	<?php
    	$prevPage = $page->prev;
    	$nextPage = $page->next; 
    
    	if($page != $pages->get(1019)->children->first()) {
     				
    		echo "<a class='link prev' href='" . $prevPage->url . "' >"
    		
     			foreach($prevPage->image as $image) {
    				$thumb = $image->height(60);			
    	    		        echo "<div><img src='" . $thumb->url . "'/></div>"; 
        		                }
    		
    			echo "<span>".  $prevPage->title ."</span>";
    			echo "<span class='date' >".  $prevPage->teaser_date ."</span>";
       		
       		echo "</a>"
       		
       		}
    
    	if($page != $pages->get(1019)->children->last()) {		
    		echo "<a class='link next' href='" . $nextPage->url . "' >"
    		
    	 		foreach($nextPage->image as $image) {
    				$thumb = $image->height(60);	 		
    		    	        echo "<div><img src='" . $thumb->url . "'/></div>"; 
       		 	        }
    		
    			echo "<span>". $nextPage->title ."</span>";
    			echo "<span class='date' >". $nextPage->teaser_date ."</span>";
    		
    		echo "</a>"
       		}
       		?>
       		
    	</div>
    
    
  3. there is a pagination (next|prex) at the end of the page
    i want to hide next on the last page of the siblings and hide prev on the first

    <?php
    if($page != $pages->get(1019)->children->first()) {
      echo "<a class='link prev' href="$page->prev->url">";
    
        foreach($page->prev->image as $image) {
            $thumb = $image->height(60);
            echo "<div><img src='$thumb->url'/></div>"; 
            }
        $test = $page->prev;
        echo "<span> $test->title </span>";
        echo "<span class='date' > $test->teaser_date </span>";
        }
        
      echo '</a>'
    
    if($page != $pages->get(1019)->children->last()) {
      echo "<a class='link next' href="$page->next->url">";
        
        foreach($page->next->image as $image) {
            $thumb = $image->height(60);
            echo "<div><img src='$thumb->url'/></div>"; 
            }
        $test = $page->next;
        echo "<span> $test->title </span>";
        echo "<span class='date' > $test->teaser_date </span>";
        }
        
      echo "</a>";
      
    ?>
    

    line 3: echo "<a class='link prev' href="$page->prev->url">"; is causing the error but i don't know why

  4. i have a repeater with 2 fields

    – image

    – text

    if there are images uploaded then the output should be only the image field.

    if no images uploaded, then only the text-field should be shown

    right now, if the image-field is empty and the text-field is filled. i'm getting two boxes. and the first one is empty.

    <?php foreach($page->repeater as $box) { 
    
        if($box->images) { ?>
            <div class="box images">
                <?php foreach($box->images as $image) {
                echo "<img src='$image->url'/>";
                } ?>
                </div>
                <?php }
        else {
        }  
       			
        if($box->text) { ?>
            <div class="box text"><?php echo $box->text; ?></div>
        <?php }
    			
    } ?>
    
×
×
  • Create New...