Jump to content

Stick

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by Stick

  1. I am new to PHP and new to PW.  The below code works but I get the feeling it could be cleaner/better.  Any assistance would be greatly appreciated.

      <div class="row mb-2">
      <?php
        $items = $pages->find("homepage_item=1");
          foreach($items as $item) {
    	  // $item === $pages->get($item->id);
    	  echo "<div class='col-md-6'>";
    	    echo "<div class='row g-0 border rounded overflow-hidden flex-md-row mb-4 shadow-sm h-md-250 position-relative'> <div class='col p-4 d-flex flex-column position-static'>";
    	      echo "<h3 class='mb-0'>$item->title</h3>";
    	      if($item->arbitrary_publish_date) { echo "<div class='mb-1 text-muted'>$item->arbitrary_publish_date</div>";
              }
              else 
              {echo "<div class='mb-1 text-muted'></div>";
              }
    	      echo "<p class='card-text mb-auto'>$item->summary</p>";
    	      echo "<a href='$item->url' class='stretched-link'>Continue reading</a>";
    	    echo "</div><div class='col-auto d-none d-lg-block'>";
    	      echo "<svg class='bd-placeholder-img' width='200' height='250' xmlns='http://www.w3.org/2000/svg' role='img' aria-label='Placeholder: Thumbnail' preserveAspectRatio='xMidYMid slice' focusable='false'><title>Placeholder</title><rect width='100%' height='100%' fill='#55595c'/><text x='50%' y='50%' fill='#eceeef' dy='.3em'>Check it out!</text></svg>";
    	    echo "</div>";
    	    echo "</div>";
    	    echo "</div>";
    	  // echo $item->title;
        }
        ?>
        </div>

     

    • Like 1
×
×
  • Create New...