Jump to content
  • 0
Geralt

fluxcp rss news

Question

how do I fix these ipb news systems
codes

application.php

CMSNewsRSS'                => 'http://heroragnarok.com.br/forum/index.php?/forum/6-manuten%C3%A7%C3%B5es-e-atualiza%C3%A7%C3%B5es.xml',        // Use if CMSNewsType = 2


    'CMSNewsRSS2'                => 'http://heroragnarok.com.br/forum/index.php?/forum/49-changelog.xml',        // Use if CMSNewsType = 2
    'CMSNewsRSS3'                => 'http://heroragnarok.com.br/forum/index.php?/forum/7-eventos-e-promo%C3%A7%C3%B5es.xml',        // Use if CMSNewsType = 2
    'CMSNewsLimit'                => 4,                        // Number of news items to display

news.php

<?php if (!defined('FLUX_ROOT')) exit; ?>
<?php if(Flux::config('CMSNewsOnHomepage')): ?>
    <?php if($newstype == '2'):?>
        <?php if(isset($xml) && isset($xml->channel)): ?>
        <div class="newsDiv">
            <?php foreach($xml->channel->item as $rssItem): ?>
                <?php $i++; if($i <= $newslimit): ?>

                    <div class="wcontainer">
                    <h2 style="color: green"><?php echo $rssItem->title ?></h2>
                        <span class="newsDate">Data: <?php echo date(Flux::config('DateFormat'),strtotime($rssItem->pubDate))?></span>
                        <p><?php echo $rssItem->description ?></p>
                        
                        <a class="news_link" href="<?php echo $rssItem->link ?>"><small><?php echo htmlspecialchars(Flux::message('XCMSNewsLink')) ?></small></a>
                        <div class="clear"></div>
                    </div>
                <?php endif ?>
            <?php endforeach; ?> 
        </div>
        <?php else: ?>
            <p>
                <?php echo htmlspecialchars(Flux::message('XCMSNewsRSSNotFound')) ?><br/><br/>
            </p>
        <?php endif ?>
    <?php endif ?>
<?php endif ?>

news3.php

<?php


if (!defined('FLUX_ROOT')) exit;
$title = null;
$newslimit = 4;
$newstype = (int)Flux::config('CMSNewsType');
if($newstype == '2'){
    $news = Flux::config('FluxTables.CMSNewsTable'); 
    $sql = "SELECT title, body, link, author, created, modified FROM {$server->loginDatabase}.$news ORDER BY id DESC LIMIT $newslimit";
    $sth = $server->connection->getStatement($sql);
    $sth->execute();
    $news = $sth->fetchAll();
} elseif($newstype == '2'){
    $content = file_get_contents(Flux::config('CMSNewsRSS3'));
    if($content) {
        $i = 0;
        $xml = new SimpleXmlElement($content);
    }
}
?>
<?php if(Flux::config('CMSNewsOnHomepage')): ?>
    <?php if($newstype == '1'):?>
        <?php if($news): ?>
            Utilize o newstype = 2
        <?php else: ?>
            <?php echo htmlspecialchars(Flux::message('XCMSNewsEmpty')) ?>
        <?php endif ?>
    <?php elseif($newstype == '2'):?>
        <?php if(isset($xml) && isset($xml->channel)): ?>
            <?php foreach($xml->channel->item as $rssItem): ?>
                <?php $i++; if($i <= $newslimit): ?>
                <li>
                    <a href="<?php echo $rssItem->link ?>"><?php echo $rssItem->title ?></a><br />
                    <small>
                        <i class="icon-calendar"></i> 
                        Data: <?php echo date(Flux::config('DateFormat'),strtotime($rssItem->pubDate))?>
                    </small>
                </li>
                <?php endif ?>
            <?php endforeach; ?> 
        <?php else: ?>
                <?php echo htmlspecialchars(Flux::message('XCMSNewsRSSNotFound')) ?><br/><br/>
        <?php endif ?>
    <?php endif ?>
<?php endif ?>

 

error

 

Sem título.jpg

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Your if-statement is checking for type 2, and then doing an else-if check for type 2 for no reason.

if($newstype == '2'){


} elseif($newstype == '2'){

}

You need to sort out your if-statements before you can display information correctly.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.