josito Posted March 7, 2017 Share Posted March 7, 2017 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>') }; Link to comment Share on other sites More sharing options...
Ingolme Posted March 7, 2017 Share Posted March 7, 2017 "posturl" is never given a value. Link to comment Share on other sites More sharing options...
josito Posted March 7, 2017 Author Share Posted March 7, 2017 "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'? Link to comment Share on other sites More sharing options...
Ingolme Posted March 7, 2017 Share Posted March 7, 2017 I don't have any information about your data source. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now