ukasheu Posted March 12, 2018 Share Posted March 12, 2018 (edited) Здравствуйте форумчане! Поставил мод: флаг страны, как дополнительное поле про чтении тем оно выводится. Но нужно другое,Как вывести это дополнительное поле при просмотре профиля? Именно не весь блок дополнительных полей, а одно значение? Изменить 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 Edited March 12, 2018 by ukasheu Link to comment Share on other sites More sharing options...
newbie Posted March 12, 2018 Share Posted March 12, 2018 Можно до $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'] 1 Link to comment Share on other sites More sharing options...
ukasheu Posted March 12, 2018 Author Share Posted March 12, 2018 (edited) Всё равно выводится: /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. Edited March 12, 2018 by ukasheu Link to comment Share on other sites More sharing options...
newbie Posted March 13, 2018 Share Posted March 13, 2018 Все понятно. Посмотрел файл 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() ); 1 Link to comment Share on other sites More sharing options...
ukasheu Posted March 14, 2018 Author Share Posted March 14, 2018 Отлично, начало подхватывать, но не совсем правильно: Дополнительное полеСодержимое опций для ниспадающего менюRussia=Россия............. Выводит: /style_images/flags/Россия.gif =================================================================== В темах всё правильно отображается: /style_images/flags/Russia.gif =================================================================== Спасибо Вам за помощь B) , скажите ещё, можно ли скрывать флаг если следующее: Not Selected=Не выбрано Или проще создать картинку пустышку? :)profile.php Link to comment Share on other sites More sharing options...
newbie Posted March 15, 2018 Share Posted March 15, 2018 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> 1 Link to comment Share on other sites More sharing options...
ukasheu Posted March 15, 2018 Author Share Posted March 15, 2018 Спасибо Вам 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now