Перейти к публикации
Дизайн и модификация IPS Community IPBSkinsBETA
Поиск в
  • Дополнительно...
Искать результаты, содержащие...
Искать результаты в...

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

Я создал новую базу данных в Ip.content (С родным исходным кодом).

 

Database Display

Generic template to view a record in a custom database

 

Ее родной код.

 

{ccs special_tag="navigation"}
{parse js_module="rating"}
{parse template="include_lightbox" group="global" params=""} 
{parse template="include_highlighter" group="global" params="1"}


<php>
   $data['record'] = IPSMember::buildDisplayData( $data['record'] );
</php>
<if test="$data['database']['database_rate']">
   <div class='right'>
       <if test="$this->memberData['member_id']">
           {$data['follow_data']}
       </if>
       <div class='rating ipsType_smaller ipsPad_top_half right clear'>
           <if test="$data['database']['_can_rate']">
                   <a href='#' id='article_rate_1' title='{$this->lang->words['top_js_1star']}'>
           </if>
           <if test="rate1:|:$data['record']['rating_real'] >= 1">
                   {parse replacement="rate_on"}
           <else />
                   {parse replacement="rate_off"}
           </if>
           <if test="$data['database']['_can_rate']">
                   </a><a href='#' id='article_rate_2' title='{$this->lang->words['top_js_2star']}'>
           </if>
           <if test="rate2:|:$data['record']['rating_real'] >= 2">
                   {parse replacement="rate_on"}
           <else />
                   {parse replacement="rate_off"}
           </if>
           <if test="$data['database']['_can_rate']">
                   </a><a href='#' id='article_rate_3' title='{$this->lang->words['top_js_3star']}'>
           </if>
           <if test="rate3:|:$data['record']['rating_real'] >= 3">
                   {parse replacement="rate_on"}
           <else />
                   {parse replacement="rate_off"}
           </if>
           <if test="$data['database']['_can_rate']">
                   </a><a href='#' id='article_rate_4' title='{$this->lang->words['top_js_4star']}'>
           </if>
           <if test="rate4:|:$data['record']['rating_real'] >= 4">
                   {parse replacement="rate_on"}
           <else />
                   {parse replacement="rate_off"}
           </if>
           <if test="$data['database']['_can_rate']">
                   </a><a href='#' id='article_rate_5' title='{$this->lang->words['top_js_5star']}'>
           </if>
           <if test="rate5:|:$data['record']['rating_real'] >= 5">
                   {parse replacement="rate_on"}
           <else />
                   {parse replacement="rate_off"}
           </if>
           <if test="$data['database']['_can_rate']">
                   </a>
                   <script type='text/javascript'>
                                   rating = new ipb.rating( 'article_rate_', { 
                                                                           url: ipb.vars['base_url'] + 'app=ccs&module=ajax&section=rate&id={$data['database']['database_id']}&record={$data['record']['primary_id_field']}&md5check=' + ipb.vars['secure_hash'],
                                                                           cur_rating: <if test="isset($data['record']['rating_real'])">{$data['record']['rating_real']}<else />0</if>,
                                                                           rated: null,
                                                                           allow_rate: <if test="$data['database']['_can_rate']">1<else />0</if>,
                                                                           show_rate_text: false
                                                                     } );
                   </script>
           </if>
       </div>
   </div>
<else />
   <if test="$this->memberData['member_id']">
       {$data['follow_data']}
   </if>
