Sign in to follow this  
Followers 0
josito

URL slideshow

4 posts in this topic

On my main page I have a slideshow with the featured posts however, when I try to enter one of them I go to /undefined instead of the link I'm suppose to.

Any idea why?

 

// Featured posts


cat1 = 'zblog';


imgr = new Array();
imgr[0] = "http://sites.google.com/site/fdblogsite/Home/nothumbnail.gif";
showRandomImg = true;
aBold = true;
numposts1 = 12;
function recentposts1(json) {
    j = showRandomImg ? Math.floor((imgr.length + 1) * Math.random()) : 0;
    img = new Array;
    if (numposts1 <= json.feed.entry.length) maxpost = numposts1;
    else maxpost = json.feed.entry.length;
  document.write('<div class="blog_featured_posts owl_carouselle" style="display:none;">');
    for (var i = 0; i < maxpost; i++) {
        var entry = json.feed.entry[i];
        var posttitle = entry.title.$t;
        var tag = entry.category[0].term;
        var posturl;
        if ("content" in entry) var postcontent = entry.content.$t;
        else if ("summary" in entry) var postcontent = entry.summary.$t;
        else var postcontent = "";
        if (j > imgr.length - 1) j = 0;
        img[i] = imgr[j];
        s = postcontent;
        a = s.indexOf("<img");
        b = s.indexOf('src="', a);
        c = s.indexOf('"', b + 5);
        d = s.substr(b + 5, c - b - 5);
        if (a != -1 && (b != -1 && (c != -1 && d != ""))) img[i] = d;


            var trtd = '<div class="blog_featured_post"><a href="' + posturl + '"><div class="blog_contents"><h3>' + posttitle + '</h3> <div class="clr"></div><span>' + tag + '</span></div><div class="feat-img" style="background-image:url(' + img[i] + ');"></div></a></div>';
            document.write(trtd)
        j++
    }
    document.write('</div>')
};

 

Share this post


Link to post
Share on other sites

"posturl" is never given a value.

Share this post


Link to post
Share on other sites

"posturl" is never given a value.

 

Thank you for asnwer Ingolme.

Any idea how to get the URL post where I put the tag 'zblog'?

Share this post


Link to post
Share on other sites

I don't have any information about your data source.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0