PHP - OB issues like template and forms











up vote
0
down vote

favorite












I have a view / template system, what it basically does is import and implement the files incorporating the local and global variables, I am currently using the Output Buffer (OB), however I have a problem, if the page / template has a form, when submitting the page is blank, that is, the template is no longer included, I believe it is a buffer problem, can someone tell me what the problem is?



Here is my Render class:



class View
{
public function render($file)
{
if(file_exists($file)){
extract((array) $this);
ob_start();
include $file;
return ob_get_clean();
}
}
}


This is my View class



class LoginView extends View
{
public function __construct()
{
$this->render(ROOT.'/public/layout/login.php');
}
}


And this is my template:



<!DOCTYPE html>




<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
<script src="main.js"></script>
</head>

<body>


<form method="POST" action="/">

<div class="input-field">
<label for="ipt-email">Email</label>
<input type="text" name="email" id="ipt-email">
</div>

<div class="input-field">
<label for="ipt-password">Senha</label>
<input type="text" name="password" id="ipt-password">
</div>

<button>Logar</button>

</form>

</body>











share|improve this question


























    up vote
    0
    down vote

    favorite












    I have a view / template system, what it basically does is import and implement the files incorporating the local and global variables, I am currently using the Output Buffer (OB), however I have a problem, if the page / template has a form, when submitting the page is blank, that is, the template is no longer included, I believe it is a buffer problem, can someone tell me what the problem is?



    Here is my Render class:



    class View
    {
    public function render($file)
    {
    if(file_exists($file)){
    extract((array) $this);
    ob_start();
    include $file;
    return ob_get_clean();
    }
    }
    }


    This is my View class



    class LoginView extends View
    {
    public function __construct()
    {
    $this->render(ROOT.'/public/layout/login.php');
    }
    }


    And this is my template:



    <!DOCTYPE html>




    <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Page Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" media="screen" href="main.css" />
    <script src="main.js"></script>
    </head>

    <body>


    <form method="POST" action="/">

    <div class="input-field">
    <label for="ipt-email">Email</label>
    <input type="text" name="email" id="ipt-email">
    </div>

    <div class="input-field">
    <label for="ipt-password">Senha</label>
    <input type="text" name="password" id="ipt-password">
    </div>

    <button>Logar</button>

    </form>

    </body>











    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have a view / template system, what it basically does is import and implement the files incorporating the local and global variables, I am currently using the Output Buffer (OB), however I have a problem, if the page / template has a form, when submitting the page is blank, that is, the template is no longer included, I believe it is a buffer problem, can someone tell me what the problem is?



      Here is my Render class:



      class View
      {
      public function render($file)
      {
      if(file_exists($file)){
      extract((array) $this);
      ob_start();
      include $file;
      return ob_get_clean();
      }
      }
      }


      This is my View class



      class LoginView extends View
      {
      public function __construct()
      {
      $this->render(ROOT.'/public/layout/login.php');
      }
      }


      And this is my template:



      <!DOCTYPE html>




      <head>
      <meta charset="utf-8" />
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <title>Page Title</title>
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" type="text/css" media="screen" href="main.css" />
      <script src="main.js"></script>
      </head>

      <body>


      <form method="POST" action="/">

      <div class="input-field">
      <label for="ipt-email">Email</label>
      <input type="text" name="email" id="ipt-email">
      </div>

      <div class="input-field">
      <label for="ipt-password">Senha</label>
      <input type="text" name="password" id="ipt-password">
      </div>

      <button>Logar</button>

      </form>

      </body>











      share|improve this question













      I have a view / template system, what it basically does is import and implement the files incorporating the local and global variables, I am currently using the Output Buffer (OB), however I have a problem, if the page / template has a form, when submitting the page is blank, that is, the template is no longer included, I believe it is a buffer problem, can someone tell me what the problem is?



      Here is my Render class:



      class View
      {
      public function render($file)
      {
      if(file_exists($file)){
      extract((array) $this);
      ob_start();
      include $file;
      return ob_get_clean();
      }
      }
      }


      This is my View class



      class LoginView extends View
      {
      public function __construct()
      {
      $this->render(ROOT.'/public/layout/login.php');
      }
      }


      And this is my template:



      <!DOCTYPE html>




      <head>
      <meta charset="utf-8" />
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <title>Page Title</title>
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" type="text/css" media="screen" href="main.css" />
      <script src="main.js"></script>
      </head>

      <body>


      <form method="POST" action="/">

      <div class="input-field">
      <label for="ipt-email">Email</label>
      <input type="text" name="email" id="ipt-email">
      </div>

      <div class="input-field">
      <label for="ipt-password">Senha</label>
      <input type="text" name="password" id="ipt-password">
      </div>

      <button>Logar</button>

      </form>

      </body>








      php view rendering output-buffering






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 19 at 16:08









      Vinicius Guerato

      94




      94





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53378578%2fphp-ob-issues-like-template-and-forms%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53378578%2fphp-ob-issues-like-template-and-forms%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Wiesbaden

          Marschland

          Dieringhausen