Get 3 random objects for display on a Silverstrip template


/ Published in: PHP
Save to your folder(s)

For using in Silverstrip CMS


Copy this code and paste it in your HTML
  1. In the CONTROLLER
  2.  
  3. function DiveSites() {
  4. $DiveSites = DataObject::get("DiveSitePage",
  5. "",
  6. "RAND()",
  7. "",
  8. "3");
  9.  
  10. // Debug::show($DiveSites)
  11. return $DiveSites;
  12.  
  13. }
  14.  
  15. In the TEMPLATE
  16.  
  17. <% control DiveSites %>
  18.  
  19. <div id="TasmanianDiveSiteSummaryHomePage" >
  20.  
  21. <% control MainImage %>
  22. <% control SetWidth(50) %>
  23. <a href="$Top.Link" > <img src="$URL" alt="Image of the $Top.Title"/ class="left"> </a>
  24. <% end_control %>
  25. <% end_control %>
  26.  
  27.  
  28. <div class="Summary">
  29. <h4>$Title</h4>
  30. <div class="SummaryText"> $Summary</div>
  31. <p>
  32. <a href="$Link" title="Find out more about this dive site &quot;{$Title}&quot;">Find out more about this dive site </a>
  33. </p>
  34. </div>
  35.  
  36. </div>
  37.  
  38. <% end_control %>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.