Jump to content
  • 0
juniorbocask8

RSS News Eadev FluxCP

Question

Hello I need a little help because I don't know how to do that ....

I'm using Rsslib together with EadevConfig.php
and it is necessary to display images for each news item, which must be uploaded by

image-1.png
image-2.png
image-3.png
image-4.png
image-5.png

and I use categories in xml

'news' => 'http://www.xul.fr/rss.xml',
'news2' => 'http://www.xul.fr/rss.xml',
'news3' => 'http://www.xul.fr/rss.xml',
------ NEWS/INDEX.PHP --------
<?php if (!defined('FLUX_ROOT')) exit; 
    if ( $EADev['enablerss'] 
        require_once ("rsslib.php");
    endif;
?>                   
                
                <!-- News1 -->                
                <div class="tab-pane fade active show" id="news">
                <div class="news-item">
                    <?php if ( $EADev['enablerss'] 
                    echo RSS_Display($EADev['news1'], 5);
                    endif;
                    ?>
                    </div>
                </div>
                
    
                <!-- News2 -->                
                <div class="tab-pane fade" id="news2">
                    <div class="news-events-slider">
                    <?php if ( $EADev['news2'] 
                    echo RSS_Display($EADev['events'], 5);
                    endif;
                    ?>
                    </div>
                    
                </div>
                
                
                <!-- News3 -->                
                <div class="tab-pane fade" id="news3">
                    <div class="news-events-slider">
                    <?php if ( $EADev['enablerss'] 
                    echo RSS_Display($EADev['news3'], 5);
                    endif;
                    ?>
                    </div>
                </div>
                
------- RSSLIB.PHP --------------
<?php
/*
    RSS Extractor and Displayer
    (c) 2007-2010  Scriptol.com - Licence Mozilla 1.1.
    rsslib.php
    
    Requirements:
    - PHP 5.
    - A RSS feed.
    
    Using the library:
    Insert this code into the page that displays the RSS feed:
    
    <?php
    require_once("rsslib.php");
    echo RSS_Display("http://www.xul.fr/rss.xml", 15);
    ?>
    
*/

$RSS_Content = array();

function RSS_Tags($item, $type, $image="")
{
        $y = array();
        $tnl = $item->getElementsByTagName("title");
        $tnl = $tnl->item(0);
        $title = $tnl->firstChild->textContent;

        $tnl = $item->getElementsByTagName("link");
        $tnl = $tnl->item(0);
        $link = $tnl->firstChild->textContent;
        
        $tnl = $item->getElementsByTagName("pubDate");
        $tnl = $tnl->item(0);
        $date = $tnl->firstChild->textContent;        

        $tnl = $item->getElementsByTagName("description");
        $tnl = $tnl->item(0);
        $description = $tnl->firstChild->textContent;

        $y["title"] = $title;
        $y["link"] = $link;
        $y["date"] = $date;        
        $y["description"] = $description;
        $y["type"] = $type;
        $y["image"] = $image;
        
        return $y;
}


function RSS_Channel($channel)
{
    global $RSS_Content;

    $items = $channel->getElementsByTagName("item");
    
    // Processing channel
    
    $y = RSS_Tags($channel, 0);        // get description of channel, type 0
    array_push($RSS_Content, $y);
    
    // Processing articles
    
    foreach($items as $item)
    {
        $y = RSS_Tags($item, 1);    // get description of article, type 1
        array_push($RSS_Content, $y);
    }
}

function RSS_Retrieve($url)
{
    global $RSS_Content;

    $doc  = new DOMDocument();
    $doc->load($url);

    $channels = $doc->getElementsByTagName("channel");
    
    $RSS_Content = array();
    
    foreach($channels as $channel)
    {
         RSS_Channel($channel);
    }
    
}


function RSS_RetrieveLinks($url)
{
    global $RSS_Content;

    $doc  = new DOMDocument();
    $doc->load($url);

    $channels = $doc->getElementsByTagName("channel");
    
    $RSS_Content = array();
    
    foreach($channels as $channel)
    {
        $items = $channel->getElementsByTagName("item");
        foreach($items as $item)
        {
            $y = RSS_Tags($item, 1);    // get description of article, type 1
            array_push($RSS_Content, $y);
        }
         
    }

}


function RSS_Links($url, $size = 15)
{
    global $RSS_Content;

    $page = "<ul>";

    RSS_RetrieveLinks($url);
    if($size > 0)
        $recents = array_slice($RSS_Content, 0, $size + 1);

    foreach($recents as $article)
    {
        $type = $article["type"];
        if($type == 0) continue;
        $title = $article["title"];
        $link = $article["link"];
        $page .= "<li><a href=\"$link\">$title</a></li>\n";            
    }

    $page .="</ul>\n";

    return $page;
}

function RSS_Display($url, $size = 15, $site = 0, $withdate = 0)
{
    global $RSS_Content;

    $opened = false;
    $page = "";
    $site = (intval($site) == 0) ? 1 : 0;

    RSS_Retrieve($url);
    if($size > 0)
        $recents = array_slice($RSS_Content, $site, $size + 1 - $site);

    $i = 0;
    foreach($recents as $article)
    {
        $type = $article["type"];
        if($type == 0)
        {
            if($opened == true)
            {
                $page .="\n";
                $opened = false;
            }
            $page .="<b>";
        }
        else
        {
            if($opened == false) 
            {
                $page .= "\n";
                $opened = true;
            }
        }
        $title = $article["title"];
        $link = $article["link"];
        $date = $article["date"];
        $image = $article["image"];
        $page .= "
        <div class=\"news-item\">

        <img src=\"themes/default/img/. $image .\" alt=\"\" class=\"img-responsive\">
        
            <div class=\"news-desc\">
                <div class=\"news-labels\">
                    
                    <div class=\"posted-on\">
                        Post em: ".strftime("%d %b,%Y",strtotime($date))."
                    </div>
                    
                    <div class=\"news-cat news\">
                        News
                    </div>                
                </div>
                <a target=\"_blank\" href=\"$link\">". substr($title,0, 48) . " ...</a>
                <div class=\"readmore text-right\">
                    <a target=\"_blank\" href=\"$link\">READ MORE</a>
                </div>
            </div>    
        </div>";    

    }

    if($opened == true)
    {
        $page .="\n";
        $page .="\n";
    }
    return $page."\n";
}
?>        

I already managed to display the news result but I cannot assign sequential images for each category.


Thanks in advance for your help.
Sorry my bad English.

Sem título.jpg

Edited by juniorbocask8
codebox
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

First and foremost:
I'm pretty sure you're not allowed to share web-design code that you've purchased from such services.

And secondly, why would you ask web-design related things in the rAthena forums instead of contacting the support that actualy created your design/web-code?

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.