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 6638501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:26:36+00:00 2026-05-25T23:26:36+00:00

In my application I have two pages. Index and engine. Index has mostly jQuery

  • 0

In my application I have two pages. Index and engine. Index has mostly jQuery scripts and the basic two of them is an autoload function for the engine.php file that happens every 3 mins, and the other one is a “show more” button that shows 10 more posts when it is clicked.

$feeds = array('','');
$entries = array();
foreach ($feeds as $feed) {
$xml = simplexml_load_file($feed);
$entries = array_merge($entries, $xml->xpath('/rss/channel//item'));
}

What I am looking for is a way to separate the $feeds = array('',''); part that is loaded with the engine.php on every 3 mins or click.

What is your suggestions about that ?

  • 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-05-25T23:26:36+00:00Added an answer on May 25, 2026 at 11:26 pm

    I’m not sure I understand your question, but global variables are defined in php if they’re defined outside all functions. To use them inside, you have to reference it like this before using it:

    $variable = ""; //this variable is global
    function test(){
       global $variable;
    
       //now you can use your variable
    }
    

    If what you meant, is that the value for your variable need to be persisted between requests, then I would suggest you use the $_SESSION array (link).

    If this does not answer your question let me know.

    Edit for updated answer

    You’ll have to persist the $feeds array in some way. I think the easiest way would be to use the session, but that won’t make the array available to all users like you mentioned. So I’d suggest you persist the list of feed on a file, that way you can access the same information every time for all users.

    Doing that you can create a new script that will updated the file whenever you want (i.e every 10 minutes), and the engine.php will only have to work directly with the file.

    Do you need some specific help with code for this proposed solution? Does it help you solve your problem?

    Edit2

    To save your $feeds array to a file, simply do the following (I guess this part you already know):

    $fp = fopen("feeds.txt", "a");
    if($fp) {
       foreach($feeds as $line) {
          fwrite($fp, $line."\n");
       }
       fclose($fp);
    }
    

    And to load that same file, you can do this:

    $feeds = file("feeds.txt"); //This will load each  line into a different position of the array $feeds.
    

    If you want to serialize the $entries array, I would suggest taking a look at serialize & unserialize functions

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

Sidebar

Related Questions

I have an application on Facebook which has two pages, index.php and admin.php. On
I am developing an ASP.NET MVC application that has two kind of pages: (1)
In my application I have two Master pages and they are used in various
Here is the idea.... ...I have a index.php.... ... The application is have one
I have this simple MVC 3 application which simply has two controllers(Home and Edit),
I have two XML files that are generated by another application I have no
I have application in VB.net that have two different form (Form1 and Form2). Now
In Application i have two buttons in which one button is used as a
In my application i have two drop down boxes first box had origin second
I used pole display(E POS) in my POS c# application.I have two major problem

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.