</if>
{parse template="userSmallPhoto" group="global" params="array_merge( $data['record'], array( '_customClass' => 'ipsUserPhoto_medium' ) )"}
<div class='ipsBox_withphoto'>
   <h1 class='ipsType_pagetitle'>
   <if test="$data['record']['record_approved'] == 0">
       <span class='ipsBadge ipsBadge_orange'>{$this->lang->words['f_queued_badge']}</span>
   <else />
       <if test="$data['record']['record_approved'] == -1">
           <span class='ipsBadge ipsBadge_orange'>{$this->lang->words['f_deleted_badge']}</span>
       </if>
   </if>
   {$data['record'][$data['database']['database_field_title'] . '_value' ]}
   </h1>

   <div class='desc lighter blend_links'>
       {$this->lang->words['submitted_by_record']} {parse template="userHoverCard" group="global" params="$data['record']"}, {parse date="$data['record']['record_saved']" format="SHORT"} | {$this->lang->words['last_updated_record']} {parse date="$data['record']['record_updated']" format="SHORT"}
   </div>
   <if test="hasTags:|:is_array($data['record']['tags'])">
       {$data['record']['tags']['formatted']['parsedWithoutComma']}
   </if>
</div>
<br />

<div class="ipsBox">
   <div class="ipsBox_container ipsPad ipsType_textblock">
       {$data['record'][$data['database']['database_field_content'] . '_value' ]}
       {parse template="repButtons" group="global_other" params="$data['record'], array_merge( $data['record'], array( 'primaryId' => $data['record']['primary_id_field'], 'domLikeStripId' => 'like_post_' . $data['record']['primary_id_field'], 'domCountId' => 'rep_post_' . $data['record']['primary_id_field'], 'app' => 'ccs', 'type' => 'record_id_' . $data['database']['database_id'], 'likeFormatted' => $data['record']['like']['formatted'] ) )"}
       <br />

       <foreach loop="$data['fields'] as $field">
           <if test="$field['field_type'] == 'attachments' AND $data['record']['field_' . $field['field_id'] . '_value']">
               <div id='attach_wrap' class='rounded clearfix'>
                   <h4>{$field['field_name']}</h4>
                   <br />
                   {$data['record']['field_' . $field['field_id'] . '_value']}
                   <br /><br />
               </div>
           </if>
       </foreach>

       <table class='ipb_table'>
           <if test="count($data['fields'])">
               <foreach loop="$data['fields'] as $field">
                   <if test="'field_'.$field['field_id'] != $data['database']['database_field_title'] and 'field_'.$field['field_id'] != $data['database']['database_field_content'] and $field['field_type'] != 'attachments'">
                       <tr>
                           <td style='width: 20%; font-weight: bold; text-align: right; vertical-align: top;'>{$field['field_name']}:</td>
                           <td>{$data['record']['field_' . $field['field_id'] . '_value']}</td>
                       </tr>
                   </if>
               </foreach>
           <else />
               <tr>
                   <td style='text-align: center;'><em>{$this->lang->words['record_not_found']}</em></td>
               </tr>
           </if>
       </table>
   </div>
</div>

