We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17282
    • 283 Posts
    trying to create a scrolling marquee widget based newslisting ..
    now this works in a javascript marquee i created myself .. but idealy id like it to work in the TV widget marquee

    what i have done is created a tv with the widget marquee, and then as the default content ive added [[scrollerlisting?startID=5&tpl=ScrollerListingTemplate&summarize=20]] (based on a new snippet and chunk ive set up.. its just news listing .. and does work on its own or in a jscript based marquee ive integrated into the template)

    why cant i call this inside the marquee widget tho? is there something im doing wrong?

    as an aside .. i cant call dropmenu inside a floater widget either .. something to do with snippets and the widgets?

    Many thanks

    Martyn
      Everytime you use Flash ... a puppy dies .....
      R.G Taylor
      • 32241
      • 1,495 Posts
      I never intensively use that widget capability.

      But here is a little logic behind it. When you pass on that snippet tag, it’s basically being processed as a standard string by TV, so basically it won’t do what you want it to do.

      The solution will be to use @BINDING, which you can find it in here http://modxcms.com/data-binding.html

      If you look into it, there is no @SNIPPET binding listed in there. So I’m not to for sure whether it’s supported or not, but another workaround will be to use @EVAL binding. The use of it to allow you run a php script inside MODx. Knowing that, you can use MODx API to call snippet.

      Heer is the API, param[’docId’]=12;
      $modx->runSnippet('snippet_name', $associative_array_params);


      here is an example of what to put on TV
      @EVAL params['docId']=12;
      params['tpl']='template1';
      $modx->runSnippet('Newslisting', $params);

        Wendy Novianto
        [font=Verdana]PT DJAMOER Technology Media
        [font=Verdana]Xituz Media
        • 17282
        • 283 Posts
        thank you !

        sadly im a php retard .. and what you just said made me melt smiley

        have you any fools instructions?

        but thnx smiley
          Everytime you use Flash ... a puppy dies .....
          R.G Taylor
          • 32241
          • 1,495 Posts
          Do this, create a new TV with textarea as the input field. Then put that thing in the default value or in the page TV value itself. That’s all wink If you want to pass a parameter like &truncate in newslisting snippet, just create a new array like the one shown below.

          @EVAL params['docId']=12;
          params['tpl']='template1';
          params['truncate']='1';
          $modx->runSnippet('Newslisting', $params);
          


          That’s all, it’s not as hard as you thought you need to go to coding.
            Wendy Novianto
            [font=Verdana]PT DJAMOER Technology Media
            [font=Verdana]Xituz Media
            • 17282
            • 283 Posts
            Quote from: Djamoer at Feb 17, 2006, 04:39 PM

            Do this, create a new TV with textarea as the input field. Then put that thing in the default value or in the page TV value itself. That’s all wink If you want to pass a parameter like &truncate in newslisting snippet, just create a new array like the one shown below.

            @EVAL params['docId']=12;
            params['tpl']='template1';
            params['truncate']='1';
            $modx->runSnippet('Newslisting', $params);
            


            That’s all, it’s not as hard as you thought you need to go to coding.


            you know i really cant get this to work!

            Ive tried just copying this in and changing the relevant doc id .. nothing!
            im currently trying to do it with dropmenu.. same .. nothing sad
              Everytime you use Flash ... a puppy dies .....
              R.G Taylor
              • 17282
              • 283 Posts
              in fact i get this :

              Parse error: parse error, unexpected ’[’ in /home2/bittersw/public_html/manager/includes/tmplvars.commands.inc.php(51) : eval()’d code</b> on line 1
                Everytime you use Flash ... a puppy dies .....
                R.G Taylor
                • 32241
                • 1,495 Posts
                loo, my bad again embarrassed

                @EVAL $params['docId']=12;
                $params['tpl']='template1';
                $params['truncate']='1';
                $modx->runSnippet('Newslisting', $params);
                


                Notice the $ sign for each array vars. It’s a typo, my bad undecided
                  Wendy Novianto
                  [font=Verdana]PT DJAMOER Technology Media
                  [font=Verdana]Xituz Media
                  • 17282
                  • 283 Posts
                  Quote from: Djamoer at Mar 07, 2006, 02:42 PM

                  loo, my bad again embarrassed

                  @EVAL $params['docId']=12;
                  $params['tpl']='template1';
                  $params['truncate']='1';
                  $modx->runSnippet('Newslisting', $params);
                  


                  Notice the $ sign for each array vars. It’s a typo, my bad undecided


                  ok so ..

                  from the top : what i should do is : create a TV called lets say : [*feature_scroller*]
                  in the TV i choose widget marquee and in teh default value i put :

                  @EVAL $params['docId']=12;
                  $params['tpl']='template1';
                  $params['truncate']='1';
                  $modx->runSnippet('Newslisting', $params);
                  


                  then call the TV in my template with [*feature_scroller*]

                  ......

                  ARGH! still doesnt work.. it works with just standard text .. but i cant gett the @eval text to work.

                  wierdness ....
                    Everytime you use Flash ... a puppy dies .....
                    R.G Taylor
                    • 32241
                    • 1,495 Posts
                    I think I already answer a similar problem to this question yesterday.

                    Anyway, I forgot to add return on that code as well.

                    You can either do this
                    @EVAL $params['docId']=12;
                    $params['tpl']='template1';
                    $params['truncate']='1';
                    return $modx->runSnippet('Newslisting', $params);
                    


                    or this
                    @EVAL return $modx->runSnippet('Newslisting', array('docid'=>12, 'tpl'=>'template', 'truncate'=>1));
                    


                    I haven’t tested the code, but it should work, as it’s being confirmed on the other thread.
                      Wendy Novianto
                      [font=Verdana]PT DJAMOER Technology Media
                      [font=Verdana]Xituz Media