PDA

View Full Version : featuredcontentglider Error



Blue Ape
09-18-2011, 01:06 AM
1) Script Title: featuredcontentglider

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/featuredcontentglider.htm

3) Describe problem: I keep getting the error "No Content exists at page 1! Loading 1st page instead. I've changed the 8th line of the php to 0 and nothing new happened. Also selected feature content and featured photo on the posting but nothing. Actually none of the featured photos are even showing up on the main page. This all happened when I swapped out a few files with some offline updated versions and I can't get it to work anymore. (with the old files new ones or if I re install the theme) Also I have several posts set for the featured gallery too. It was working till I changed out the files from the theme.

http://markkoenig.net

jscheuer1
09-18-2011, 03:09 AM
Looking at the source code of that page, I see (some blank lines removed) the init followed by its markup:


<script type="text/javascript">

featuredcontentglider.init({
gliderid: "glidercontent",
contentclass: "glidecontent",
togglerid: "togglebox",
remotecontent: "",
selected: 0,
persiststate: true,
speed: 200,
direction: "leftright",
autorotate: true,
autorotateconfig: [10000, 1] //if auto rotate enabled, set [milliseconds_btw_rotations, cycles_before_stopping]
})

</script>

<div id="glidercontent" class="glidecontentwrapper">

<div id="togglebox" class="glidecontenttoggler">

<a href="#" class="prev"> &lt; Previous </a>
<a href="#" class="next"> Next &gt; </a>
</div>
</div>

As you can see there's no remote content specified and no content on the page either. The alert you're getting is simply telling you just that.

You need to add some content on the page, example:


<div id="glidercontent" class="glidecontentwrapper">
<div class="glidecontent">
Glide content 1 here
</div>

<div class="glidecontent">
Glide content 2 here
</div>

<div class="glidecontent">
Glide content 3 here
</div>
<div id="togglebox" class="glidecontenttoggler">

<a href="#" class="prev"> &lt; Previous </a>
<a href="#" class="next"> Next &gt; </a>
</div>
</div>

Or, specify a remote content page that has appropriate content.

Blue Ape
09-18-2011, 04:06 AM
Alright I can put in the catagories but before it broke all I had to do was post and it auto did it. It looks like in the code further down that it's set to this. Though I am a complete novice to code so unsure if I am correct on this. I have the same theme set up on another site and the code looks the same between the two ( kirkwashere.com )


<?php
$my_query = new WP_Query('category_name=featured&showposts= 3');
while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID;
?>

<div class="glidecontent">


<div class="glidim">
<?php $feature = get_post_meta($post->ID,'feature', true); ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" >
<img src="<?php echo ($feature); ?>" width="250" height="250" alt="<?php the_title(); ?>"/> </a>
</div>
<div class="glidmeta">
<h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
<div class="gmore">
<a href="<?php the_permalink() ?>">Read more</a>
</div>

So I put in your code to see but is there a way to attach it to a category instead of changing the code each time you want to add new content, because I created the post 10th day, and set it to be featured slider content, yet it wont post to it.

jscheuer1
09-18-2011, 06:34 AM
Well OK, that's a third option. You can use PHP to populate that area with content of the sort the script expects to see there.

But that's PHP, well mostly, whatever PHP imports must appear on the page in the sort of markup that the script requires. From what you say and the looks of the code, you must have that part worked out though.

But the PHP part isn't working any longer. Since it's pulling from posts, if the PHP code isn't getting the posts' data for any reason, or if there is no data to get, that would be a problem. It's impossible for me to tell for sure what the problem is. I think I'd need access to the server to be able to figure that out with certainty. I don't want that anyway. It looks like:


$my_query = new WP_Query('category_name=featured&showposts= 3');

isn't returning any data. So the while loop never executes. In cases where that happens, there needs to be some way for the PHP code to realize that and to instead bring in some default content.

But, as I said that's PHP. Nothing to do with this script. If you need help on the PHP ask in the PHP forum. But, as I say it just looks like there's nothing there to get, or that what it's looking for has moved. Folks in the PHP forum should be able to help with getting the code to recognize and react when it hasn't retrieved enough data.

Or that could be done via javascript. Move:


<script type="text/javascript">

featuredcontentglider.init({
gliderid: "glidercontent",
contentclass: "glidecontent",
togglerid: "togglebox",
remotecontent: "",
selected: 0,
persiststate: true,
speed: 200,
direction: "leftright",
autorotate: true,
autorotateconfig: [10000, 1] //if auto rotate enabled, set [milliseconds_btw_rotations, cycles_before_stopping]
})

</script>

to after the glider and add the highlighted to it:


. . . ref="#" class="prev"> &lt; Previous </a>
<a href="#" class="next"> Next &gt; </a>
</div>
</div>
<script type="text/javascript">
if(jQuery('#glidercontent').find('.glidecontent').size() < 3)
jQuery('#glidercontent').find('.glidecontent').remove().end().prepend(
'<div class="glidecontent">Default glide content 1 here</div>' +
'<div class="glidecontent">Default glide content 2 here</div>' +
'<div class="glidecontent">Default glide content 3 here</div>');
featuredcontentglider.init({
gliderid: "glidercontent",
contentclass: "glidecontent",
togglerid: "togglebox",
remotecontent: "",
selected: 0,
persiststate: true,
speed: 200,
direction: "leftright",
autorotate: true,
autorotateconfig: [10000, 1] //if auto rotate enabled, set [milliseconds_btw_rotations, cycles_before_stopping]
})

</script>