That’s exactly my goal. However, I wanted to do this without having to maintain the if/else template. Since my post, I’ve created this, maybe someone else will find it useful. It will continue to work even if the url_title of the listing page is changed, or even if the weblog to list is changed.
Now, to list the entries for a structure listing page, just embed _list-folder.
<!-- file: _list-folder -->
{exp:weblog:entries}
<?php
// process php on output
/*
This query works with the Structure module.
For a listing page, it looks up the name of the associated weblog to list.
Because we need to process results by EE, we call an embed.
*/
$sql_query = <<<EOT
SELECT blog_name AS sql_results
FROM exp_weblogs AS w
INNER JOIN exp_structure AS s
ON w.weblog_id = s.listing_wid
AND s.entry_id = '{entry_id}'
EOT;
?>
<!-- sql_query=<?=$sql_query?> -->
{embed="includes/_list-folder2" tQuery="<?=$sql_query?>"}
{/exp:weblog:entries}
The second file runs the query to figure out the weblog name, then lists the results.
<!-- file: _list-folder2 -->
{exp:query sql="{embed:tQuery}"}
<!-- sql_results={sql_results} -->
<ul class="list-weblog-{sql_results}">
{exp:weblog:entries weblog="{sql_results}" dynamic="off" disable="categories|member_data|pagination|trackbacks|comments"}
<li {if count==total_results}class="last" {/if}>
<a href="{page_url}">{title}</a>
<div>{description}</div>
</li>
{/exp:weblog:entries}
</ul>
{/exp:query}
I wish there were a Structure tag that would return the name of the weblog to list, so I could avoid the PHP complexity. Or I wish there were a way to make this work in a single file.
Anyway, maybe this will help the next person. Or someone will see this and point out a better way of doing it.