Widget

mms

Проверенные
Сообщения
882
Реакции
718
Баллы
11,125
Последнее редактирование:
Можно.

The XenForo Media Gallery media block can be added to the standard forum sidebar in XenForo as well as the sidebars and portal pages of CTA Featured Threads & Portal, Widget Framework and XenPorta 1.


Code
First, you will need the following media block code from Chris (wrapped in a div for styling):
Код:
<div class="section">
<xen:include template="xengallery_media_block"> 
<xen:set var="$blockPhrase">{xen:phrase xengallery_new_media}</xen:set> // Use either {xen:phrase xengallery_new_media}, {xen:phrase xengallery_random_media} or your own custom title 
<xen:set var="$blockId">XFMGMediaForumListSidebar</xen:set> // This can be changed but must be something unique. 
<xen:set var="$type">new</xen:set> // You can set this to 'rand' for a random selection. 
<xen:set var="$items">2</xen:set> // Any number. Number of images that are visible in the slider. 
<xen:set var="$limit">20</xen:set> // Any number. Number of images to be loaded (not all are visible). 
<xen:set var="$slideWidth">160</xen:set> // This is the width of each slide in the slider. The slides may not be exactly this width due to responsive design resizing them dynamically. 
<xen:set var="$categories">all</xen:set> // Use a comma separated list to display images from selected categories e.g. 2,3,5,7. Set to 'all' to include all categories, 0 to exclude 
<xen:set var="$albums">1</xen:set> // Set to 1 to include images from albums, 0 to exclude 
<xen:set var="$isSidebarBlock">1</xen:set> // Sets the styling so it will look like a sidebar block 
<xen:set var="$captions">1</xen:set> // Set to 1 to show captions on hover, set to 0 to always hide. 
<xen:set var="$noResponsive">1</xen:set> // Set to 0 for responsive, 1 for fixed. Responsive will show more images at a smaller size at narrower browser widths, fixed will keep the number of images set in $items at the same size whatever the browser width. 
</xen:include> 
</div>

You will need to change the values of the variables in this code to suit your own needs.

Second, you will need to follow the instructions below that are relevant to where you are adding the media block.




Standard Forum Sidebar
In XenForo Media Gallery 1.01 and above you can show a new/random media block in the sidebar simply by enabling it in ACP > Applications > Gallery Options > Blocks Options

For earlier versions, the media block can be added as follows:
1. ACP > Appearance > Templates
Find the forum_list template and click on it to open it

2. Find
Код:
<xen:edithint template="sidebar.css" />
Immediately after this, paste in the media block code

Note: This will position the block at the top of the sidebar above the Staff and Members Online blocks. By pasting the media block code elsewhere in the forum_list template you can change the position of where the block will display.

3. Edit the media block code and change the values of the variables to suit your own needs

Once you save this, the media block will be displayed.



CTA Featured Threads
The following will display the media block on the CTA Featured Threads page and on the portal page if that is enabled.

Sidebar
1. Ensure that you have the CTA Featured Threads Sidebar and the Sidebar Custom Template enabled
ACP > Style Properties > CTA Featured Threads Page
Tick the options Enable Sidebar and Enable Sidebar Custom Template
You may also want to enable some of the additional blocks - tick the relevant options on this page

2. ACP > Appearance > Templates
Find the cta_featuredthreads_featured_custom_sidebar template and click on it to open it

3. Paste in the media block code

Note: This will position the block at the top of the sidebar

4. Edit the media block code and change the values of the variables to suit your own needs

Once you save this, the media block will be displayed.

Featured Threads/Portal Page
The media block can be placed at the top of the bottom of the page.

1. ACP > Appearance > Templates
To place at the top, find the cta_featuredthreads_featured_custom_top template and click on it to open it. To place at the bottom, open the cta_featuredthreads_featured_custom_bottom template

2. Paste in the media block code

3. Edit the media block code and change the values of the variables to suit your own needs

Once you save this, the media block will be displayed.



Widget Framework
1. ACP > Appearance > Templates
Create a new template (I called mine xengallery_media_block_sidebar but you can call it what you like) and paste in the media block code

2. Edit the media block code and change the values of the variables to suit your own needs

3. ACP > Appearance > Add widget
Set the following:
Renderer: [Advanced] Template (without wrapper)
Template:xengallery_media_block_sidebar (or whatever you called it)
Title: Can be left blank as the title is taken from the template. You may want to add one though to help you identify it in the widget list (e.g. XMG Media Block)
Position: Where you want to show the block e.g. forum_list
Display Order: Set as you require

Once you save this, the media block will be displayed.



XenPorta 1
1. ACP > XenPorta > Blocks
Click on Install Block
Choose an HTML block (e.g. RawHyperText2). You can find these in library/EWRporta/Block/XML/

2. Click on the HTML block to edit it and paste in the media block code

3. Edit the media block code and change the values of the variables to suit your own needs

4. Change any other settings as required in the block, then save it

5. ACP > XenPorta > Layouts
Click on each layout you want to add the HTML block to, then drag into position and save

Once you save this, the media block will be displayed.
 

Вложения

  • XenMediaGalleryWidget.zip
    1.6 KB · Просмотры: 8
Современный облачный хостинг провайдер | Aéza
Назад
Сверху Снизу