1. REGISTRATION REQUIREMENTS:

    Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Resolved ErrorException: Template error

Discussion in 'Showcase Support' started by NinaMcI, Oct 28, 2020.

  1. NinaMcI

    NinaMcI Member Showcase

    I recently upgraded to SC v3.2.0 on my xf v2.2.1 and I've been getting lots of errors outlined below.

    Code:
    Server error log
    ErrorException: Template error: Macro public:xa_sc_attachment_macros:attachment_list_item is unknown src/XF/Template/Templater.php:632
    Generated by: Unknown account Oct 28, 2020 at 1:10 PM
    Stack trace
    #0 [internal function]: XF\Template\Templater->handleTemplateError(512, 'Macro public:xa...', '/var/www/vhosts...', 632, Array)
    #1 src/XF/Template/Templater.php(632): trigger_error('Macro public:xa...', 512)
    #2 src/XF/Template/Templater.php(745): XF\Template\Templater->getTemplateMacro('public', 'xa_sc_attachmen...', 'attachment_list...')
    #3 internal_data/code_cache/templates/l1/s2/public/xa_sc_item_view.php(424): XF\Template\Templater->callMacro('xa_sc_attachmen...', 'attachment_list...', Array, Array)
    #4 src/XF/Template/Templater.php(1609): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, NULL)
    #5 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('xa_sc_item_view', Array)
    #6 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
    #7 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Html->renderView('XenAddons\\Showc...', 'public:xa_sc_it...', Array)
    #8 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
    #9 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
    #10 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
    #11 src/XF/App.php(2300): XF\Mvc\Dispatcher->run()
    #12 src/XF.php(465): XF\App->run()
    #13 index.php(20): XF::runApp('XF\\Pub\\App')
    #14 {main}
    Any ideas what might be causing these errors?
     
  2. Bob

    Bob Developer Staff Member

    Most likely an outdated template as the template 'xa_sc_attachment_macros' was removed (as I use the Core XF attachment_macros template now). I had used a custom version of the core xf attachment_macros template for several years, however, with all of the constant changes that XF keeps making to attachments, I decided it was best to just go with the flow and use the core xf attachment macro instead of having to push out releases every time they made a change).

    Anyway.. do a search on templates for the term 'xa_sc_attachment_macros'. If you find that, just remove 'xa_sc_' and it should be fine.
     
  3. NinaMcI

    NinaMcI Member Showcase

    Thank you Bob. That seems to have done the trick :)

    I also noticed these custom changes in the template:
    Code:
    Custom changes: xa_sc_item_view
    <xf:title page="{$page}">{{ prefix('sc_item', $item, 'escaped') }}{$item.title}</xf:title>
    <xf:title>{{ prefix('sc_item', $item, 'escaped') }}{$item.title}</xf:title>
    
    <xf:if is="$item.description">
        <xf:set var="$descSnippet" value="{{ snippet($item.description, 250, {'stripBbCode': true}) }}" />
    <xf:else />
        <xf:set var="$descSnippet" value="{{ snippet($item.message, 250, {'stripBbCode': true}) }}" />
    </xf:if>
    
    <xf:macro template="metadata_macros" name="metadata"
        arg-description="{$descSnippet}"
        arg-type="article"
        arg-shareUrl="{{ link('canonical:showcase', $item) }}"
        arg-canonicalUrl="{{ link('canonical:showcase', $item, {'page': $page > 1 ? $page : null}) }}"
        arg-canonicalUrl="{{ link('canonical:showcase', $item) }}"
        arg-imageUrl="{{ $item.CoverImage ? link('canonical:showcase/cover-image', $item) : ($item.Category.content_image ? base_url('styles/default/xenaddons/showcase/category_images/' . {$item.Category.content_image}, true) : '') }}"
        arg-twitterCard="summary_large_image" />
    Should I change anything here?
     
    Bob likes this.
  4. Bob

    Bob Developer Staff Member

    Definitely should only be using one TITLE tag.. I'd suggest using this one as it contains the PAGE attribute, which is important for SEO purposes.

    HTML:
    <xf:title page="{$page}">{{ prefix('sc_item', $item, 'escaped') }}{$item.title}</xf:title>

    Also, in the meta data macro, use the first canonicalUrl and remove the 2nd one. Its important to have the PAGE attribute for SEO purposes.

    HTML:
    arg-canonicalUrl="{{ link('canonical:showcase', $item, {'page': $page > 1 ? $page : null}) }}" 
     
  5. NinaMcI

    NinaMcI Member Showcase

    All done. Thanks :)
     
    Bob likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.