XF 2.1 XFMG open external url in new tab

TPerry

Well-known member
OK, researching I found where (back in 2020) @Mike advised to edit the xfrm_resource_view template with code that should allow the button to an external link in the Resource Manager to open in a new tab for the support/additional info links.

Now, the question is does anyone know where to do for the actual button for the resource URL (download or buy now)?
I see that external URL's open in a new tab from the RM here... was that something that changed? I realize that I'm running an older version..
 
Last edited:
This is the way it normally goes... spend hours looking.... walk away to take a break and come back and figure it out.

For anyone that needs to do this, the template is xfrm_resource_wrapper_macros
and the code segment to change begins at line 30
Code:
                            <xf:if is="$resource.canDownload()">
                                <xf:if is="$resource.isExternalDownload()">
                                    <xf:button href="{{ link('resources/download', $resource) }}" target="_blank"
                                        data-xf-init="tooltip"
                                        class="button--cta"
                                        title="{{ $resource.CurrentVersion.getExternalDownloadDomain() }}"
                                        icon="redirect">{{ phrase('xfrm_go_to_download') }}</xf:button>
                                <xf:else />
                                    <xf:button href="{{ link('resources/download', $resource) }}" target="_blank"
                                        class="button--cta"
                                        data-xf-click="{{ $resource.CurrentVersion.file_count > 1 ? 'overlay' : '' }}"
                                        icon="download">{{ phrase('download') }}</xf:button>
                                </xf:if>
                            <xf:else />
                                <span class="button is-disabled">{{ phrase('xfrm_no_permission_to_download') }}</span>
                            </xf:if>
                        </div>
                    <xf:elseif is="$resource.isExternalPurchasable()" />
                        <div class="p-title-pageAction">
                            <xf:if is="$resource.canDownload()">
                                <xf:button href="{$resource.external_purchase_url}" target="_blank" class="button--cta" icon="purchase">{{ phrase('xfrm_buy_for_x', {'price': $resource.price|currency($resource.currency)}) }}</xf:button>
                            <xf:else />

You are simply adding the target="_blank" into the template.
 
Back
Top Bottom