Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8998841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:05:30+00:00 2026-06-16T00:05:30+00:00

I have a snippet which gets document IDs from the DB. I want to

  • 0

I have a snippet which gets document IDs from the DB.

I want to out put these in a menu with Wayfinder but am having trouble getting it to work. Does anyone know the correct way of placing a PHP var within Wayfinder? Tried this but no luck:

echo '[[Wayfinder? &includeDocs=`' . $docid . '`]]';

(PS: using Revo)

EDIT: Added more code

In a nut shell, my code gets a logged in users id from sessions and finds thier access group. Ultimate goal is to display links to resources that are within their access group. This is the later part of the snippet where I have got the appropriate resource IDs and just need to out put them.

//RETRIEVE DOCUMENT GROUPS RELATED TO ACCESS GROUPS
          $docgroups = "SELECT * FROM `modx_document_groups` WHERE `document_group` = '$target' ";

          $docstmt = $modx->query($docgroups );              

          while ($docrow = $docstmt->fetch(PDO::FETCH_ASSOC)) {
          $docid = $docrow['document'];            

          echo '[[Wayfinder? &startId=`0` &includeDocs=`' . $docid . '`]]';

          }//END
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:05:31+00:00Added an answer on June 16, 2026 at 12:05 am

    In modx, your snippets must return a value to access it in chunks/templates etc. This is one way:

    //MySnippet
    <?php
    // logic
    $docIDs = array(1, 2, 23, 17);
    return implode(',', $docIDs);
    

    and then your wayfinder call uses the snippet:

     // wayfinder call
    [[!Wayfinder? &includeDocs=`[[!MySnippet]]`]]
    
    // is the same as:
    [[!Wayfinder? &includeDocs=`1,2,23,17`]]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following very simple code snippet which is loaded from a separate
i have the following code snippet. in which i just want to return PartyName
In my project, I have created a code snippet which can be copied and
I have below snippet of code in which TestClass is extending jPanel which is
I have the following snippet in my pom.xml (Full pom attached below which can
i have the following code snippet in my ANT File which compiles my project
In my django app, I have a view which accomplishes file upload.The core snippet
In a Windows Form Application, I have a ComboBox1 which gets initialized in InitializeComponent()
I have a surface view class which draws my bitmaps, and I am having
I have the below snippet which is a hotspot in an application. The for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.