<div class='ipsPad'>
   <if test="$this->settings['sl_enable']">
       <div style='float: left'>
           {parse template="facebookLike" group="ccs_global" params="$data['record']['record_link']"}
           {IPSLib::shareLinks( $data['record'][ $data['database']['database_field_title'] . '_value' ], array( 'overrideApp' => 'ccs' ) )}
       </div>
   </if>
   <if test="$this->memberData['member_id']">
       <div style='float: right'>
           <ul class='post_controls'>
               <if test="$data['database']['_can_edit']">
                   <li><a href='{$data['record']['record_link']}do=edit' title='{$this->lang->words['edit_record_button']}' accesskey='s'>{$this->lang->words['edit_record_button']}</a></li>
               <else />
                   <li class='disabled'><span>{$this->lang->words['edit_record_button_no']}</span></li>
               </if>

               <if test="$data['record']['record_locked'] AND $data['database']['moderate_unlock']">
                   <li><a href='{$data['record']['record_link']}do=unlock&secure_key={$this->member->form_hash}' title='{$this->lang->words['unlock_record']}' accesskey='l'>{$this->lang->words['unlock_record']}</a></li>
               <else />
                   <if test="!$data['record']['record_locked'] AND $data['database']['moderate_lock']">
                       <li><a href='{$data['record']['record_link']}do=lock&secure_key={$this->member->form_hash}' title='{$this->lang->words['lock_record']}' accesskey='l'>{$this->lang->words['lock_record']}</a></li>
                   </if>
               </if>

               <if test="$data['database']['moderate_pin']">
                   <if test="$data['record']['record_pinned']">
                       <li><a href='{$data['record']['record_link']}do=unpin&secure_key={$this->member->form_hash}' title='{$this->lang->words['unpin_record']}'>{$this->lang->words['unpin_record']}</a></li>
                   <else />
                       <li><a href='{$data['record']['record_link']}do=pin&secure_key={$this->member->form_hash}' title='{$this->lang->words['pin_record']}'>{$this->lang->words['pin_record']}</a></li>
                   </if>
               </if>

               <if test="$data['database']['moderate_approve']">
                   <if test="$data['record']['record_approved'] == 0">
                       <li><a href='{$data['record']['record_link']}do=approve&secure_key={$this->member->form_hash}' title='{$this->lang->words['approve_record']}'>{$this->lang->words['approve_record']}</a></li>
                   </if>
               </if>

               <if test="$data['database']['moderate_delete']">
                   <li><a href='{$data['record']['record_link']}do=delete' title='{$this->lang->words['delete_record']}'>{$this->lang->words['delete_record']}</a></li>

                   <if test="$data['record']['record_approved'] == 1">
                       <li><a href='{$data['record']['record_link']}do=unapprove&secure_key={$this->member->form_hash}' title='{$this->lang->words['unapprove_record']}'>{$this->lang->words['unapprove_record']}</a></li>
                   <else />
                       <if test="$data['record']['record_approved'] == -1">
                           <li><a href='{$data['record']['record_link']}do=approve&secure_key={$this->member->form_hash}' title='{$this->lang->words['unhide_record']}'>{$this->lang->words['unhide_record']}</a></li>
                       </if>
                   </if>
               </if>

               <if test="$data['database']['moderate_restorer'] AND $data['database']['database_revisions']">
                   <li><a href='{$data['record']['record_link']}do=revisions' title='{$this->lang->words['record_revisions']}' class='right'>{$this->lang->words['record_revisions']}</a></li>
               </if>

               <if test="$data['database']['_can_report']">
                   <li class='report'>
                       <a href='{parse url="app=core&module=reports&rcom=ccs&database={$data['database']['database_id']}&record={$data['record']['primary_id_field']}" base="public"}'>{$this->lang->words['report_record']}</a>
                   </li>
               </if>
           </ul>
       </div>
   </if>
</div>

<br /><br />

<if test="$data['database']['database_comments']">
<div id='commentsStart' class='ipsBox'>
   <div class='ipsBox_container ipsPad'>
       <h2 class='ipsType_subtitle'>{$data['comments']['count']} {$this->lang->words['comment_block']}</h2>
       <div class='comment_wrap'>
           {$data['comments']['html']}
       </div>
   </div>
</div>
<br />
</if>

 

Добавил поля в базу:

- Название

- Описание

- Вложения

 

Вроде все отлично, но когда вложения я загружаю в статью в определенное место, оно вставляется, но вложение еще дублируется вверху статьи.

 

Я правильно понимаю, что нужно истребить кусок кода.

 

<foreach loop="$data['fields'] as $field">
           <if test="$field['field_type'] == 'attachments' AND $data['record']['field_' . $field['field_id'] . '_value']">
               <div id='attach_wrap' class='rounded clearfix'>
                   <h4>{$field['field_name']}</h4>
                   <br />
                   {$data['record']['field_' . $field['field_id'] . '_value']}
                   <br /><br />
               </div>
           </if>

Поделиться сообщением


Ссылка на сообщение

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

Вы должны быть пользователем, чтобы оставить комментарий

Создать аккаунт

Зарегистрируйтесь для получения аккаунта. Это просто!

Зарегистрировать аккаунт

Войти

Уже зарегистрированы? Войдите здесь.

Войти сейчас

  • Сейчас на странице   0 пользователей

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

×
×
  • Создать...