P
P
Petr Volkhanov2014-09-26 22:35:02
PHP
Petr Volkhanov, 2014-09-26 22:35:02

How to deal with the method and its property?

There is a large class in which the following method is described:

/**
   * Return the title of the page.
   *
   * @return  string
   *
   * @since    11.1
   */
  public function getDescription()
  {
    return $this->description;
  }

at the beginning of the class, as I understand it, the description property is described:
/**
   * Document description
   *
   * @var    string
   * @since  11.1
   */
  public $description = '';

The getDescription() method takes the first 200 characters of the article and writes them to the description meta tag. But the question is, how can I make the getDescription() method take more characters than 200? Help, please, in which direction to dig?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton Shamanov, 2014-09-26
@SilenceOfWinter

apparently the class works with the database and apparently the field type is varchar(200) :)

S
Sergey Melnikov, 2014-09-26
@mlnkv

here is the class description the
property is set in the method

public function setDescription($description) {
  $this->description = $description;
}

this method is called in
public function setMetaData($name, $content, $http_equiv = false, $sync = true) {
  $name = strtolower($name);
  if ($name == 'generator') {
    $this->setGenerator($content);
  } elseif ($name == 'description') {
    $this->setDescription($content);
  } else {
    if ($http_equiv == true) {
      $this->_metaTags['http-equiv'][$name] = $content;
      // Syncing with HTTP-header
      if($sync && strtolower($name) == 'content-type') {
        $this->setMimeEncoding($content, false);
      }
    } else {
      $this->_metaTags['standard'][$name] = $content;
    }
  }
}

it remains to find where the
->setMetaData('description', .....) method is called

S
Sergey Romanov, 2014-09-27
@Serhioromano

It depends on what you are doing. If you have a component, then just call

$doc = JFactory::getDocument();
$doc->setMetaData('description', 'This is my description');

Then there will be what you need. And if you hack joomla files then just don't update. Or you will lose everything during the update.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question