Re: Re: editor that typesets the php code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



well, i'm not sure what to do after your code is done, but as far as
editors go, theres a free one out there that does syntax highlighting
for a ton of languages (php included) called Vim... it comes with a
graphical version called gvim that i do all of my coding on. no
debugging features for php (afaik) but you can set up debuggers
through vim (never tried though). http://www.vim.org

Open up the file in vim and type:

gg=G

Turns this:

------------------------------------------------------------------------------------------------
function str_pad_html($strInput = "", $intPadLength, $strPadString = " ") {
if (strlen(trim(strip_tags($strInput))) < intval($intPadLength)) {


switch ($intPadType) {
// STR_PAD_LEFT
case 0:
$offsetLeft = intval($intPadLength - strlen(trim(strip_tags($strInput))));
$offsetRight = 0;
break;

// STR_PAD_RIGHT
case 1:
$offsetLeft = 0;
$offsetRight = intval($intPadLength - strlen(trim(strip_tags($strInput))));
break;
}


unset($strInput, $offsetLeft, $offsetRight);

return $strPadded;
}

else {
return $strInput;
}
}
------------------------------------------------------------------------------------------------

into this:

------------------------------------------------------------------------------------------------

function str_pad_html($strInput = "", $intPadLength, $strPadString = "&nbsp;") {
    if (strlen(trim(strip_tags($strInput))) < intval($intPadLength)) {

        switch ($intPadType) {
            // STR_PAD_LEFT
            case 0:
                $offsetLeft = intval($intPadLength - strlen(trim(strip_tags($strInput))));
                $offsetRight = 0;
                break;

                // STR_PAD_RIGHT
            case 1:
                $offsetLeft = 0;
                $offsetRight = intval($intPadLength - strlen(trim(strip_tags($strInput))));
                break;
        }

        unset($strInput, $offsetLeft, $offsetRight);

        return $strPadded;
    }

    else {
        return $strInput;
    }
}


------------------------------------------------------------------------------------------------

-philip

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux