I'm creating a platform where I need to change elements of the site through a control panel, and for example, would it be something very bad to insert into DB and pull via PHP?
Let's say I have a menu with the following options in my menu :
1. Articles
2. Matters
3. Partners
4. Promotions
5. Contact
6. Submit your Text
Imagine that BD looks like this:
Id | titulo | status
1 | <li><a href="#">Artigos</a></li> | 1
2 | <li><a href="#">Matérias</a></li> | 1
3 | <li><a href="#">Parceiros</a></li> | 1
4 | <li><a href="#">Promoções</a></li> | 1
5 | <li><a href="#">Contato</a></li> | 1
6 | <li><a href="#">Envie seu Texto</a></li> | 1
Let's say that:
status 0 = oculto
status 1 = ativo
Just to illustrate, the code, for example, would look something like this:
<ul class="menu">
<?php
include('includes/conn.php');
$query = 'SELECT titulo FROM '.$tabela.' WHERE status = 1';
if($stmt = $mysqli->prepare($query)){
$stmt->execute();
$stmt->bind_result($titulo);
while($stmt->fetch()){
?>
<?php echo $titulo; ?>
<!-- COMNENT :: SAÍDA --
<li><a href="#">titulo</a></li>
<li><a href="#">Artigos</a></li>
<li><a href="#">Matérias</a></li>
<li><a href="#">Parceiros</a></li>
<li><a href="#">Promoções</a></li>
<li><a href="#">Contato</a></li>
<li><a href="#">Envie seu Texto</a></li> <<< ESTE NÃO APARECE
-->
<?php
}
$stmt->close();
}
$mysqli->close();
?>
</ul>
Well, I could simply change this in the database and put, for example, the option 6 with status of " hidden " (status = 0) and hide this menu option when needed.
Basically, this is a platform with dynamic elements if used extensively in the project or is it bad practice?