I have an idea that might help if you're interested.
Build all the data into an array, then create a loop which dumps each line into a display template to display it all.
That seperates data from formatting and makes it easier to change how you display things by just changing the HTML template rather than the PHP Code itself.
This is completely non-working code, but something such as;
while $array
{
showitem($array[line]);
}
My big problem with Xoops is the fact that it's truly obfuscated now. 1/2 of it uses template, the other half is hard-coded HTML inside of classes of PHP code. (which sucks).
Wayne