Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

Розширення / Спільноти та Соціум / Contributors

List contributers/posters for forum topics or comments.

#1. Features

  • List posters (contributors) in forum topics
  • List posters (contributors) for comments
  • Limit the number of contributors to display or not.

#2. Installation

  1. Download, extract and place the contributors folder in your plugin directory.
  2. Install and configure the plugin in Administration panel.
  3. Add the tags desired in comments.tpl or forums.posts.tpl

You can either list the contributors by using a resource list or template tags and block. A resource list is just a list of contributors based on a resource, separated by a separator configured in the administration panel.

#3. Examples

All of these examples can be used in comments.tpl and forums.posts.tpl.

#3.1. Display using template tags

Example 1: Display users using avatars only ( requires userimages plugin )

      

<!-- IF {PHP.contributors_count} > 0 -->
    <!-- BEGIN: CONTRIBUTOR_ROW -->
        <a title="{CONTRIBUTOR_NAME}" href="{CONTRIBUTOR_URL}">
        <!-- IF {CONTRIBUTOR_AVATAR_SRC} -->
            <img src="{CONTRIBUTOR_AVATAR_SRC}" style="width: 20px; vertical-align: middle; height: 20px;" />
        <!-- ELSE -->
            <img src="datas/defaultav/blank.png" style="width: 20px; vertical-align: middle; height: 20px;" />
        <!-- ENDIF -->
        </a>
    <!-- END: CONTRIBUTOR_ROW -->
<!-- ELSE -->
    There are currently no contributors.
<!-- ENDIF -->

Example 2: Display users using a link

    

<!-- IF {PHP.contributors_count} > 0 -->
    <strong>Contributors:</strong>
    <!-- BEGIN: CONTRIBUTOR_ROW -->
        <span style="padding: 4px 8px; border-radius: 4px; background-color: #ddd;">{CONTRIBUTOR_LINK}</span> &nbsp;
    <!-- END: CONTRIBUTOR_ROW -->
    <!-- IF {PHP.contributors_count_diff} > 0 -->
        and {PHP.contributors_count_diff} others.
    <!-- ENDIF -->
<!-- ELSE -->
    There are currently no contributors.
<!-- ENDIF -->

#3.2. Display using resource list

To override {PHP.contributor_list}, define $R['contributors_forums_list'] for forums posts and $R['contributors_comments_list'] for comments contributors in your theme's file.

Available parameters: {$id}, {$name}, {$link}, {$gender}, {$country}, {$countryflag}, {$url}, {$avatar}, {$avatar_src}

Example 1: Resource list display

    

<!-- IF {PHP.contributors_count} > 0 -->
    Contributors: {PHP.contributors_list}<!-- IF {PHP.contributors_count_diff} > 0 --> and {PHP.contributors_count_diff} others.<!-- ENDIF -->
<!-- ELSE -->
    There are currently no contributors.
<!-- ENDIF -->

#4. Available Template Variables

comments.tpl, forums.posts.tpl

  • {PHP.contributors_count}: Total number of contributors for the current item
  • {PHP.contributors_count_difference}: Number of contributors that became hidden due to limiting number of contributors set in the plugin's configurations.

#5. Available Tags

comments.tpl, forums.posts.tpl

In comments.tpl, the following must be inside COMMENTS block.

For forums.posts.tpl, the following must be inside MAIN block.

In block: CONTRIBUTOR_ROW

  • {CONTRIBUTOR_ID}
  • {CONTRIBUTOR_NAME}
  • {CONTRIBUTOR_LINK}
  • {CONTRIBUTOR_GENDER}
  • {CONTRIBUTOR_COUNTRY}
  • {CONTRIBUTOR_COUNTRYFLAG}
  • {CONTRIBUTOR_URL}

1. elfrenazo  26.10.2013 02:11

Thanks: 0

I'll try this, thanks!

Всього: 1, на сторінці: 1

Додавання комментарів доступно лише зареєстрованим користувачам