We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24013
    • 7 Posts
    Is it possible to put any PHP code within the caption or description of a TV? I’ve tried @EVAL and also creating a snippet, but neither worked. Here’s what I’m trying to accomplish.

    There will be a container for event pages. These event pages will have various TVs. Some of them will contain a link in the description. This link is for administrator purposes only and will link to a page that will have a form going to a custom table for free comp registrations. These links are only emailed and cannot be displayed publicly, but it makes it easier for the administrator to get the correct link if it’s available from the main event page. I’m needing to pass the page id (event id) to the comp page in the form of /events/comp?id=23. The actual process of using that id shouldn’t be an issue, but I want to display all of the available links with the TVs.

    BTW, the TV’s purpose is to enable/disable the comp signup. It’s a listbox right now.

    Attached is a screenshot from the current CMS. Any ideas how this could be accomplished in Revo?
      44+ MODXed sites and counting...
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You cannot use PHP code in that way, but you might be able to put the PHP code in a snippet and use the snippet tag in the description, or perhaps another TV with @EVAL.
        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
        • 24013
        • 7 Posts
        Neither of those work. see attachment.

        I tried creating a custom TV from a duplicate of the listbox and any PHP in the template was turned into a comment.

        Any other ideas??
          44+ MODXed sites and counting...
          • 24013
          • 7 Posts
          I was able to get it by duplicating the listbox.php to use as a base for the custom TV.

          I just changed:
          return $this->xpdo->smarty->fetch('element/tv/renders/input/listbox-single.tpl');


          to

          $output = $this->xpdo->smarty->fetch('element/tv/renders/input/listbox-single-comp.tpl');
          $output .= "<a href='/nfl-events/eventcomp/?id=".$_GET['id']."' target='_blank'>/nfl-events/eventcomp/?id=".$_GET['id']."</a>";
          
          return $output;
          


          Attached is how it looks. Thanks Susan for your help.

          I’ll need to make 8 of these, but it’s going to work nicely.
            44+ MODXed sites and counting...