Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   I'm Looking For....... (http://www.greenguysboard.com/board/forumdisplay.php?f=20)
-   -   ..A Program To Remove Blank Spaces (http://www.greenguysboard.com/board/showthread.php?t=39285)

Doug E 2007-03-27 11:39 PM

..A Program To Remove Blank Spaces
 
Im looking for a program that removes all blank spaces from my code. Ive tried numerous searches but cant figure out how to word it exactly.

I want to turn this...

Quote:












..into this...
Quote:


...with the click of the button

MightyMidget 2007-03-28 06:08 AM

Dunno, but if you can't find one I could always code the program for you. Won't take long and wouldn't cost much.

Why do you need that functionality anyway?

Lemmy 2007-03-28 06:34 AM

Dreamweaver will do that for you. Just create an empty line in code view, highlight it and do a find and replace. Leave the replace field empty. Voila!

Greenguy 2007-03-28 09:27 AM

Namo has a handy little html clean up option that makes the source code look nice & tidy.

MightyMidget 2007-03-28 10:03 AM

If I understood it correctly he also wants trailing and preceding spaces/tabs to be removed, so that code like

Code:

       
 
                   
 

would also become

Code:


so a simple find/replace of newlines won't do. An editor that supports regular expressions would be able to do it, like UltraEdit, but if you want to do this on a lot of files then a command line utility would be better.

tickler 2007-03-28 02:08 PM

Not sure why people would want these anymore. It is much preferable to keep the indents/newlines if you ever need to do work on the page(s).

Absolute HTML Compressor

Doug E 2007-03-28 07:57 PM

Quote:

Not sure why people would want these anymore. It is much preferable to keep the indents/newlines if you ever need to do work on the page(s).
Its for a fussy script that doesn't like blank spaces between tags. Actually, 2 scripts, both unrelated so I assume there are more out there like this.

I ended up doing it all by hand last night with end delete end delete..., a very boring 1.5 hours.

Ill try those suggestions tonight and see which works for next time...

Whipple 2007-04-02 01:25 AM

Theres several ways you can do this, but I would just write a quick php script to spit out the html in a line and copy / paste it (If you wanted to have the script actually write to the file you could, but it's not that hard to copy paste ;))

PHP Code:

<?php

    $file 
file_get_contents("html.html");
    echo 
htmlentities($file);

?>

Just quick explanation.. file_get_contents() grabs all of the text in "html.html" file into a string (all in one line), next line just spits it out in the format you want. If you want something more elaborate you can look into the following functions:

str_replace()
fopen()
fread()

oast 2007-04-03 04:14 AM

I use UltraEdit's "replace text in files" option.
It can do multiple files and will remove all tabs, new lines and spaces between tags in three passes, with the option to do a "test" run to make sure your search line is correct before commiting to every file.


All times are GMT -4. The time now is 04:18 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc