Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8227483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:08:30+00:00 2026-06-07T16:08:30+00:00

Current code gives me output to li, and I want to adjust the output

  • 0

Current code gives me output to “li”, and I want to adjust the output to be in valid XML so I can create RSS feed from that list. Any advice?

Here is my code so far:

<?php
session_start();
mb_internal_encoding( 'UTF-8' );
require_once('../config.php');
require_once('../dbconnect.php');
echo ' <div class="tagsz clearfix"> ';
echo "<ul id='mytags_ara'>";
echo "<h2 class='title'>English Trends</h2>";
echo ' <div class="tagsz clearfix"> ';
 echo "<ul id='mytags_en'>";
 $query = "SELECT hashtag, sum(count) as total FROM `trending_topics` WHERE lang=0   and  hashtag != '' and date >= date_sub(left(now(), 10), interval 1 day) group by hashtag      order by total desc";
  $res = mysql_query($query);
 $index = 0;
 $hashtags = null;
 while($row = mysql_fetch_assoc($res) ) {
 $hashtag = $row['hashtag'];
 if( strtolower($hashtag) != 'newnew' && strtolower($hashtag) != 'new' && strtolower  ($hashtag) != 'more' )  {
 echo "<li><a class='size".$index."'".$hashtag."'>#".$hashtag."</a></li>";
 $index++;
 }
 if($index==6) break;}
 echo "</ul>";
 echo "</div>";
 ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:08:32+00:00Added an answer on June 7, 2026 at 4:08 pm

    This may or may not help you out, but this was the code I used to use to generate an Atom feed:

    <?php
        define('DS', DIRECTORY_SEPARATOR);
        define('ROOT', dirname(dirname(__file__)));
        define('HOST', 'http://' . $_SERVER['HTTP_HOST'] . dirname( $_SERVER['PHP_SELF'] ) );
    
        function publishAtom() {
                /*
                My data entities had these fields:
                - title
                - category
                - permalink (a URL-safe version of the title)
                - timestamp
                - lastupdated
                - abstract
    
                You'll need to adjust the code below to match your entities.
                */
    
                # get the data
                $rows = //<<insert your data-gathering-code here>> -> needs to be an array of your entities;
    
    
                $feed_title = "Atom Feed";
                $feed_subtitle = "Get all our newest entries when you subscribe to the feed.";
                $site_domain = "http://yourdomain.com";
                $author_name = "Your Name";
                $author_email = "yourname@yourdomain.com";
    
                $feed = '<?xml version="1.0" encoding="utf-8"?>
                <feed xmlns="http://www.w3.org/2005/Atom">
                    <title>' . $feed_title . '</title>
                    <subtitle>' . $feed_subtitle . '</subtitle>
                    <link href="' . $site_domain . '/atom.xml" rel="self" />
                    <link href="' . $site_domain . '" />
                    <updated>' . date('c') . '</updated>
                    <author>
                        <name>' . $author_name . '</name>
                        <email>' . $author_email . '</email>
                    </author>
                    <id>tag:' . str_replace( "http://", '', $site_domain ) . ',2012:feed</id>';
    
                # Get the entries
    
    
                foreach( $rows as $row ) {  
                    $feed .= '<entry>
                        <title>' . $row->title . '</title>
                        <link href="' . strtolower( $site_domain . DS . $row->category . DS . $row->permalink ) . '" />';
    
                        $date= date( 'Y-m-d', strtotime( $row->timestamp ) );
                        $uuid = str_replace( "http://", '', $site_domain ) . ',' . $date . ':' . $row->permalink;
    
                    $feed .= '<id>tag:' . $uuid . '</id>';
    
                    if( isset( $row->lastupdated ) ) {
                        $feed .= '<updated>' . date( 'c', strtotime( $row->lastupdated ) ) . '</updated>';
                    }
                    else {
                        $feed .= '<updated>' . date( 'c', strtotime( $row->timestamp ) ) . '</updated>';
                    }
    
                    $feed .= '<summary>Entry for ' . $date . '</summary>
                        <content type="xhtml" xml:lang="en">
                            <div xmlns="http://www.w3.org/1999/xhtml">' . $row->abstract . '</div>
                        </content>
                    </entry>';
                }
    
                $feed .= "</feed>";
    
                $path = ROOT . DS . "atom.xml";
                $filenum=fopen( $path, "w" );
                fwrite( $filenum, $feed );
                fclose( $filenum );
            }
        }
    
        # call this function wherever is relevent for you
        publishAtom();
    ?>
    

    It should give you an idea of how to do this manually. HTH.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a code that gives an output, and what I need to
My current code needs to read foreign characters from the web, currently my solution
Given this code snippet that can be readily pasted into Linqpad (or slightly modified
I got the below code from @DanS at this link how-to-display-a-map-still-image-file-with-a-moving-current-location onCurrentPosition(Location current){ double
I am attempting to get the current weather given a zip code or a
current code (not working): /^script\s*type=\text\/javascript/i.test(tagName)
current code I've built function to do something over collection of jQuery elements: var
My current code uploads image successfully but still it does not show Toast message
My current code is this $swift = email::connect(); $swift->setSubject('hello') ->setFrom(array('alex@example.com.au' => 'Alex')) ->setTo(array('alex@example.com.au' =>
Here is the current code in my application: String[] ids = str.split("/"); When profiling

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.