WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Use of Global Variables or Caching

[Resolved] Use of Global Variables or Caching

  • Hi there,

    I’m trying to enhance the simplerssfetcher plugin and would like to build in some kind of caching, that for all users reloading the configured rss feed is done only daily or once a week.

    I tried to set some global variables, but whenever the page is reloaded (and so is the srssfetcher plugin) the global vars are empty.

    here some code:

    global $myVar;
    // Display srssfetcher messages
    function srssfetcher($rss = '', $num = 5, $list = true, $update = true, $linked  = true, $encode_utf8 = false) {
      if(isset($myVar)) { echo 'hi'; }
      else { echo 'ho'; $myVar = 'notItIsSet';}
    ...

    from my understanding it should output “ho” once and from then on “hi”. but it always says “ho”.
    I also tried to use the $GLOBALS variable. Same here: whenever I add a value it is gone if I reload the page.

    Can somebody please help me??
    Cheers
    Stefan

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Use of Global Variables or Caching’ is closed to new replies.
Skip to toolbar