W
W
woebegone2021-01-22 23:01:52
DLE
woebegone, 2021-01-22 23:01:52

How to adapt the source code of the module to the native file show.full.php cms DLE?

There is a module that I found on the pages of the site.

$xflist = dle_cache( $xfname, $config['skin'] );
if(!$xflist) {
  $sql_result = $db->query( "SELECT xfields FROM " . PREFIX . "_post WHERE approve=1" );
  while ( $rows = $db->get_row( $sql_result ) ) {
    $xfields[] = $rows;
  }
  $stack = array();
  foreach($xfields as $value){
    if($value[xfields]){
      $row = xfieldsdataload($value[xfields]);
      if($row[$xfname]){
        $rowdata = explode( "~", $row[$xfname]);
        foreach($rowdata as $value){
          if($value){
            $value = trim($value);
            array_unshift($stack, $value);
          }
        }
      }
    }
  }
  sort ($stack);	
  $stack = array_count_values( $stack );
  foreach( $stack as $value => $count ){
    $xflist .= "<option value=" . $value . " data-subtext=" .$count . ">" . $value ."</option>";
  }
  create_cache( $xfname, $xflist, $config['skin'] );
}
echo $xflist;

It displays all involved additional fields in a list under select (if I understand correctly).
But it only works through an include connection.
How to remake it correctly so that it can be inserted into show.full.php and display all the news with the value of a certain additional field in some {item-news} tag, for example?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question