We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 43855
    • 8 Posts
    Hello,
    I need to create snipet to get TV's from table and show it in search suggest
    I have an example with parametr "title", but can't anderstand how to create with two TV's
    EXAMPLE

    <?php
    /* getPagetitles snippet
    use: [[getPagetitles? &parents=`parentsIDs`]] */
    if (!$parents) return;
    $res = $modx->getCollection('modResource',array('parent:IN' => explode(',', $parents)));
    $output = '';
    foreach ($res as $v) {
            $output.= '"'.$v->get('longtitle').'",';
    }; 
    $output = substr($output,0,-1);
    return $output; 
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You can't just use getResources (or pdoResources) with &includeTVs and &includeTVList?
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 43855
        • 8 Posts
        I am not shure about getResources.
        I have search form


        <form id="search-global-form" class="form-search" action="[[~[[+landing:default=`[[*id]]`]]]]" method="[[+method:default=`get`]]">
            
                <input type="text" class="input-big search-query" name="[[+searchIndex]]" id="[[+searchIndex]]" value="[[+searchValue]]" autocomplete="off" data-provide="typeahead"
                data-items="4" data-source='[ [[getPagetitles? &parents=`8,9`]] ]'/>
                <input type="hidden" name="id" value="[[+landing:default=[[*id]]]]" /> 
                <button type="submit" class="btn" value="">Search</button>
          
        </form>


        Search work with suggests like in Google, all suggest coming from Pagetitle, but i need to get this suggests from two TV's
        Here example for Snippet that gets pagetitles


        <?
        /* getPagetitles snippet
        use: [[getPagetitles? &parents=`parentsIDs`]] */
        if (!$parents) return;
        $res = $modx->getCollection('modResource',array('parent:IN' => explode(',', $parents)));
        $output = '';
        foreach ($res as $v) {
                $output.= '"'.$v->get('pagetitle').'",';
        }; 
        $output = substr($output,0,-1);
        return $output;





        Quote from: sottwell at Jul 25, 2013, 06:34 AM
        You can't just use getResources (or pdoResources) with &includeTVs and &includeTVList?