We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40447
    • 165 Posts
    Hi, I'm using Evo 106.
    I'm making a simple newsticker that scrolls text vertically on a clients website.
    I want to separate the newsticker html, js and css code from the text.
    How can I make a resource where the owner of the website can edit and update
    the text but doesn't see any of the newsticker code.
    The resource holding the text should only have the following html tags <p> <h> and br and maybe the ul and li tags that format the text in a list.
    How can I pull only the text from this resource into the backend resource where all the newsticker code resides to make the text scrolling ?

    This question has been answered by sottwell. See the first response.

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I would use a custom TV (or Jot) for this. All he needs to do is enter each item, and your output snippet's tpl would take care of the structure of the output.
        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
        • 40447
        • 165 Posts
        Thanks Susan for this idea.
        Use a parameter &tpl=`chunkName` that holds the output html.
        But does a snippet access the contents of a template variable by using the name of the template variable as a parameter for the snippet, or do I have to use the api getTemplateVarOutput ?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          If you are writing the snippet, then you would need to get the TV value. If the snippet is looping through a list of items in a custom TV, then it needs to put the value into a placeholder and use a chunk tpl to apply to each item, just like Wayfinder or Ditto does.
            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
            • 40447
            • 165 Posts
            Oh Boy, to get this to work, I know I have to dive into php and learn to do stuff like this:
            $content = file_get_contents( );
            //iterate over items
            foreach($variable->item as $entry){
            do this and that;
             }
            return $output;
            //limit the loop
            if (i < 'some limit') {
                  //do something 
                      }
            $i++

            Which makes me wonder now, besides template variables, it should be possible to pull the [*content*] from any resource page, filter out the part of the [*content*] you want and bring it into the backend. [ed. note: sitecms last edited this post 13 years, 8 months ago.]
            • discuss.answer
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Try the getField snippet. http://modx.com/extras/package/getfield
                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
                • 40447
                • 165 Posts
                Try the getField snippet.
                Didn't know that one existed huh That's exactly what I'm looking for.
                On top of that, it's great for me studying it's php, learn and extend from there.
                Thanks. [ed. note: sitecms last edited this post 13 years, 8 months ago.]
                  • 40447
                  • 165 Posts
                  Confirmed! This morning I have the getField Snippet working in modx 1.0.6.
                  Author: Grzegorz Adamiak Version: 1.3 beta @2006-11-08 14:40:04

                  I can successfully pull any content from any resource page, and make it appear in any other resource page. I am aware that for most of you Modx'ers this is oldschool stuff and probably are using getResourceField or getResources in Revo. But I am really excited to see this working in Evo.
                  Now, with the help of a sorting php script, imagine the possibilities here. The client can edit simply on a single page: text, prices, pictures, etc. All I have to work on now is to make a php script that will separate and sort text, prices, pictures and put them in placeholders. The client resource page can even hold explaining text for the client that will be left alone by the php sorting script. Maybe I might beat Revo with such a sorting php script laugh Or what about this as a feature in Modx3 ?
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    Add this to QuickManager+ and its custom menus, and some clever manipulation of ManagerManager and you can have a serious front-end management feature that your client will love.

                    In Revo, you can use the MIGx TV, which I cannot imagine not using as a major feature of any site. Evo was just developing its own custom multi-item TV over the last couple of years, so I'm sure you could figure out the same concept by building your own custom TV and output snippet combination.
                      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
                      • 40447
                      • 165 Posts
                      Add this to QuickManager+ and its custom menus;
                      Building your own custom TV and output snippet combination;
                      Ah, yes, thanks Susan for connecting the dots here, otherwise I would have focused only on a php sorting script.