Answer the question
In order to leave comments, you need to log in
How to remove php sidebar from html?
Hello!
Can you please tell me if it is possible to remove php-sidebars similar to this one from html-files (index.php):
<?php
if (isset($login)){
echo "<div class='col-xs-6' id='login_text'>
<p class='login_text'>Здравствуйте, ".$login."!</p>
</div>";
}
else{
echo "<div class='col-xs-6' id='login_text'>
<form action='' method='post' class='login' id='login'>
<label>Логин</label><input type='text' name='login' value='".((isset($_COOKIE['gyppi_login']))?$_COOKIE['gyppi_login']:'')."' required>
<label>Пароль</label><input type='password' name='password' value='".((isset($_COOKIE['gyppi_password']))?$_COOKIE['gyppi_password']:'')."' required>
<input name='button' type='submit' value='Войти'>
</form>
<button onclick='window.location=\"registration.php\"' class='registration' id='regbutton'>Регистрация</button>".((isset($error_message))?'<div><p class="error_message">'.$error_message.'</p></div>':'')."</div>";
}
?>
Answer the question
In order to leave comments, you need to log in
Banal example:
<html>
<body>
<?=$title?>
Some text
<a href="<?=$link?>">link</a>
</body>
</html>
In a simple case, when mvc is used in views, something like this is created
<?php if (isset($login)): ?>
<div class='col-xs-6' id='login_text'>
<p class='login_text'>Здравствуйте, <?= $login ?>!</p>
</div>
<?php else: ?>
<div class='col-xs-6' id='login_text'>
<form action='' method='post' class='login' id='login'>
<label>Логин</label>
<input type='text' name='login'
value='<?= $_COOKIE[' gyppi_login'] ?? $_COOKIE['gyppi_login'] ?>' required>
<label>Пароль</label>
<input type='password' name='password'
value='<?= $_COOKIE[' gyppi_password'] ?? $_COOKIE['gyppi_password']?>'
required>
<input name='button' type='submit' value='Войти'>
</form>
<button onclick='window.location="registration.php"' class='registration' id='regbutton'>Регистрация</button>
<?php if (isset($error_message)): ?>'
<div>
<p class="error_message"><?=$error_message?></p>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
onclick='window.location="registration.php"'
or is it normal to combine html with php and should it be done?if you look at the "compiled" template code of ANY php templater, be it smarty or something newer, you will see that the result is an html template with php inserts. This is absolutely normal.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question