Skip to content

Использование кода во вьюхах, вывод ХТМЛ #19

@hello-omny

Description

@hello-omny

Использовать во вьюхах только длинную запись языковых конструкций:

Плохо:

if ($var === null) {
...
};
echo "<p>{$this->title}</p>";
foreach ($flashTypes as $flashType) {
...
}
echo "<div class=\"alert alert-{$class}\" role=\"alert\">{$message}</div>";

Хорошо:

<?php
if ($var === null) :
...
endif;
?>
<p>Heading</p>
<?php foreach ($list as $item) :
  if ($var === null) :
     continue;
  endif;
  $message = "Flash type"; ?>
  <div class="alert alert-<?=$class?>" role="alert"><?=$message?></div>
<?php endforeach; ?>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions