coder008 coder008 - 1 month ago 8
HTML Question

Write php code inside a html string

im trying to insert some php that controll my session inside a html, the thing is that i cant concat the php with the html and i have no idea how to do it basicly i have the session

$_SESSION["nome"]
and want to put it here:

<?php
return
"
<div class='container-fluid'>
<div class='row imageBlock sky'>
<div class='col-md-3'><img class='img-responsive house' src=
'Imagens/pr%C3%A9dios.png'></div>
<div class='col-md-3'><img class='img-responsive house' src=
'Imagens/pr%C3%A9dios2.png'></div>
<div class='col-md-3'><img class='img-responsive house' src=
'Imagens/pr%C3%A9dios3.png'></div>
<div class='col-md-3'><img class='img-responsive house' src=
'Imagens/pr%C3%A9dios4.png'></div>
</div>
<div class='row'>
<h3 class='text-center' id='titulo'>OSeuCondomínio</h3>
</div>
<div class='row enter-block myBox'>
<div class='col-md-offset-3 col-md-9'>
<p class='okText'><span class='glyphicon glyphicon-ok'></span> Quer Gerir o
condomínio, tendo a possibilidade de marcar reuniões, registar
intervenções e guardar ficheiros?</p>
</div>
<div class='col-md-offset-3 col-md-9'>
<p class='okText'><span class='glyphicon glyphicon-ok'></span> Quer ter acesso
a tudo o que se passa no seu apartamento sem saír do lugar?</p>
</div>
<div class='col-md-offset-3 col-md-9'>
<p class='okText'><span class='glyphicon glyphicon-ok'></span> Quer efetuar o
pagamento das quotas através da plataforma?</p>
</div>
<div class='col-md-offset-3 col-md-9'>
<p class='okText'><span class='glyphicon glyphicon-ok'></span> Pretende
conversar aqui com os moradores?</p>
</div>
</div>
<div class='row main-text'>
<header>
<h5 class='text-center main-text-content'>Se respondeu que sim
a pelo menos uma das questões esta é a plataforma ideal para
si !!</h5>
</header>
</div>
<div class='row responsive nowrap'>
<a href='index.php?page=LoginFormCont'><button class='btn btn-lg center-block EntreJa'>Entre Já</span></button></a>
</div>
</div>";
?>


i want to write the loged users name in a div inside this html and i need to write the php session variable inside any tips?

Answer

Your example was not very specific. You said you want to insert the name "here", but then included about 44 lines of code.

Being that you're in a code-block, you can concatenate your HTML and sessions like so:

<?php
   return "<div>" . $_SESSION["nome"] . "</div>";
?>