Resource Items

Use our Forums to find examples and answers to your questions. If you have advanced requirements for your project, contact us and our staff can help you find a solution.

hccdevelopment

Resource Items

The standard weblog entries tag, with a few new parameters, can be used to display Resources.

{exp:weblog:entries resource_permission="group|public" resource_action="view"

Parameters

resource_permission="private|group" 

Filter group results to show only certain permission levels:

  • all: Get all of the member's Resource Groups
  • public: Get all of the publicly available Resource Groups
  • group: Get all of the Resource Groups that are only allowed on the group level
  • private: Get only the Resource Groups the member owns
resource_group_id="1|2|3" 

Set this to the Resource Groups from which you want Resources.

resource_action="view" 

The Action being performed on the Resources:

  • view: This is for viewing and downloading the resource
  • change: This is when the user is going to edit the resource
resource_all_groups="yes" 

The member must be allowed to perform the action in all Resource Groups or at least one:

  • yes: The member has to be allowed in all Resource Groups in order to perform the action set
  • no: The member has to be allowed in at least one out of the defined Resource Groups
Variables

Note: The weblog:entries tag enhancements are included and can be used in this tag variable pair.

  • resource_id
  • resource_group_id
  • resource_filename
  • resource_file_extension
  • resource_type
  • resource_url
  • resource_member_id
  • resource_md5sum
  • resource_mime_macro
  • resource_size
  • resource_image_height
  • resource_image_width
  • resource_max_downloads
  • resource_auth_code
  • resource_auth_code_field
AJAX

In order to use the AJAX JavaScript to download Resources, set the CSS class to "resource_download_link" of the HTML "a" element

Example AJAX resource download links:

<a href="{resource_url}" class="resource_download_link">View</a

Benefits of using the AJAX download:

  • JavaScript error reporting and not Standard EE error reporting
  • Validation of the password entered for resource download
  • No pop ups or new windows created on click

Example

{exp:weblog:entries resource_action="view"}
{if resource_is_allowed}
    {if resource_is_file}
    
<a href="{resource_download_link}">Download</a>
    
{/if}
    {if resource_is_image}
    
<img src="{resource_image}" />
    
{/if}
    {if resource_is_url}
    
<a href="{resource_url}" class="resource_download_link">View</a>
    
{/if}
    {if resource_auth_code}
    {resource_auth_code_field}
    {
/if}
{
/if}
{
/exp:weblog:entries} 

As you can see, when using the standard weblog entries tag with additional parameters, it is possible to display all of the details for your resource files as well as control access and display them based on group and member settings.



Join our Mailing List