Difference between revisions of "HypertWiki:Code/lib/data"

From HypertWiki
Jump to navigation Jump to search
(rewrite of blogpost listing SQL)
(some tidying)
Line 242: Line 242:
</func>
</func>


<func ShowRecentBlogEntriesByTopic max iTopic>
<func ShowRecentBlogEntriesByTopic max topic>
  <let name=idx />
   <let name=including val=1 />
   <let name=including val=1 />


  <let name=topic farg=iTopic />
   <let name=topic self with="_"> </let>
   <let name=topic self with="_"> </let>


   <let name=sqlWhere>(cl_to='</let>
   <let name=sql>(cl_to='</let>
   <let name=sql>SELECT q1.* FROM qryW3_Titles_Catgs AS q1 LEFT JOIN qryW3_Titles_Catgs AS q2 ON q1.cl_from=q2.cl_from WHERE (q1.cl_to='Data/blog/post') AND (q2.cl_to='</let>
   <let name=sql>SELECT q1.* FROM qryW3_Titles_Catgs AS q1 LEFT JOIN qryW3_Titles_Catgs AS q2 ON q1.cl_from=q2.cl_from WHERE (q1.cl_to='Data/blog/post') AND (q2.cl_to='</let>
   <let name=sqlWhere append copy=topic />
   <let name=sql append copy=topic />
   <let name=sqlWhere append>') SORT page_title DESC LIMIT=</let>
   <let name=sql append>') ORDER BY page_title DESC LIMIT </let>
   <let name=sqlWhere append copy=max />
   <let name=sql append copy=max />
<echo>SQL 1: <get name=sql /></echo>


  <let name=noLoad val=1 />
   <for sql=$sql>
 
   <for sql=$sql hide>
     <let name=pg_nspace_code>{{ns:</let>
     <let name=pg_nspace_code>{{ns:</let>
     <let name=pg_nspace_code append val=@row.page_namespace />
     <let name=pg_nspace_code append val=@row.page_namespace />

Revision as of 17:59, 14 September 2011