• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Help with Code indentation

Community Beginner ,
Jul 07, 2011 Jul 07, 2011

Copy link to clipboard

Copied

Hello,

I need to automatically indent a code from this:

    public function __construct ()

    {

        $this->connection = mysqli_connect($this->server, $this->username,

        $this->password, $this->databasename, $this->port);

        $this->throwExceptionOnError($this->connection);

    }

to:

    public function __construct ()

    {

        $this->connection = mysqli_connect(

                                           $this->server,

                                           $this->username,

                                           $this->password,

                                           $this->databasename,

                                           $this->port

                                           );

        $this->throwExceptionOnError($this->connection);

    }

I tired to find possible settings in Preferences, but I could not tell Flash Builder to auto-indent my code like this. My aim is to be able to select all code, and just press Ctrl+Shift+F to do the job.

I am using Flash Builder 4.5 for PHP. From the help here (http://help.adobe.com/en_US/flashbuilder/using/WSe4e4b720da9dedb5-25a895a612e8e9b8c8e-7ff1.html), I do not get Indentation, immediately after Flash Builder in the Preferences window. Instead, Indentation is burried under Flash Builder > Editors > MXML Code > Indentation.

I would appreciate any help.

TOPICS
PHP

Views

877

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 07, 2011 Jul 07, 2011

Copy link to clipboard

Copied

Hi Shailen,

Read about PHP code formatting in this page: http://files.zend.com/help/Zend-Studio/formatter.htm

It is related to Zend Studio but applies to Flash Builder for PHP 4.5 as well.

Roy

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 07, 2011 Jul 07, 2011

Copy link to clipboard

Copied

Roy, Amazing! I have now created my own Formatter profile, and edited the Zend presets to suit the way I want my code to be indented.

However, I still cannot find a way to insert a new line after each field access:

function dosmthg(){

     smthg->$x,

     smthg2->$y,

          smthg3->$z

}

Do you know how to do it?

Thank you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 13, 2011 Jul 13, 2011

Copy link to clipboard

Copied

LATEST

Hello Roy,

I have attempted to format my PHP code in Flash Builder, but without any success.

Basically, I have a function and within that function, there is another function that takes a string as parameter. I want to indent that string, but there is no way I can tell the formatter to indent that string:

    public function getTools ()

    {

        $stmt = mysqli_prepare($this->connection,

        "SELECT

              tools.tID,

              tools.tToolName,

tools.tShortDesc,

              pResponsible.pLastName,

              pToolOwner.pLastName,

              tools.tComponentID,

              tools.tLevelOfDetailID

FROM tools

      INNER JOIN People pResponsible

ON tools.tResponsiblePersonID = pResponsible.pID

      INNER JOIN People pToolOwner

ON tools.tToolOwnerID= pToolOwner.pID");

        $this->throwExceptionOnError();

     // code truncated..

     }

What I want is this:

    public function getTools ()

    {

        $stmt = mysqli_prepare($this->connection,

        "SELECT

              tools.tID,

              tools.tToolName,

              tools.tShortDesc,

              pResponsible.pLastName,

              pToolOwner.pLastName,

              tools.tComponentID,

              tools.tLevelOfDetailID

        FROM tools

        INNER JOIN People pResponsible ON tools.tResponsiblePersonID = pResponsible.pID

        INNER JOIN People pToolOwner ON tools.tToolOwnerID= pToolOwner.pID");

        $this->throwExceptionOnError();

     // code truncated..

     }

I would really appreciate any help on this!

Thank you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines