1
0

cleanHTML.qsrc 827 B

1234567891011121314151617181920212223242526
  1. #cleanHTML
  2. !Removes Whitespace from between HTML tags in a string.
  3. ! Purpose is because having whitespace in writing code makes readablility,
  4. ! but the rendering engine adds extra lines at top for no reason.
  5. !
  6. ! $ARGS[0] = is the string to be cleaned up.
  7. !
  8. ! Call this as a Function to get the cleaned string returned
  9. ! example:
  10. ! *pl func('cleanHTML', $HTMLString)
  11. $cleanHTML['Input'] = trim($ARGS[0])
  12. $cleanHTML['ReturnStr'] = ""
  13. $cleanHTML['tab'] = " "
  14. $cleanHTML['newline'] = "
  15. "
  16. !Strip out newlines and tabs, which should not be in the string
  17. $cleanHTML['ReturnStr'] = replace($cleanHTML['Input'],$cleanHTML['newline'],"")
  18. $cleanHTML['ReturnStr'] = replace($cleanHTML['ReturnStr'],$cleanHTML['tab'],"")
  19. $result = $cleanHTML['ReturnStr']
  20. killvar '$cleanHTML'
  21. killvar 'i'
  22. --- cleanHTML ---------------------------------