![]() |
Using Combined Template Conditionals
I'm trying to understand how to use conditionals in templates, using the following thread as an initial guide:
https://vborg.vbsupport.ru/showthread.php?t=217570 So basically what I'm trying to do is to show a track listing. Let's say the following is what's in the database: Field "trackartist": Artist 1, Artist 2, Artist 3 Field "tracktitle": Title 1, Title 2, Title 3 So I need to figure out how to convert the following php code so that it's compatible with vBulletin: Code:
$doquery = mysql_query("SELECT trackartist, tracktitle FROM `tracklisting`"); Artist 1 - Title 1 Artist 2 - Title 2 Artist 3 - Title 3 The problem is, I don't know how to combine template conditionals, meaning I was only able to show each variable separately: Code:
<vb:each from="trackartist" key="character1" value="trackartist"> Artist 1 Artist 2 Artist 3 Code:
<vb:each from="tracktitle" key="character2" value="tracktitle"> Title 1 Title 2 Title 3 The closest I was able to get to the correct result was the following: Code:
<vb:each from="trackartist" key="character1" value="trackartist"> Artist 1 - Title 1 Artist 1 - Title 2 Artist 1 - Title 3 So how do I get the correct result? Any help would be greatly appreciated! |
Just concat the HTML output in the loop.
PHP Code:
|
Quote:
|
It would be even better if you didn't use HTML in the code.
Instead of PHP Code:
PHP Code:
|
Thanks for the additional tip Retal. I'll use your code and if I encounter any problems I'll post questions.
|
All times are GMT. The time now is 11:21 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|