M
M
Mikhail Lebedev2018-12-20 18:58:15
C++ / C#
Mikhail Lebedev, 2018-12-20 18:58:15

Pasting in echo html + php?

It is necessary to make it so that different information is displayed for different users,
for example - if the user is not registered, then one
if registered, then another.
This code displays the html code, which is different for them:

<?php
if ( is_user_logged_in() ) {
echo <<<HTML
  <div class="all">Вы зареганы!</div>
HTML;
}

else { echo <<<HTML
  <div class="all">Вы не зареганы!</div>
HTML;
}
 ?>

and how now to insert a php function into these divs?
<?php
if ( is_user_logged_in() ) {
echo <<<HTML
<div class="all">  Вы зареганы!</div>
  <div class="end1">
      <?php
          Код
       ?>
HTML;
}

else { echo <<<HTML
  <div class="all">Вы не зареганы!</div>
  <div class="end2">
      <?php
          Код
       ?>
HTML;
}
 ?>

Answer the question

In order to leave comments, you need to log in

7 answer(s)
C
Conacry, 2016-02-21
@romashalkovskiy

All you need is https://mva.microsoft.com/

V
Vitaly Vitrenko, 2016-02-21
@Vestail

Books for learning C#/.NET

D
Dimonchik, 2016-02-21
@dimonchik2013

ITVDN video courses on torrents look

J
Jupiter Max, 2018-12-20
@vardoLP

<? //тут пых ?>
<!--тут хтмл-->
<? //тут тоже пых ?>

// или так

<?
//тут пых
?>
<!--тут хтмл-->
<?
//тут пых
?>

O
Orkhan Hasanli, 2018-12-20
@azerphoenix

<?php if ( is_user_logged_in() ):
    echo  '<div class="all">Вы зареганы!</div>'.
      		'<div class="end1">'.
        		my_php_code_here();

  else: 
    echo '<div class="all">Вы не зареганы!</div>'.
    			'<div class="end2">'.
    				my_php_code_here();
  endif;
?>

P
Pavel, 2018-12-20
@PavelMonro

The simplest for me:

<?php if ( is_user_logged_in() ) { ?>
<div class="all">  Вы зареганы!</div>
  <div class="end1">
      <?php
          Код
       ?>
<?php } else { ?>

  <div class="all">Вы не зареганы!</div>
  <div class="end2">
      <?php
          Код
       ?>
<php } ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question