We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7455
    • 2,204 Posts
    I like to make a tv that I can use to set a background for a cell (I know not XHTML who cares) I like to use the image browser to select an image but i do not want the image tags only the path e.g. assets/images/image.gif
    is this posible using tv's?

    Greets Dimmy
      follow me on twitter: @dimmy01
      • 32963
      • 1,732 Posts
      I like to make a tv that I can use to set a background for a cell (I know not XHTML who cares) I like to use the image browser to select an image but i do not want the image tags only the path e.g. assets/images/image.gif
      is this posible using tv's?

      Greets Dimmy

      No, not in TP1.

      I've recognised this behavior and I think it's now time we change it. The current release will convert (or render) an image TV input into an html image tag. This will be changed to completely separate the input values from the rendered or displayed values. We will add an image control that will allow you to render the output as you so desire.

      The only work around now is to just use a Text input field.
        xWisdom
        www.xwisdomhtml.com
        The fear of the Lord is the beginning of wisdom:
        MODx Co-Founder - Create and do more with less.
        • 7455
        • 2,204 Posts
        Thanks for the info on this one

        When wil the new release be here?

        would like to use the list option TV (see bugs)
          follow me on twitter: @dimmy01
        • Look for another release this week. Whether or not it will enable the particular TV feature you're after, Raymond will have to answer. smiley
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 14267
            • 113 Posts
            For now, just comment out line 32 in tmplvars.format.inc like this:

            		// setup image type
            		if($tvtype=='image') {
            			$value = parseInput($value); 
            //		       $value = "<img src='$value' />";
            		}
            

            Then you can just put the variable in your own html tag.
              • 7455
              • 2,204 Posts
              For now, just comment out line 32 in tmplvars.format.inc like this:

              		// setup image type
              		if($tvtype=='image') {
              			$value = parseInput($value); 
              //		       $value = "<img src='$value' />";
              		}
              

              Then you can just put the variable in your own html tag.

              Nice thanks alot,
              or as I see it corectly I can make a new tv same as the image tv with a new name and it wil not include the tags?
              I like to be able to use both versions
                follow me on twitter: @dimmy01
                • 14267
                • 113 Posts
                Well I tried something, and it turns out you can do it both ways. If you read the TV into a snippet, you get the image path minus the img tag. So never mind commenting out the line of code. Instead here's a tiny snippet that I named 'GetImageTV':
                # Usage: [[GetImageTV?tvname=yourtv]]
                
                $imgarray=$etomite->getTemplateVar($idname=$tvname); 
                return $imgarray['value'];
                
                  • 7455
                  • 2,204 Posts
                  Well I tried something, and it turns out you can do it both ways. If you read the TV into a snippet, you get the image path minus the img tag. So never mind commenting out the line of code. Instead here's a tiny snippet that I named 'GetImageTV':
                  # Usage: [[GetImageTV?tvname=yourtv]]
                  
                  $imgarray=$etomite->getTemplateVar($idname=$tvname); 
                  return $imgarray['value'];
                  

                  Ok that way I do not need to change the core code...(did that already hehe added a new "notagimage" TV option)

                  Thanks for sorting this one out

                  Greets Dimmy
                    follow me on twitter: @dimmy01