Advertisement
Guest User

Lolwut?

a guest
Oct 8th, 2015
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Event extends DataObject {   
  2.     private static $db = array(
  3.         "URL" => 'Text',
  4.     );
  5.  
  6.     public function getURL() {
  7.         $url = $this->dbObject('URL');
  8.         $urlVal = $url->value;
  9.         if($urlVal === 'http://' || $urlVal === 'https://') {
  10.             return false;
  11.         }
  12.         return $url;
  13.     }
  14.  
  15. }
  16. //EventHolder.ss
  17.  
  18. //This errors
  19. <% if $Event.URL %><p>Event URL: <a href="$Event.URL">$Event.URL</a></p><% end_if %>
  20.  
  21. Errors on
  22. "DataObject->dbObject(URL)
  23. LiveStreamEvent.php:95"
  24.  
  25. //However...
  26.  
  27. class Event extends DataObject {   
  28.     private static $db = array(
  29.         "URL" => 'Text',
  30.     );
  31.  
  32.     public function URL() {
  33.         $url = $this->dbObject('URL');
  34.         $urlVal = $url->value;
  35.         if($urlVal === 'http://' || $urlVal === 'https://') {
  36.             return false;
  37.         }
  38.         return $url;
  39.     }
  40. }
  41.  
  42. //EventHolder.ss
  43. <% if $Event.URL %><p>Event URL: <a href="$Event.URL">$Event.URL</a></p><% end_if %>
  44.  
  45. //This works fine BUT the <% if %> still gets triggered even though it returns false.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement