• Register
    • Help

    striker  0 Items
    Currently Supporting
    • Home
    • News
    • Forum
    • Wiki
    • Support
      • Manage Subscriptions
      • FAQ
      • Support For
        • VaultWiki 4.x Series
        • VaultWiki.org Site
    • What's New?
    • Buy Now
    • Manual
    • 
    • Support
    • VaultWiki 4.x Series
    • Bug
    • Images in templates

    1. Welcome to VaultWiki.org, home of the wiki add-on for vBulletin and XenForo!

      VaultWiki allows your existing forum users to collaborate on creating and managing a site's content pages. VaultWiki is a fully-featured and fully-supported wiki solution for vBulletin and XenForo.

      The VaultWiki Team encourages you to join our community of forum administrators and check out VaultWiki for yourself.

    Issue: Images in templates

    • Issue Tools
      • View Changes
    1. issueid=5383 March 12, 2018 4:04 PM
      expanserpb expanserpb is offline
      Junior Member
      Images in templates

      Trying to set up a variable for an image in a template:

      Code:
      [float_right][table] cellpadding="4"; style="background: #{{{Primary|3e3957}}}; border: 0px"
      |-
      | colspan="2" style="border-top: 2px solid #C1CDCD; border-bottom: 2px solid #C1CDCD; text-align:center" | [IMG]{{{avatar|https://www.theexpanse-rp.com/styles/tactical/xenforo/avatars/avatar_s.png}}}[/img]
      |-
      This doesn't seem to work. Ideas?
    Issue Details
    Issue Number 5383
    Issue Type Bug
    Project VaultWiki 4.x Series
    Category BB-Code Parsing
    Status Fixed
    Priority 3 - Loss of Functionality
    Affected Version 4.0.21
    Fixed Version 4.0.22
    Milestone (none)
    Software DependencyXenForo 1.x
    License TypePaid
    Users able to reproduce bug 0
    Users unable to reproduce bug 0
    Attachments 0
    Assigned Users (none)
    Tags (none)




    1. March 12, 2018 6:07 PM
      pegasus pegasus is offline
      VaultWiki Team
      Even though I haven't seen your template usage or the resulting output, I would expect it to work as entered. Please describe what doesn't work about it.

      Does the template produce no output at all? In this case, there might be a violation of the template sandbox security model (probably due to conflicts in add-ons or other PHP code, which needs to be investigated).
      Does the template output as raw code when used? In this case, maybe BB-Codes or images are disabled by the wiki-area settings of the area where the template lives.
      Does the template output as raw code when visiting the template itself? This is the expected behavior.
      Reply Reply  
    2. March 13, 2018 2:55 AM
      expanserpb expanserpb is offline
      Junior Member
      If I take the template code and use directly the image appears in the top row.

      If I use the template then nothing appears in the top row at all.

      Would you like me to repeat in your xenforo demo?

      It's a fairly common requirement for things like character infoboxes.
      Reply Reply  
    3. March 13, 2018 10:12 AM
      pegasus pegasus is offline
      VaultWiki Team
      I was able to reproduce a similar issue on the XenForo demo. The first line was rendering/appearing, but the image URL had some garbage characters in it, so the image showed as a big red X.

      In library/vw/XenForo/BbCode/Formatter.php, find:
      Code:
      return parent::renderValidTag($tagInfo, $tag, $rendererStates);
      Replace with:
      Code:
      		if ($this->vwParserEntry)
      		{
      			$this->_vwFromWikiTag = array(
      				'tag' => $tag['tag']
      			);
      		}
      
      		$retval = parent::renderValidTag($tagInfo, $tag, $rendererStates);
      		$this->_vwFromWikiTag = false;
      
      		return $retval;
      Find:
      Code:
      $compileTags = $this->parser->get('_vwCompileTags');
      Replace with:
      Code:
      $compileTags = $this->parser->get('_vwTemplateTags');
      This change corrected the issue as it was occurring for me. Example here: https://www.vaultwiki.org/xf-wiki/in...dered-Template

      You should also make sure that the page where you use the template has "Automatically parse links in text" NOT checked; or you could end up with something like:
      Code:
      [img][url]avatar-url[/url][/img]
      which will probably not work.
      If you must use that checkbox for some reason, or if the checkbox is missing, you must wrap the URL in PLAIN tags. This is only necessary when passing in a fully-qualified URL in order to workaround XenForo's automatic link parsing behavior. Alternatively, if you construct your template to handle partial/relative URLs (such as if all images are located in the same folder), then it will probably not trigger automatic link parsing.
      Reply Reply  
    4. March 14, 2018 6:09 PM
      expanserpb expanserpb is offline
      Junior Member
      You hero! Cheers

      Added fixed widths, some if statements for optional fields and I'm very happy

      https://www.theexpanse-rp.com/wiki/T...-Infobox-Usage
      Reply Reply  
    + Reply

    Assigned Users
    Loading Please Wait
    Tags
    Loading Please Wait
    • Contact Us
    • License Agreement
    • Privacy
    • Terms
    • Top
    All times are GMT -4. The time now is 3:54 PM.
    This site uses cookies to help personalize content, to 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.
    Learn more… Accept Remind me later
  • striker
    Powered by vBulletin® Version 4.2.5 Beta 2
    Copyright © 2025 vBulletin Solutions Inc. All rights reserved.
    Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
    Copyright © 2008 - 2024 VaultWiki Team, Cracked Egg Studios, LLC.