We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28870
    • 10 Posts
    I wrote a snippet which works fine on actual document/article pages, but it doesn’t work on the index page which lists all the articles in a certain category for the visitor. Here is my problem. On the article pages, I use:

    strlen($modx->documentObject[’TVname’][1]) to tell me how many elements are stored in the TV. When I call the snippet in the template for the listing page, I can’t get any values to return in each listing, even though calling the [+TVname+] in the template gives me the values stored in the TV.

    I think I could get around my problem if I could use something like strlen([+TVname+]) in the snippet instead of the documentObject call, but obviously that doesn’t work syntax-wise. Any ideas? Thanks!

      • 28870
      • 10 Posts
      Never mind--just figured out a solution. I introduced another variable, passed it, and took the strlen of that and now it works beautifully.