We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36527
    • 120 Posts
    Hi all,

    Wonder if anyone can point to a fix/workaround for this issue:

    I have a mutli select TV and using the HTML Generic Tag Widget to spit out LI’s.

    All working just great but unfortunately it is adding an ID to each LI’s - which is a no no for validation. Only part of the site which is now not validating. Any workaround anyone can suggest for this without hacking the core?

    And yes, I have tried a boolean entry in the Widget to try not to output said ID - but with no luck.

    TIA smiley
      • 7231
      • 4,205 Posts
      I generally use a snippet to process the output. In this case i would set the widget to Delimited List with a unique char as the delimiter like ",". Then in the snippet make the list into an array and do a foreach loop to process the output. Here is an untested example:

      <?php
      // use: [!snippetName? &input=`[*tvName*]`!]
      // check if input is set
      if($input != ''){	
      	// turn delimited list into an array
      	$input = explode(",", $input);
      	
      	// set the outer <ul> wrapper
      	$output = '<ul>'. PHP_EOL;
      	
      	// loop through each list item
      	foreach($input as $item){
      		// individual line output
      		$output .= '<li>'.$item.'</li>'. PHP_EOL;
      	}
      	// close the </ul> wrapper
      	$output .= '</ul>'. PHP_EOL;
      	// return the list
      	return $output;
      } else {
      	// if no input return nothing
      	return '';
      }
      	
      ?>


        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don&#39;t know what it is.
        Do you, Mr. Jones? - [bob dylan]