How to solve character problems in php require?

Asked

Viewed 117 times

0

Look at the picture:

inserir a descrição da imagem aqui

My system has those basic function buttons of a CRUD which are included in that part of the table through a <?php require("funcoes.php"); ?>.

However, in doing the require are appearing ("") as seen by the Inspector of Elements and consequently is appearing a spacing that causes the contents of the included is shifted down, as in a line break.

You can tell me why by calling this one require these quotes automatically enter by scrolling the content down?

File code included:

<?php require ('sessao.php'); ?>

<div class="btn-group">
    <button class="btn btn-small btn-success tip editar" data-original-title="Ver e editar" name="editar" id="editar" value="<?=$fetch['id']; ?>">
    <span class="icon-refresh icon-white"></span></button>
    <button class="btn btn-small btn-warning tip" data-original-title="Arquivar" name="arquivar" id="arquivar" value="<?=$fetch['id']; ?>">
    <span class="icon-folder-open icon-white"></span></button>
    <button class="btn btn-small btn-danger tip" data-original-title="Excluir" name="excluir" id="excluir" value="<?=$fetch['id']; ?>">
    <span class="icon-trash icon-white"></span></button>
</div>
<input type="hidden" name="identidade" value="<?=$fetch['id']; ?>" />
<input type="hidden" name="municipios" value="<?=$fetch['cod_cidades']; ?>" />
  • 3

    Most likely this space is in the required file. You can post it?

  • instead of require (which in addition to having the system reload the file for each row of the table, can include anything that is out of the <php tags), create a function that returns or prints the content with such buttons. and to find ghost spaces, use the "see source code" because in the element inspector the browser modifies all the code. helps also put temporary and different background-Cores on each element to identify easier which one exactly is dusting the space and generating the problem.

  • 1

    Apparently it’s in the file funcoes.php how @Rodolfosilva replied, note that the quotes are before the tag <div class="btn-group">.

  • I did request time tests to print some html content 30 times, using a function took between 0.00015 and 0.00020, and the same content using require also 30 times, took between 0.0095 to 0.0100... I found a considerable difference, Maybe in your current project nothing changes, but in an environment with many simultaneous requests can represent a good unnecessary load.

2 answers

1

There may be a CSS error as well...

These blank lines do not influence much to cause the next element to be pushed down. If possible post the code snippet where the <?php require("funcoes.php"); ?> to improve understanding of the problem that is going on with your code.

0


I found problems just related to characters that enter before require. In Dreamweaver there is BOM that inserts these characters automatically when saving the file, so you need to disable.

Problem solved.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.