This is more of a general programming question as opposed to a PHP question, however the PHP language is the one I am using current.
I will show you a dilemma which I am having and I not found a solution as of yet; will be interesting to see the answer.
Full file (only short, jQuery is loading this in):
<?php
require_once('../../../wp-blog-header.php');
header('HTTP/1.1 200 OK');
?>
<br /><br /><br /><br /><br /><img id="quoteOne" src="http://www.1.co.uk/wp-content/themes/1/images/quote1.png">
<span><?php
query_posts(array(
'cat' => 39,
'order' => 'ASC', // ASC
'orderby' => 'rand',
'showposts' => 1,
));
$wp_query->is_archive = true; $wp_query->is_home = false;
if (have_posts()) : while (have_posts()) : the_post();
the_content();
//the_id();
endwhile; endif;
session_start();
$_SESSION['i'] = the_id();
$prev = $_SESSION['i'];
//echo $_SESSION['i'];
//$_SESSION['i']++;
?>
<a href="#" style="color: #86a53e;" id="nextQu">NEXT QUOTE</span>
</span>
PHP (code in question):
// the_id() returns current id of post
session_start();
$_SESSION['i'] = the_id();
$prev = $_SESSION['i'];
The objective of this snippet is to check that the current id does not equal the previous id (to prevent duplicates showing and looking like nothing is happening). I need to be able to perform something like;
if($previous == $current){
// try again
}
I cannot find a way to store it without it being reset every time. Is there a way of programming to do this?
This file is loaded via: (a separate file)
$('#testimonialContent').load('http://www.1.co.uk/wp-content/themes/1/testimonialPull.php');
Not 100% sure what you’re asking, but is this what you want?