Print results in a feed interspersed with horizontal spaces (blank line)

Asked

Viewed 105 times

0

I set up a news feed that reads the information in a database, but I need that instead of each line being printed one after the other, I need to be given an interval between each print with a blank line (interval), in order to have something like this:

  • printed news 01 (scroll the screen from right to left)
  • interval (without information)
  • printed news 02 (scrolls the screen from right to left)

The code I’m using is this:

<?php 
//conexão + select 

$query = mysql_query("SELECT"); 
if(mysql_num_rows($query)) { ?> 
<p class=""> 
 <ul class=""> 
  <li class=""> 
   <?php while($ln=mysql_fetch_array($query)) { 
         $feed=$ln['desc_noticias']; 
   ?> 
   <?php echo $feed; ?> 
   <?php } ?> 
  </li> 
   <?php } ?> 
 </ul> 
</p>

CSS:

.marquee {
 width: 100%; 
 margin: 0 auto; 
 margin-top: 0; 
 overflow: hidden; 
 white-space: nowrap; 
 background-color: #20407B; 
 color: white;
 box-sizing: border-box; 
 animation: marquee 50s linear infinite; 
 -webkit-animation: marquee 50s linear infinite;
}
 .marquee:hover {animation-play-state: paused; -webkit-animation-play-state: paused; }

@keyframes marquee {
0%   { text-indent: 27.5em }
100% { text-indent: -105em }
}
@-webkit-keyframes marquee {
0%   { text-indent: 27.5em }
100% { text-indent: -105em }
}

It should be very easy, but I’m not seeing a solution. I appreciate the help!

bs.: the tips that have been given so far make all the records appear together, interspersed with blank lines, but this is not the solution I need, thanks anyway for the considerations, waiting for +help!

  • 1

    Show some of your code friend

  • <?php //connection + select $query = mysql_query("SELECT"); if(mysql_num_rows($query)) { ? > <p class=""> <ul class=""> <li class=""> <?php while($ln=mysql_fetch_array($query)) { $feed=$ln['desc_noticias']; ? > <?php echo $feed; ? > <?php } ? > </li> <?php } ? > </ul> </p>

  • Try adding a <br/>, after returning the result, this way: $feed=$ln['desc_noticias'] . "<br/>";. Yet your code seems incomplete, and there’s not much you can do not know where the rest is.

  • You can create a new div, inside the while(), after the $feed display, blank with this spacing... and each time a news appears, you will make the news print + spacing... or do a yes and no background color, to differ from each other

  • CSS: . Marquee {width: 100%; margin: 0 auto; margin-top: 0; overflow: Hidden; white-space: nowrap; background-color: #20407B; color: white; box-Sizing: border-box; Animation: Marquee 50s linear Infinite; -Webkit-Animation: Marquee 50s linear Infinite; } . Marquee:Hover {Animation-play-state: paused; -Webkit-Animation-play-state: paused; } @keyframes Marquee { 0% { text-indent: 27.5em } 100% { text-indent: -105em } } @-Webkit-keyframes Marquee { 0% { text-indent: 27.5em } 100% { text-indent: -105em } }

2 answers

0

I would do it that way, to differ from each other:

<?php 
//conexão + select 

$query = mysql_query("SELECT"); 
if(mysql_num_rows($query)) { ?> 
<p class=""> 
 <ul class=""> 
   <?php 
     $linhas = 0; 
     while($ln=mysql_fetch_array($query)) { 
         if($linhas%2==0) $cor = "#F5F5F5"; else $cor = ""; 
         $linhas++;
         $feed=$ln['desc_noticias']; 
   ?> 
  <li class="" style="backgrond-color: <? echo $cor; ?>"> 
   <?php echo $feed; ?> 
  </li> 
   <?php } ?> 
   <?php } ?> 
 </ul> 
</p>
  • Guys, thanks for the help, but what’s going on is that in these ways indicated all the records return at once, but with the lines interspersed in white, but the thing is this: this CSS Marquee takes from right to left, and what I need is for a record to appear, then the interval (blank line), then the next record, but this online.

  • You’ll need to explain your problem better... it’s impossible for anyone to understand what you need this way... edit your question.. put the image as this showing the record... put the image as you want it to be... and another... if your problem is related to CSS you need to put the code of it as well.

0

That should solve

    <?php 

    $query = mysql_query("SELECT"); 
    if(mysql_num_rows($query)) { 

    ?> 

<p class=""> 

    <ul class=""> 

        <?php 

        while($ln=mysql_fetch_array($query)) { 
        $feed=$ln['desc_noticias']; 

        ?> 

        <li class=""> 

           <?php echo $feed; ?> 

        </li> 

        <li class=""> 

           <!-- linha em branco -->

        </li> 

        <?php } ?> 

    </ul> 

</p>

<?php } ?> 

Browser other questions tagged

You are not signed in. Login or sign up in order to post.