Skip to content

Commit

Permalink
The recent articles table displayed an error off of one users table s…
Browse files Browse the repository at this point in the history
…tructure, the problem arrived because even though in all other cases I checked the table produced the proper output, in this particular users case, the yql query return's structure was uniquely different. so, I added basic conditionals to test throughout the structure of the yql query before I attached content from it to my xml structure.

I did the same for all the tables in the YVoices family
  • Loading branch information
houyhnhnm committed Mar 15, 2012
1 parent 13e6c41 commit c7522c2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions YVoices/YVoices.fans.xml
Expand Up @@ -37,6 +37,8 @@
}
while(index<yqlcounter2)
{
if((yqlresults.div)&&(yqlresults.div.a[index].img))
{
subregex=yqlresults.div.a[index].@href;
subregex2=new String(subregex.match(patt1));
subregex3=new String(subregex2.match(patt2));
Expand All @@ -48,6 +50,7 @@
</node>
index++;
}
}
response.object=xmlret;
]]>
</execute>
Expand Down
3 changes: 3 additions & 0 deletions YVoices/YVoices.favorites.xml
Expand Up @@ -29,6 +29,8 @@
}
while(index<yqlcounter2)
{
if((yqlresults.div)&&(yqlresults.div.a[index].img))
{
xmlret.root+=<node>
<title>{yqlresults.div.a[index].@title}</title>
<description>{yqlresults.div.a[index].@title}</description>
Expand All @@ -37,6 +39,7 @@
</node>
index++;
}
}
response.object=xmlret;
]]>
</execute>
Expand Down
6 changes: 6 additions & 0 deletions YVoices/YVoices.featuredarticles.xml
Expand Up @@ -26,21 +26,27 @@
{
if(yqlresults.div[index].span.length()>0)
{
if((yqlresults.div[index].a)&&(yqlresults.div[index].div)&&(yqlresults.div[index].div.img))
{
xmlret.root+=<node>
<title>{yqlresults.div[index].span[0].text()}</title>
<description>{yqlresults.div[index].span[1].text()}</description>
<link>{yqlresults.div[index].a.@href}</link>
<thumbnail>{yqlresults.div[index].div.img.@src}</thumbnail>
</node>
}
}
else
{
if((yqlresults.div[index].a)&&(yqlresults.div[index].a.span[0])&&(yqlresults.div[index].a.span[1]))
{
xmlret.root+=<node>
<title>{yqlresults.div[index].a.span[0].text()}</title>
<description>{yqlresults.div[index].a.span[1].text()}</description>
<link>{yqlresults.div[index].a.@href}</link>
</node>
}
}
index++;
}
response.object=xmlret;
Expand Down
6 changes: 6 additions & 0 deletions YVoices/YVoices.recentarticles.xml
Expand Up @@ -26,6 +26,8 @@
{
if(parseInt(yqlresults.li[index].div.length())>1)
{
if((yqlresults.li[index].div[1].div[0])&&(yqlresults.li[index].div[1].div[1])&&(yqlresults.li[index].div[1].a)&&(yqlresults.li[index].div[1].div[1])&&(yqlresults.li[index].div[1].a.@href)&&(yqlresults.li[index].div[1].div[0].p)&&(yqlresults.li[index].div[0].img.@src))
{
xmlret.root+=<node>
<title>{yqlresults.li[index].div[1].a.text()}</title>
<description>{yqlresults.li[index].div[1].div[1]}</description>
Expand All @@ -34,15 +36,19 @@
<thumbnail>{yqlresults.li[index].div[0].img.@src}</thumbnail>
</node>
}
}
else
{
if((yqlresults.li[index].div.div[0])&&(yqlresults.li[index].div.div[1])&&(yqlresults.li[index].div.a)&&(yqlresults.li[index].div.div[1].p)&&(yqlresults.li[index].div.a.@href)&&(yqlresults.li[index].div.div[0].p))
{
xmlret.root+=<node>
<title>{yqlresults.li[index].div.a.text()}</title>
<description>{yqlresults.li[index].div.div[1].p.text()}</description>
<link>{yqlresults.li[index].div.a.@href}</link>
<pubdate>{yqlresults.li[index].div.div[0].p.text()}</pubdate>
</node>
}
}
index++;
}
response.object=xmlret;
Expand Down
3 changes: 3 additions & 0 deletions YVoices/YVoices.recentcomments.xml
Expand Up @@ -24,6 +24,8 @@
xmlret=<root><count>{yqlcounter}</count></root>;
while(index<yqlcounter)
{
if((yqlresults.li[index].cite)&&(yqlresults.li[index].cite.span)&&(yqlresults.li[index].p))
{
xmlret.root+=<node>
<title>{yqlresults.li[index].cite.span.text()}</title>
<description>{yqlresults.li[index].p.text()}</description>
Expand All @@ -32,6 +34,7 @@
</node>
index++;
}
}
response.object=xmlret;
]]>
</execute>
Expand Down

0 comments on commit c7522c2

Please sign in to comment.