E
E
Evgeny Fedorov2015-11-13 00:48:01
PHP
Evgeny Fedorov, 2015-11-13 00:48:01

How to teach PhpStrom to format php + html?

I just can't get my IDE to format PHP with HTML code after a couple of hours of web research.
Either it is lost, or it does not format correctly, and there is no place to set it up ... Maybe someone will advise a plugin?
some code

<a class="active" href="javascript:void(0);" data-value="#carousel-example-generic" onclick="scrollDiv('carousel-example-generic')"><?php if ($this->lang->line('photos') != '') { echo stripslashes($this->lang->line('photos')); } else echo "Photos"; ?></a></li>

formats in
<a href="javascript:void(0);" data-value="#about-listing-text" onclick="scrollDiv('about-listing-text')"><?php if ($this->lang->line('about_listing') != '') {
               echo stripslashes($this->lang->line('about_listing'));
             } else echo "About this listing"; ?> </a></li>

You need to teach the IDE to add new Line before the tag <?php
. I already only dream that the code would be like:
<?php if(count($reviewData->result_array()) >0){?>
<li class="numrstr">
<label class="star">
<a href="<?php echo(($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]); ?>#reviews"></a>
</li>
<?php }?>

was formatted with identification from the conditional operator:
<?php if (count($reviewData->result_array()) > 0){ ?>
  <li class="numrstr">
    <label class="star">
      <a href="<?php echo(($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]); ?>#reviews"></a>
  </li>
<?php } ?>

and also I can’t teach how to remove empty lines in css code:
a.control_prev:hover, a.control_next:hover {

  opacity: 1;

  -webkit-transition: all 0.2s ease;

}



a.control_prev {

  border-radius: 0 2px 2px 0;

}

turns into:
a.control_prev:hover, a.control_next:hover {

  opacity: 1;

  -webkit-transition: all 0.2s ease;

}
a.control_prev {

  border-radius: 0 2px 2px 0;

}

and should in:
a.control_prev:hover, a.control_next:hover {
  opacity: 1;
  -webkit-transition: all 0.2s ease;
}
a.control_prev {
  border-radius: 0 2px 2px 0;
}

Can anyone advise how you can create a shortCut to remove empty lines in the selected text?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question