Перейти к содержанию
View in the app

A better way to browse. Learn more.

Форум VAOZ.RU

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Делаем теги глобальными в dle

Featured Replies

Опубликовано

Пожалуй лучшее решение, которое поможет вам вывести разные данные тегов которые привязаны к определенному TPL файлу в другом.
Решение было написано еще в не далеком 2014, автором rocksmart, но почему-то широкого применения ему не было найдено. Реализация простая и не мудреная но штука в итоге получается то что нужно.

Установка:
1. Открываем файл /engine/classes/templates.class.php и после строки:
 

class dle_template {


Вставить
 

var $transfer = array ();


Далее ищем код:
 

function get_real_time() {


И выше вставить
 

/* Глобализация данных */
   function transfer_result($matches=array()){
       $index   = $matches[2];
       $itsdata = $matches[3];
       $this->transfer[$index] = $itsdata;
   }


В этом же файле найти строку
 

if( isset( $this->result[$tpl] ) ) $this->result[$tpl] .= $this->copy_template;


И ПЕРЕД ней вставить
 

/* Глобализация данных */
if (strpos ($this->template, "[transfer=" ) !== false) {
   preg_replace_callback( "#\\[(transfer)=(.+?)\\](.*?)\\[/transfer\\]#is",array( &$this, 'transfer_result'), $this->copy_template);
   foreach($this->transfer as $index => $itsdata) {
           $this->result['transfer'][$index][] = $itsdata;
   }
}
$this->copy_template = preg_replace ( "#\\[(transfer)=(.+?)\\](.*?)\\[/transfer\\]#is", "", $this->copy_template);


2. Далее открываем файл /engine/classes/parse.class.php для защиты вставим, после строки
 

$source = str_ireplace( "{custom",


Вставить
 

$source = str_ireplace( "{transfer", "{transfer", $source );


3. Открываем файл /engine/modules/main.php и ПЕРЕД строкой
 

echo $tpl->result['main'];


Вставить
 

/* Глобализация данных by rocksmart */
if( count($tpl->result['transfer']) > 0 ) {
   foreach($tpl->result['transfer'] as $index => $itsdata) {
       $tpl->result['main'] = str_replace ( '{transfer_' . $index . '}', implode($itsdata), $tpl->result['main'] );
   }
}
$tpl->result['main'] = preg_replace( "#\\{transfer_(.+?)\\}#i", "", $tpl->result['main']);


Установка закончена!

Пример использования
 

[transfer=Уникальный идентификатор]какой либо текст с тегами соответствующими данному шаблону[/transfer]


Рассмотрим на примере вывода тега Делаем теги глобальными в DLE с fullstory.tpl в main.tpl
В fullstory.tpl пишем
 

[transfer=fulltitle]{title}[/transfer]


И потом в main.tpl в нужном месте

{transfer_fulltitle}


В итоге Название новости будет показано в файле main.tpl тегом {transfer_fulltitle}

Для публикации сообщений создайте учётную запись или авторизуйтесь

https://vaoz.ru/topic/326-delaem-tegi-globalnymi-v-dle/
Рейтинг@Mail.ru Яндекс.Метрика

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.