Jump to content

Recommended Posts

Posted

In KVS list_videos and list_albums blocks won't select categories, tags, models, user or content source information by default for each video / album. This is due to performance restrictions, since in most cases such data is not needed when rendering lists. However when needed it can be enabled and displayed.

Each list_videos / list_albums (and some other list_xxx) block supports a set of show_xxx_info parameters to enable selecting any specific additional data you need:

show_xxx_info.thumb.png.f9ce168582adb67f2102860d52a925ba.png

You should enable only the needed data loading, as it may significantly reduce your site performance.

An issue here is that usually project contains multiple pages with list_videos / list_albums blocks. If you want this functionality to work consistently, you should enable the same options in almost all places. The most easy way to find pages with specific blocks is to search for block type, for example list_videos:

search_for_list_videos.png.154eb0d16e31543930de0237696f7794.png

You can see a plenty of list_videos blocks in your theme (Index, Common Videos List, Community, RSS, Sitemap, View Video pages and etc).

Here are 3 places where you DON'T need this:

  • RSS Videos (XML)
  • [System] Sitemap (XML)
  • [System] Player Related Videos

In all other blocks you may need to enable the same set of options to load additional data. Or if you want this to be visible on specific pages only (e.g. Index), then enable only there.

The next step is to update template code to render additional data for each video. This code should be normally put into Website UI -> Page Components -> include_list_videos_block_common.tpl, which renders all video lists in your theme. This component will have some template code on top with rendering list title / sortings / filters, and then 2nd part is the actual list rendering enclosed into the following {{foreach}} tag:

{{foreach item="item" from=$data}}
... each iteration renders one item here ...
{{/foreach}}

You should put your rendering code inside this {{foreach}} if you want it to be rendered for every item.

Here are ready codes you can copy-paste. However you should consider your own styling for this, as rendering such additional info is not supported by theme styling.

NOTE: for categories, tags and models if you want to limit the max number of displayed items you should set this limit into {{assign var="max_limit" value="0"}} value. Using zero means no limit, e.g. the code will display even 10 or 20 tags if they are all attached to a video or album.

 

1. Categories:

Categories:
{{assign var="max_limit" value="0"}}
{{assign var="index_limit" value="0"}}
{{assign var="limit_over" value="0"}}
{{foreach from=$item.categories item="category" name="categories"}}
   {{if $max_limit>0}}
       {{assign var="index_limit" value=$index_limit+1}}
   {{/if}}
   {{if $index_limit<=$max_limit}}
       <a href="{{$lang.urls.videos_by_category|replace:"%DIR%":$category.dir|replace:"%ID%":$category.category_id}}">{{$category.title}}</a>{{if !$smarty.foreach.categories.last}}, {{/if}}
   {{elseif $limit_over==0}}
       ...
       {{assign var="limit_over" value="1"}}
   {{/if}}
{{/foreach}}

 

2. Tags:

Tags:
{{assign var="max_limit" value="0"}}
{{assign var="index_limit" value="0"}}
{{assign var="limit_over" value="0"}}
{{foreach from=$item.tags item="tag" name="tags"}}
   {{if $max_limit>0}}
       {{assign var="index_limit" value=$index_limit+1}}
   {{/if}}
   {{if $index_limit<=$max_limit}}
       <a href="{{$lang.urls.videos_by_tag|replace:"%DIR%":$tag.tag_dir|replace:"%ID%":$tag.tag_id}}">{{$tag.tag}}</a>{{if !$smarty.foreach.tags.last}}, {{/if}}
   {{elseif $limit_over==0}}
       ...
       {{assign var="limit_over" value="1"}}
   {{/if}}
{{/foreach}}

 

3. Models:

Models:
{{assign var="max_limit" value="0"}}
{{assign var="index_limit" value="0"}}
{{assign var="limit_over" value="0"}}
{{foreach from=$item.models item="model" name="models"}}
   {{if $max_limit>0}}
       {{assign var="index_limit" value=$index_limit+1}}
   {{/if}}
   {{if $index_limit<=$max_limit}}
       <a href="{{$lang.urls.videos_by_model|replace:"%DIR%":$model.dir|replace:"%ID%":$model.model_id}}">{{$model.title}}</a>{{if !$smarty.foreach.models.last}}, {{/if}}
   {{elseif $limit_over==0}}
       ...
       {{assign var="limit_over" value="1"}}
   {{/if}}
{{/foreach}}

 

4. Content source:

Sponsor:
{{if $item.content_source.content_source_id>0}}
   <a href="{{$lang.urls.videos_by_sponsor|replace:"%DIR%":$item.content_source.dir|replace:"%ID%":$item.content_source.content_source_id}}">{{$item.content_source.title}}</a>
{{/if}}

 

5. Channel:

Channel:
{{if $item.dvd.dvd_id>0}}
   <a href="{{$lang.urls.videos_by_channel|replace:"%DIR%":$item.dvd.dir|replace:"%ID%":$item.dvd.dvd_id}}">{{$item.dvd.title}}</a>
{{/if}}

 

6. User:

Uploaded by:
{{if $item.user.user_id>0}}
   <a href="{{$lang.urls.memberzone_profile|replace:"%ID%":$item.user.user_id|replace:"%LOGIN%":$item.user.username}}">
       {{if $item.user.avatar}}<img src="{{$config.content_url_avatars}}/{{$item.user.avatar}}" alt="{{$item.user.username}}">{{/if}}
       {{if $lang.memberzone.truncate_username_to>0}}
           {{$item.user.display_name|truncate:$lang.memberzone.truncate_username_to:"...":true}}
       {{else}}
           {{$item.user.display_name}}
       {{/if}}
   </a>
{{/if}}
 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...