Jump to content
Дизайн и модификация IPS Community IPBSkinsBETA
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
kanv1s

[IPB 3.4.8][video] Вывод данных блока из приложения, в хук на основном форуме.

Recommended Posts

Здравствуйте.

 

Вопрос следующий. На форуме установлен модуль видео. У него есть боковой блок "Последние видео" - https://yadi.sk/i/aH6KaqwCippue

 

Его код:

 

<if test="hideLastUpdated:|:!in_array( "last_updated", explode( ",", $this->settings['vs_disabled_portal_blocks'] ) )">      
           <div class="ipsSideBlock">
           	<h3><a href="{parse url="app=videos&do=list_all&sort_by=last_updated&sort_order=desc" seotitle="false" template="video_list_all" base="public"}" class='right desc'>({$this->lang->words['view_more']})</a> {$this->lang->words['last_updated']}</h3>
           	<ul class="ipsList_withminiphoto">
                           <if test="haslastupdated:|:is_array( $lastUpdatedVideos ) && count( $lastUpdatedVideos )">
           			<foreach loop="video_row:$lastUpdatedVideos as $r">
           				<li class='clearfix'>

                                                <if test="showThumbnail:|:$this->settings['vs_enable_thumbnail']">
                                                     <span class='left' style='margin-right: 5px;'>      
                                                          {parse template="videoThumbnail" group="videos" params="$r, 'small'"}
                                                     </span>
                                                </if>

                                                <a href='{parse url="do=view&id={$r['tid']}" seotitle="{$r['seo_title']}" template="video_view" base="publicWithApp"}'><h4>{IPSText::truncate( $r['title'], $this->settings['vs_name_character_limit'] )}</h4></a> 
           					<div class="list_content"> 

           						<p class="desc ipsType_smaller">
           							<if test="videoAuthor:|:$r['member']['member_id']">{IPSMember::makeProfileLink( IPSMember::makeNameFormatted( $r['member']['members_display_name'], $r['member']['member_group_id'] ), $r['member']['member_id'], $r['member']['members_seo_name'] )}<else />{$this->lang->words['guest']}</if>
           							- {parse date="$r['last_updated']" format="date"}
           						</p>
           					</div>
           				</li>
           			</foreach>
                            <else />
                                   <li><i>{$this->lang->words['no_latest_videos']}</i></li>
                            </if>
           	</ul>
           </div>
       </if>

 

 

Так же есть хук, который выводит последние добавления на форум - https://yadi.sk/i/CtEokVRfipqDe

Его код:

 

<style type="text/css">
.video_thumbnail {
      padding: 1px;
      margin: 3px;
      background: #ffffff;
      border: 1px solid #3F3F3F;       
}
</style>

<div class='ipsSideBlock'>
<h3>{$this->lang->words['vs_board_videos']}</h3>
       <div class='_sbcollapsable'>
       	<ul class='ipsList_withminiphoto'>
       		<if test="hasvideos:|:is_array( $videos ) && count( $videos )">

       			<foreach loop="videos_row:$videos as $r">
       				<li class='clearfix'>

                           <if test="showThumbnail:|:$this->settings['vs_enable_thumbnail']">
                               <span class='left' style='margin-right: 5px;'>
                                   {parse template="videoThumbnail" group="videos" params="$r, 'small'"}
                               </span>
                           </if>

                           <div class='list_content'>
                               <a href='{parse url="app=videos&do=view&id={$r['tid']}" seotitle="{$r['seo_title']}" template="video_view" base="public"}' title='{$r['title']}'><h4>{IPSText::truncate( $r['title'], $this->settings['vs_name_character_limit'] )}</h4></a>
                               <p class="desc ipsType_smaller">{parse date="$r['date']" format="date"} ({parse format_number="$r['views']"} {$this->lang->words['views']})</p>
                           </div>

       				</li>
       			</foreach>
                       <li class='short desc'><a href='{parse url="app=videos" seotitle="false" template="app=videos" base="public"}'>({$this->lang->words['view_all_videos']})</a></li>
       		<else />
       			<li>{$this->lang->words['vs_no_video_results']}</li>
       		</if>
       	</ul>
       </div>
</div>

 

 

Нужно добавить в хук, авторов последних видео.

В приложении, авторы выводятся кодом:

<if test="videoAuthor:|:$r['member']['member_id']">{IPSMember::makeProfileLink( IPSMember::makeNameFormatted( $r['member']['members_display_name'], $r['member']['member_group_id'] ), $r['member']['member_id'], $r['member']['members_seo_name'] )}<else />{$this->lang->words['guest']}</if>

 

Если копировать этот код в шаблон хука, ничего не происходит. Я так понимаю, нужно как то связать, автора и его видео, в шаблоне хука, что бы они откуда то подгружались.

Пробовал полностью копировать код блока из приложения в шаблон хука. Пробовал как то это подстраивать. Много манипуляций проделал, не помогало.

Вот, хотел как то сам разобраться, не получилось.

Как это сделать? Что я делаю не так?

Share this post


Link to post
Share on other sites

Что я делаю не так?

Вам виднее :)

Вообще в массиве $videos нет данных об авторах. Поэтому сперва нужно их туда добавить.

Share this post


Link to post
Share on other sites

Каким образом их туда добавить?

 

Вот полный код:

 

<h1 class="ipsType_pagetitle"><if test="pageTitle:|:$category['cid']">
    {$category['name']} <if test="showCategoryRSS:|:$category['c_options']['cat_rss']"><a href='{parse url="app=core&module=global&section=rss&type=videos&cat={$category['cid']}" base="public"}' title='{$category['name']} {$this->lang->words['rss_feed']}'><img src='{$this->settings['img_url']}/rss-mini.png' /></a></if><else />{IPSLib::getAppTitle( 'videos' )}</if></h1><br />

<div class='ipsLayout ipsLayout_withleft <if test="hideRightSidebar:|:!in_array( "top_rated", explode( ",", $this->settings['vs_disabled_portal_blocks'] ) ) OR !in_array( "last_updated", explode( ",", $this->settings['vs_disabled_portal_blocks'] ) )">ipsLayout_withright</if> ipsLayout_{$this->settings['vs_portal_sidebar_size']}right ipsLayout_{$this->settings['vs_portal_sidebar_size']}left clearfix'>
   <div class='ipsLayout_left'>

       <if test="hasCategories:|:is_array( $categories ) && count( $categories )">
           <div class='ipsSideBlock'>
               <h3><a href='{parse url="app=videos&showcats=1" seotitle="false" template="app=videos" base="public"}' class='right desc'>({$this->lang->words['view_all']})</a> {$this->lang->words['vs_categories']}</h3>
           	<ul id='portal_categories'>
           		<foreach loop="category_loop:$categories as $cat">
           			<li class='<if test="hassubs:|:is_array($cat['subcategories']) AND count($cat['subcategories'])">has_sub <if test="autoHideSubsCss:|:!( is_array( $category['parent_cids'] ) && in_array( $cat['cid'], $category['parent_cids'] ) )">closed<else />open</if></if>'>

                           <span class="reputation <if test="hasVideos:|:$cat['c_info']['total_videos']">positive<else />zero</if> right">{parse format_number="$cat['c_info']['total_videos']"}</span>

           				<a href='{parse url="do=cat_view&id={$cat['cid']}" seotitle="{$cat['seo_name']}" template="video_cat_view" base="publicWithApp"}' title='{$this->lang->words['vs_view_category']} {$cat['name']}'>{$cat['name']}</a>

           				<if test="sublist:|:is_array($cat['subcategories']) AND count($cat['subcategories'])">
           					<ul class='subforums' <if test="autoHideSubs:|:!( is_array( $category['parent_cids'] ) && in_array( $cat['cid'], $category['parent_cids'] ) )">style='display: none'</if>>

           						<foreach loop="subrow:$cat['subcategories'] as $sc_link">
           							<li><a href='{parse url="do=cat_view&id={$sc_link['cid']}" seotitle="{$sc_link['seo_name']}" template="video_cat_view" base="publicWithApp"}' title='{$this->lang->words['vs_view_category']} {$sc_link['name']}' class='desc'>{$sc_link['name']}</a></li>
           						</foreach>
           					</ul>
           				</if>

           					<a href='#' class='sub_toggle'>{$this->lang->words['show_subs']}</a>
           				</if>
           			</li>
           		</foreach>
           	</ul>
           </div>
       </if>

       <if test="videoTagCloud:|:$tagCloud AND !in_array( "video_tags", explode( ",", $this->settings['vs_disabled_portal_blocks'] ) )">
            {$tagCloud}
       </if>

       <if test="hideLatestComments:|:!in_array( "latest_comments", explode( ",", $this->settings['vs_disabled_portal_blocks'] ) )">
           <div class="ipsSideBlock">
           	<h3><a href="{parse url="app=videos&do=recent_comments" seotitle="false" template="videos_recent_comments" base="public"}" class='right desc'>({$this->lang->words['view_more']})</a> {$this->lang->words['latest_comments']}</h3>
           	<ul class="ipsList_withminiphoto">
                           <if test="hascommentslist:|:is_array( $latestComments ) && count( $latestComments )">
           			<foreach loop="comment_row:$latestComments as $r">
           				<li>
           					{parse template="userSmallPhoto" group="global" params="$r['member']"}
           					<div class="list_content">
                                                           <if test="videoAuthor:|:$r['member']['member_id']">{IPSMember::makeProfileLink( IPSMember::makeNameFormatted( $r['member']['members_display_name'], $r['member']['member_group_id'] ), $r['member']['member_id'], $r['member']['members_seo_name'] )}<else />Guest</if>        						
           						<p class="desc ipsType_smaller">
           							<a href='{parse url="do=view&id={$r['tid']}" seotitle="{$r['seo_title']}" template="video_view" base="publicWithApp"}'>{$r['title']}</a>
           							- {parse date="$r['date']" format="date"}
           						</p>
           					</div>
           			        <p class="desc ipsType_smaller ipsComment">
                                   {IPSText::truncate( strip_tags( IPSText::getTextClass('bbcode')->stripAllTags( $r['comment'] ), '<br>' ), 50 )}
           			        </p>
           				</li>
           			</foreach>
                            <else />
                                   <li><i>{$this->lang->words['no_latest_comments']}</i></li>
                            </if>
           	</ul>
            </div>
        </if>

   </div>      

   <div class='ipsLayout_content clearfix'>
        <if test="mainContent:|:$mainContent">{$mainContent}</if>    
   </div>

   <div class='ipsLayout_right'>  
       <if test="hideLastUpdated:|:!in_array( "last_updated", explode( ",", $this->settings['vs_disabled_portal_blocks'] ) )">      
           <div class="ipsSideBlock">
           	<h3><a href="{parse url="app=videos&do=list_all&sort_by=last_updated&sort_order=desc" seotitle="false" template="video_list_all" base="public"}" class='right desc'>({$this->lang->words['view_more']})</a> {$this->lang->words['last_updated']}</h3>
           	<ul class="ipsList_withminiphoto">
                           <if test="haslastupdated:|:is_array( $lastUpdatedVideos ) && count( $lastUpdatedVideos )">
           			<foreach loop="video_row:$lastUpdatedVideos as $r">
           				<li class='clearfix'>

                                                <if test="showThumbnail:|:$this->settings['vs_enable_thumbnail']">
                                                     <span class='left' style='margin-right: 5px;'>      
                                                          {parse template="videoThumbnail" group="videos" params="$r, 'small'"}
                                                     </span>
                                                </if>

                                                <a href='{parse url="do=view&id={$r['tid']}" seotitle="{$r['seo_title']}" template="video_view" base="publicWithApp"}'><h4>{IPSText::truncate( $r['title'], $this->settings['vs_name_character_limit'] )}</h4></a> 
           					<div class="list_content"> 

           						<p class="desc ipsType_smaller">
           							<if test="videoAuthor:|:$r['member']['member_id']">{IPSMember::makeProfileLink( IPSMember::makeNameFormatted( $r['member']['members_display_name'], $r['member']['member_group_id'] ), $r['member']['member_id'], $r['member']['members_seo_name'] )}<else />{$this->lang->words['guest']}</if>
           							- {parse date="$r['last_updated']" format="date"}
           						</p>
           					</div>
           				</li>
           			</foreach>
                            <else />
                                   <li><i>{$this->lang->words['no_latest_videos']}</i></li>
                            </if>
           	</ul>
           </div>
       </if>

       <if test="hideTopRated:|:!in_array( "top_rated", explode( ",", $this->settings['vs_disabled_portal_blocks'] ) )"> 
           <div class="ipsSideBlock">
           	<h3><a href="{parse url="app=videos&do=list_all&sort_by=video_rating&sort_order=desc" seotitle="false" template="video_list_all" base="public"}" class='right desc'>({$this->lang->words['view_more']})</a> {$this->lang->words['top_rated']}</h3>
           	<ul class="ipsList_withminiphoto">
                            <if test="hastoprated:|:is_array( $topRatedVideos ) && count( $topRatedVideos )">
           			<foreach loop="comment_row:$topRatedVideos as $r">
           				<li class='clearfix'>

                                                <if test="showThumbnail:|:$this->settings['vs_enable_thumbnail']">
                                                     <span class='left' style='margin-right: 5px;'>      
                                                          {parse template="videoThumbnail" group="videos" params="$r, 'small'"}
                                                     </span>
                                                </if>

                                                <a href='{parse url="do=view&id={$r['tid']}" seotitle="{$r['seo_title']}" template="video_view" base="publicWithApp"}'><h4>{IPSText::truncate( $r['title'], $this->settings['vs_name_character_limit'] )}</h4></a>  <if test="videoRating:|:$r['video_rating'] > 1">{parse template="topic_rating_image" group="forum" params="$r['video_rating']"}</if>
           					<div class="list_content"> 

           						<p class="desc ipsType_smaller">
           							<if test="videoAuthor:|:$r['member']['member_id']">{IPSMember::makeProfileLink( IPSMember::makeNameFormatted( $r['member']['members_display_name'], $r['member']['member_group_id'] ), $r['member']['member_id'], $r['member']['members_seo_name'] )}<else />{$this->lang->words['guest']}</if>
           							- {parse date="$r['date']" format="date"}
           						</p>
           					</div>
           				</li>
           			</foreach>
                            <else />
                                   <li><i>{$this->lang->words['no_latest_videos']}</i></li>
                            </if>
           	</ul>
            </div> 
        </if> 
   </div>    
</div>

 

Я не спец в программировании, просматривая код, не нашел чего то похожего на авторов.

lastUpdatedVideos там и все. Если это втыкать в шаблон хука, пишет что видео нет вообще. Где то там концы теряются X_X

Edited by kanv1s

Share this post


Link to post
Share on other sites
Каким образом их туда добавить?

admin/applications_addon/other/videos/sources/hooks.php

		$this->DB->build( array( 'select' => "tid, date, title, last_updated, views, seo_title, thumbnail, thumbnail_type",

заменить на

		$this->DB->build( array( 'select' => "tid, date, title, last_updated, views, seo_title, thumbnail, thumbnail_type, author_id",

Найти

			$videos[] = $r;

Выше добавить

			$r['member'] = IPSMember::buildDisplayData($r['author_id']);

  • Upvote 1

Share this post


Link to post
Share on other sites

Вот оно значит как делается.

Помогло, спасибо большое.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...