• 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
    • Task
    • Documentation on how to query existing wiki pages

    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: Documentation on how to query existing wiki pages

    • Issue Tools
      • View Changes
    1. issueid=6403 November 7, 2023 7:22 AM
      mazzly mazzly is offline
      Junior Member
      Documentation on how to query existing wiki pages

      Hi,

      As part of our Calendar add-on, we would want to be able to "link" calendar events to an actual wiki page (or category)

      XF has the nice <xf:tokeninputrow> (used for e.g. tagging) and we would need to be able to return a list of potential wiki pages matching a query param.

      I've had a look at the various tables in VW, and I'm not 100% sure what we should really query for to get real existing pages (including category pages)

      Is there some documentation on this?


      We also have some ideas to make an "event widget" that will render on the wiki pages (provided events exist for the page), so what would be the best identifier to store in our events to tie them to a wiki page, and allow easy reverse-querying once we create that widget?

      Cheers
      //Jonathan
    Issue Details
    Issue Number 6403
    Issue Type Task
    Project VaultWiki 4.x Series
    Category Documentation
    Status Requested
    Priority 6 - Dev-Related Tasks
    Target Version Unknown
    Resolved Version (none)
    Milestone (none)
    Software DependencyAny
    License TypePaid
    Votes to perform 0
    Votes not to perform 0
    Attachments 0
    Assigned Users (none)
    Tags (none)




    1. November 11, 2023 3:57 PM
      pegasus pegasus is offline
      VaultWiki Team
      If you are "linking" in the database using the pageid (vw_page.pageid), then you can fetch the page using:
      Code:
      $page = \vw_Hard_Core::controller('Fetch')->get('Page', $pageid);
      If you are looking up pages via arbitrary criteria, you should invoke XenForo's search logic and filter results to vwpage results only.
      If you are looking up pages via name, you can query against vw_route.itemkey
      Itemkeys are formatted using:
      Code:
      \vw_Hard_Core::model('Encode')->encode(\vw_Hard_Core::model('String')->tolower($title));
      When querying vw_route, filter itemtypeid on
      Code:
      \vw_Hard_Core::model('Node')->id('Page')
      Then the result itemid field will be pageids you can use as mentioned above.

      As for how you are doing the calendar-to-page linking from an experience perspective...
      a. A calendar event automatically has a new page created (then it's easy to get and store the pageid)
      b. use a chooser widget to pick the wiki page that gets linked. Probably the easiest/most drop-in way is to use the "Integration" system, which would require:
      - creating a vw_node record for your content-type
      - creating a /src/addons/vw/vw/_core/model/node/ class for that content-type establishing its flags
      - creating a custom integration position (such as 'main:event') and calling that position in a template like
      Code:
      {{ vw_integrate('main:event', $eventDataArray) }}
      $eventDataArray should be your $eventEntity->toArray();
      Please see how src/addons/vw/vw/XF/Entity/Thread.php does getItemid, getItemtypeid, toArray, and getStructure, for help getting an array that will work properly with the integration system.
      Due to the way XenForo's templater works, I strongly recommend keeping your VaultWiki-related template code in a separate template and only including it if VaultWiki is enabled (easy way is check if the main class exists):
      Code:
      if (class_exists('vw_Hard_Core', false)
      Reply Reply  
    2. November 15, 2023 9:11 AM
      mazzly mazzly is offline
      Junior Member
      Okay, then if I have a `itemkey`-value saved, what is the best way to get the "Page title" for that itemkey?
      Reply Reply  
    3. November 17, 2023 9:28 AM
      pegasus pegasus is offline
      VaultWiki Team
      If you have the itemkey, you could use the wiki router:
      Code:
      $router = null;
      \vw_Hard_Core::controller('Route')->resolve_title($router, $itemkey);
      // if the page has a prefix, you need to supply the prefixkey as a third argument
      
      if ($router->id AND $router->type == 'Page')
      {
      $pageid = $router->id;
      $page = \vw_Hard_core::controller('Fetch')->get('Page', $pageid);
      $title = $page['title'];
      }
      I do not recommend storing a connection between things using only the itemkey. It is better only for lookups. If a user renames the page, then the itemkey will change and your connection will break. It is better to use the itemkey to lookup the pageid, and store the pageid instead.
      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 12:35 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.