SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Syntax Tabbing and Highlighting Error

    Hi,

    'Padders' created a script a while ago to auto-tab a directory for PHP files. Well, I've almost got it working as he seamed to stop working on it, but came across a strange error that happens in most PHP Editors (All the ones I've tried) as well as the script. The code should look like this:

    PHP Code:
    <?php
    if($a == "1") {
        print 
    "Dog";
    }

    if(
    $a == "1") { print "cat"; }

    if(
    $a == "1")
    {
        echo 
    "monkey";
    }
    ?>
    However, using the script and editors they all come out like the following:

    PHP Code:
    <?php
    if($a == "1") {
        print 
    "Dog";
    }

    if(
    $a == "1"){ print "cat";}

    if(
    $a == "1")
    {
    echo 
    "monkey";
    }
    ?>
    I know it is bad code above, etc but it shouldn't matter. The tabbing script looks for } and { at the start/end of a line the adds or removes a tab but not in the middle of a line. Therefore when a } is added to the end of the line it removes a tab from the following lines producing bad tabbing. Basically I need help finding a way if there is a { and } on the same line then change no tabs. Any ideas?

    -Peter

  2. #2
    SitePoint Evangelist
    Join Date
    Dec 2000
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Peter,

    They look the same to me...
    Corbb O'Connor
    Looking for quality website design or database programming?
    Contact me for more information and a FREE quote!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •