Перейти к публикации
View in the app

A better way to browse. Learn more.

Дизайн и модификация Invision Community

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.

Вывод ОДНОГО дополнительного поля

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

Здравствуйте форумчане!

 

Поставил мод: флаг страны, как дополнительное поле про чтении тем оно выводится. Но нужно другое,

Как вывести это дополнительное поле при просмотре профиля? Именно не весь блок дополнительных полей, а одно значение?

 

Изменить HTML фрагменты > skin_profile (Просмотр профиля) > show_profile

 

Добавляю в нужное место:

 

<img src="style_images/flags/{$author['field_8']}.gif" border='0'>

 

И картинка страны не выводится, а точнее оно не берёт нужное значение и получается = /style_images/flags/.gif, пробовал добавлять входящую переменную $author, писать через $info, писать fields, но это ничего не дало :( . Номер дополнительного поля верный.

 

Возможно нам поможет кусок кода из sources/action_public/profile.php

 

  //-----------------------------------------
   	// Get custom profile information
   	//-----------------------------------------

   	require_once( ROOT_PATH.'sources/classes/class_custom_fields.php' );
   	$fields = new custom_fields( $this->ipsclass->DB );

   	$fields->member_id   = $this->ipsclass->member['id'];
   	$fields->mem_data_id = $member['id'];
   	$fields->cache_data  = $this->ipsclass->cache['profilefields'];
   	$fields->admin       = intval($this->ipsclass->member['g_access_cp']);
   	$fields->supmod      = intval($this->ipsclass->member['g_is_supmod']);

   	$fields->init_data();
   	$fields->parse_to_view();

   	foreach( $fields->out_fields as $id => $data )
   	{
   		if ( ! $data )
   		{
   			$data = $this->ipsclass->lang['no_info'];
   		}

		$custom_out .= $this->ipsclass->compiled_templates['skin_profile']->custom_field( $fields->field_names[ $id ], nl2br($data) );
   	}

   	if ($custom_out != "")
   	{
   		$this->output = str_replace( "<!--{CUSTOM.FIELDS}-->", $custom_out, $this->output );
   	}
   	else
   	{
   		$this->output = str_replace( "<!--{CUSTOM.FIELDS}-->", $this->ipsclass->compiled_templates['skin_profile']->no_custom_information(), $this->output );
   	}

 

Буду благодарен за помощь, сломал уже всю голову.

class_custom_fields.php

Изменено пользователем ukasheu

Рекомендованные сообщения

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

Можно до

           $custom_out .= $this->ipsclass->compiled_templates['skin_profile']->custom_field( $fields->field_names[ $id ], nl2br($data) );

добавить

    		if ($id == 8)
   		{
   			$info['country_flag'] = $data;
   		}

Дальше в шаблоне использовать $info['country_flag']

Опубликовано:
  • Автор

Всё равно выводится: /style_images/flags/.gif

 

Изменить HTML фрагменты > skin_profile (Просмотр профиля) > show_profile

 

<img src="http://ipbskins.ru/forum/public/style_images/flags/{$info['country_flag']}.gif" border='0'>

 

        //-----------------------------------------
   	// Get custom profile information
   	//-----------------------------------------

   	require_once( ROOT_PATH.'sources/classes/class_custom_fields.php' );
   	$fields = new custom_fields( $this->ipsclass->DB );

   	$fields->member_id   = $this->ipsclass->member['id'];
   	$fields->mem_data_id = $member['id'];
   	$fields->cache_data  = $this->ipsclass->cache['profilefields'];
   	$fields->admin       = intval($this->ipsclass->member['g_access_cp']);
   	$fields->supmod      = intval($this->ipsclass->member['g_is_supmod']);

   	$fields->init_data();
   	$fields->parse_to_view();

   	foreach( $fields->out_fields as $id => $data )
   	{
   		if ( ! $data )
   		{
   			$data = $this->ipsclass->lang['no_info'];
   		}

		if ($id == 8)
           {
               $info['country_flag'] = $data;
           }

		$custom_out .= $this->ipsclass->compiled_templates['skin_profile']->custom_field( $fields->field_names[ $id ], nl2br($data) );
   	}

   	if ($custom_out != "")
   	{
   		$this->output = str_replace( "<!--{CUSTOM.FIELDS}-->", $custom_out, $this->output );
   	}
   	else
   	{
   		$this->output = str_replace( "<!--{CUSTOM.FIELDS}-->", $this->ipsclass->compiled_templates['skin_profile']->no_custom_information(), $this->output );
   	}

 

Возможно надо if ($pf_id == 8) ?? Прикрепляю phpmyadmin.

post-60283-0-61864100-1520863581_thumb.png

Изменено пользователем ukasheu

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

Все понятно. Посмотрел файл profile.php.

Шаблон show_profile используется выше кастомных полей.

 

       require_once( ROOT_PATH.'sources/classes/class_custom_fields.php' );
       $fields = new custom_fields( $this->ipsclass->DB );

       $fields->member_id   = $this->ipsclass->member['id'];
       $fields->mem_data_id = $member['id'];
       $fields->cache_data  = $this->ipsclass->cache['profilefields'];
       $fields->admin       = intval($this->ipsclass->member['g_access_cp']);
       $fields->supmod      = intval($this->ipsclass->member['g_is_supmod']);

       $fields->init_data();
       $fields->parse_to_view();

       foreach( $fields->out_fields as $id => $data )
       {
           if ( ! $data )
           {
               $data = $this->ipsclass->lang['no_info'];
           }

           if ($id == 8)
           {
               $info['country_flag'] = $data;
           }

           $custom_out .= $this->ipsclass->compiled_templates['skin_profile']->custom_field( $fields->field_names[ $id ], nl2br($data) );
       }

переместите выше следующей строки

$this->output .= $this->ipsclass->compiled_templates['skin_profile']->show_profile( $info, $this->ipsclass->return_md5_check() );

Опубликовано:
  • Автор

Отлично, начало подхватывать, но не совсем правильно:

 

Дополнительное поле

Содержимое опций для ниспадающего меню

Russia=Россия

.............

 

Выводит: /style_images/flags/Россия.gif

 

===================================================================

 

В темах всё правильно отображается: /style_images/flags/Russia.gif

 

===================================================================

 

Спасибо Вам за помощь B) , скажите ещё, можно ли скрывать флаг если следующее:

 

Not Selected=Не выбрано

 

Или проще создать картинку пустышку? :)

profile.php

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

           if ($id == 8)
           {
               $info['country_flag'] = $data;
           }

замените на

           if ($id == 8 and $data and $fields->in_fields[$id] != 'Not Selected')
           {
               $info['country_flag'] = $fields->in_fields[$id];
           }

 

В шаблоне код картинки обертывать в условие

<if="isset($info['country_flag'])">код картинки</if>

Опубликовано:
  • Автор

Спасибо Вам newbie!

 

<img src="style_images/flags/{$info['country_flag']}.gif" alt='{$info['country_flag']}' border='0'>

 

Теперь работает идеально, если не выбрано - не отображает!

 

А если пишем так:

 

<if="isset($info['country_flag'])">
<img src="style_images/flags/{$info['country_flag']}.gif" alt='{$info['country_flag']}' border='0'>
</if>

 

Fatal error: Function name must be a string in /cache/skin_cache/cacheid_11/skin_profile.php on line 430

Создайте аккаунт или войдите в него для комментирования

Сейчас на странице 0

  • Нет пользователей, просматривающих эту страницу.

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.