Search the Community
Showing results for tags 'snippet'.
-
Hi ... I have the following code embedded in the main page of my website, <?php $seenSnippets = $this->session->userdata('seenSnippets'); if(!is_array($seenSnippets)) $seenSnippets = array(); $lastSeenSnippet = $this->session->userdata('lastSeenSnippet'); if(!strlen($lastSeenSnippet)) $lastSeenSnippet = -3; $snippets = array(); LIST OF SNIPPETS $unseenSnippets = array_keys($snippets); if(count($seenSnippets)) { if(count($seenSnippets) == count($snippets)) $seenSnippets = array($lastSeenSnippet); $unseenSnippets = array_diff($unseenSnippets,$seenSnippets); } // Pick a random one that has not been seen $snippetIDX = array_rand($unseenSnippets); $seenSnippets[] = $snippetIDX; $lastSeenSnippet = $snippetIDX; $snippet = $snippets[$snippetIDX]; $this->session->set_userdata('seenSnippets', $seenSnippets); $this->session->set_userdata('lastSeenSnippet', $lastSeenSnippet); echo $snippet; ?> Whenever I try to remove a snippet or two from the list, the most recent version of FireFox displays the following error (IE and Chrome work fine), A PHP Error was encounteredSeverity: Notice Message: Undefined index: Filename: views/vmain.php Line Number: 890 Line 890 contains the following code, $snippet = $snippets[$snippetIDX]; Although the code is embedded and there's no specific database for the snippets, I suspect codeignitor caches the snippets somewhere, as this problem is somewhat intermittent. I can't figure out or imagine where the snippets cache might reside. All browsers are up to date, as of today. My desktop uses Windows 7. Any ideas, advice or help much appreciated. dgp