original_string: function get_topic($all_posts = false)
  	{
  		if(!$this->_topic)
  		{
  			if($this->post_id)
  			{
  				//existing post, load existing topic
  				$this->_topic = topic::get($this->topic_id, $all_posts);
  
  				//insert $this into topic->posts array
  				if($all_posts)
  				{
  					//this post was also loaded from database, replace it with $this
  					for($i=0; $i<sizeof($this->_topic->posts); $i++)
  					{
  						if($this->_topic->posts[$i]->post_id == $this->post_id)
  						{
  							//found it
  							$this->_topic->posts[$i] = &$this;
  							break;
  						}
  					}
  				}
  				else
  				{
  					//no posts were loaded in topic::get(), add our post to topic->posts
  					$this->_topic->posts[] = &$this;
  				}
  			}
  			else
  			{
  				//new post, generate topic
  				$this->_topic = topic::from_post($this);
  			}
  		}
  		return $this->_topic;
  	}
code: function get_topic($all_posts = false)
  	{
  		if(!$this->_topic)
  		{
  			if($this->post_id)
  			{
  				//existing post, load existing topic
  				$this->_topic = topic::get($this->topic_id, $all_posts);
  
  				//insert $this into topic->posts array
  				if($all_posts)
  				{
  					//this post was also loaded from database, replace it with $this
  					for($i=0; $i<sizeof($this->_topic->posts); $i++)
  					{
  						if($this->_topic->posts[$i]->post_id == $this->post_id)
  						{
  							//found it
  							$this->_topic->posts[$i] = &$this;
  							break;
  						}
  					}
  				}
  				else
  				{
  					//no posts were loaded in topic::get(), add our post to topic->posts
  					$this->_topic->posts[] = &$this;
  				}
  			}
  			else
  			{
  				//new post, generate topic
  				$this->_topic = topic::from_post($this);
  			}
  		}
  		return $this->_topic;
  	}
code_tokens: function get_topic ( $ all_posts = false ) { if ( ! $ this -> _topic ) { if ( $ this -> post_id ) { //existing post, load existing topic $ this -> _topic = topic :: get ( $ this -> topic_id , $ all_posts ) ; //insert $this into topic->posts array if ( $ all_posts ) { //this post was also loaded from database, replace it with $this for ( $ i = 0 ; $ i < sizeof ( $ this -> _topic -> posts ) ; $ i ++ ) { if ( $ this -> _topic -> posts [ $ i ] -> post_id == $ this -> post_id ) { //found it $ this -> _topic -> posts [ $ i ] = & $ this ; break ; } } } else { //no posts were loaded in topic::get(), add our post to topic->posts $ this -> _topic -> posts [ ] = & $ this ; } } else { //new post, generate topic $ this -> _topic = topic :: from_post ( $ this ) ; } } return $ this -> _topic ; }
docstring: loads and returns the topic for this post
  @param all_posts whether to load all other posts of the topic into topic->posts
docstring_tokens: loads and returns the topic for this post