<?php

require __DIR__ . '/inc/head.php';

ob_start();
?>
<article>
          <h1 class="page-title"><?php echo $this->page_title ?></h1>
          <a href="/" class="to-front">&larr;Главная</a>
          <div>
            <form action="" method="post">
              <div class="form-element<?php echo ($this->errors->name)?' form-element--error':''; ?>">
                <input class="form-element__input" type="text" name="name" placeholder="Имя" tabindex="1" value="<?php echo ($this->post_data->name)?$this->post_data->name:'';?>">
                <div class="form-element__error"><?php echo ($this->errors->name)?$this->errors->name:''; ?></div>
              </div>
              <div class="form-element<?php echo ($this->errors->email)?' form-element--error':''; ?>">
                <input class="form-element__input" type="text" name="email" placeholder="e-mail" tabindex="2" value="<?php echo ($this->post_data->email)?$this->post_data->email:'';?>">
                <div class="form-element__error"><?php echo ($this->errors->email)?$this->errors->email:''; ?></div>
              </div>
              <div class="form-element<?php echo ($this->errors->homepage)?' form-element--error':''; ?>">
                <input class="form-element__input" type="text" name="homepage" placeholder="Домашняя страница" tabindex="3" value="<?php echo ($this->post_data->homepage)?$this->post_data->homepage:'';?>">
                <div class="form-element__error"><?php echo ($this->errors->homepage)?$this->errors->homepage:''; ?></div>
              </div>
              <div id="CAPTCHA" class="form-element<?php echo ($this->errors->CAPTCHA)?' form-element--error':''; ?>">
                <img src="/CAPTCHA.png?<?php echo rand(1000,9999) . time(); ?>" alt="">
                <input class="form-element__input" type="text" name="CAPTCHA" placeholder="Введите текст с картинки" tabindex="4">
                <div class="form-element__error"><?php echo ($this->errors->CAPTCHA)?$this->errors->CAPTCHA:''; ?></div>
              </div>
              <div class="form-element<?php echo ($this->errors->text)?' form-element--error':''; ?>">
                <textarea class="form-element__textarea" name="text" id="" cols="30" rows="10" placeholder="Текст объявления" tabindex="5"><?php echo ($this->post_data->text)?$this->post_data->text:'';?></textarea>
                <div class="form-element__error"><?php echo ($this->errors->text)?$this->errors->text:''; ?></div>
              </div>

              <input type="submit" value="Отправить">
            </form>
          </div>
        </article>
<?php
$this->content = ob_get_contents();
ob_end_clean();

require __DIR__ . '/inc/body.php';