Search code examples
phpsimplepie

php/html automatically creating new line between rss posts?


My goal is to create a dynamic list of links next to each other (not on top of each other). So far I have the links outputting correctly using Simplepie and an Atom datasource but for some reason my output has a linebreak between each new item in the for each statement. Is it possible to skip the line break and put the output items next to each other instead? I am not getting any errors, just not getting my goal output. Please help this is making me age at an exponential rate :)

<body>
<?php
foreach ($feed->get_items() as $item):
?>
<div class="item"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item-    >get_title(); ?></a></div><?php endforeach; ?>
</body>

Solution

  • Put the links in a <ul> (Unordered list element) with style of float:left like so

    <body>
        <ul>
            <?php
                foreach ($feed->get_items() as $item):?>
                    <li class="item"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item- >get_title(); ?></a>
                    </li>
                <?php endforeach; ?>
        </ul>
    </body>