< Back to Toplists

Cross-Script Toplists

Presuming you own multiple WSN scripts, sometimes you may wish to show toplists of items from a different WSN script than the one you're in. The toplist syntax remains the same as usual for the most part, with the first term changing to indicate the desired database table. It's easiest to explain this by example. Here's a toplist that will show the five newest images from WSN Gallery within any of the other scripts:

<!-- BEGIN TOPLIST -->
<CONFIG>wsngallery_links[,]id[,]5[,]descending</CONFIG>
<a href="
{LINKDETAILSURL}">{LINKTHUMBIMAGE}</a>
<!-- END TOPLIST -->

sngallery_links is simply the name of the database table you want the data from, which you can find in phpmyadmin. For another example, here's a way to show the most recently posted in ten threads from WSN Forum within WSN Links (or Gallery or KB):
<!-- BEGIN TOPLIST -->
<CONFIG>wsnforum_links[,]lastpost[,]10[,]descending</CONFIG>
<a href="
{LINKTHREADURL}">{LINKTITLE}</a> by {LINKOWNERNAME}<br>
{LINKMESSAGE[50]}<br>
<!-- END TOPLIST -->


Finally, you can show similar threads from your forum within WSN Links (or vice versa, or any other combination) with a special toplist condition like this:
<!-- BEGIN TOPLIST -->
<CONFIG>wsnforum_links[,]time[,]5[,]descending[,]MATCH (title) AGAINST('{LINKTITLE}')</CONFIG>
<a href="{LINKTHREADURL}">{LINKTITLE}</a><br>
<!-- END TOPLIST -->

You can do cross-script toplists for posts, forums/forums, etc as well just by using the appropriate table name.

Troubleshooting

Important note: when doing URL rewriting, you must have the same rewrite formatting (except for template variables being of the host script's type of course) on all the scripts involved for it to rewrite correctly in cross-script toplists. You can work around this by writing out non-rewritten versions of the URLs, if you need to.