jonaofarc Posted March 3, 2009 Share Posted March 3, 2009 this strip of code seems to make the browser go into a loop? would anybody please tell me what the return function does here? I really dont understand why the return function is returning a variable? Fatal error: Call to a member function getType() on a non-object public function __construct($display_type) { if (empty($display_type) && !empty($_COOKIE['display_type'])) $this->display_type = $_COOKIE['display_type']; else $this->display_type = ($display_type === 'list') ? 'list' : 'grid'; setcookie('display_type', $this->display_type, strtotime('+ 1 year')); } public function getType() { return $display_type; } Link to comment https://forums.phpfreaks.com/topic/147681-hey-guys-whats-up-with-this-code-help/ Share on other sites More sharing options...
RussellReal Posted March 3, 2009 Share Posted March 3, 2009 I don't see any loop =\ Link to comment https://forums.phpfreaks.com/topic/147681-hey-guys-whats-up-with-this-code-help/#findComment-775194 Share on other sites More sharing options...
jonaofarc Posted March 3, 2009 Author Share Posted March 3, 2009 anybody? Link to comment https://forums.phpfreaks.com/topic/147681-hey-guys-whats-up-with-this-code-help/#findComment-775216 Share on other sites More sharing options...
genericnumber1 Posted March 3, 2009 Share Posted March 3, 2009 Can you show us the line where you're calling getType()? As the above poster said, there's no loop here. Link to comment https://forums.phpfreaks.com/topic/147681-hey-guys-whats-up-with-this-code-help/#findComment-775229 Share on other sites More sharing options...
jonaofarc Posted March 3, 2009 Author Share Posted March 3, 2009 {if $display_type->getType() === "grid"}<strong>grid</strong> | <a href="{$display_type->get_url()}&display_type=list">list</a>{else}<a href="{$display_type->get_url()}&display_type=grid">grid</a> | <strong>list</strong>{/if} Link to comment https://forums.phpfreaks.com/topic/147681-hey-guys-whats-up-with-this-code-help/#findComment-775270 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.