![]() |
Help show more than one result.
So I'm working on creating a mod for music base sites. I am trying to show the output for all of the latest mixtapes that was posted. I can get the one to show. But the rest doesn't show. Maybe I messed up some where in the code. Here is what I got.
PHP Code:
PHP Code:
PHP Code:
|
You need to register your template for use in another template: https://vborg.vbsupport.ru/showthread.php?t=228078
Save your template into a variable then preregister that variable into the main template. The variable will contain the HTML and parsed template syntax ready for use in the main template. Btw: You should wrap: PHP Code:
|
Am I putting this before my while statment, or would it be smarter to try using the foreach. I'm guessing my issue is all in my php page.
|
I think I've mistaken what you're trying to do.
You want: {vb:raw vbmusic_latest} To contain the contents of the HTML you posted in your first post? Assuming it's a template, PHP Code:
|
Yes, {vb:raw vbmusic_latest} contains all of the html.
Negative on showing up though. I'm guessing I have to do a foreach statement. |
Lol no.
Are you sure $vbmusic_latest contains the proper HTML? PHP Code:
|
after pasting this. I see NULL. No I know some where I'm messing up with registering the template to show.
|
Your code doesn't show $vbmusic_latest being registered at all. ;)
|
PHP Code:
1. The vbmusic_latest template still doesn't show. 2. For each album id, I want to display that album. I've looked through the original vb files. The closest would be foreach, but I'm lost now. |
1) Let's work on getting you to actually show your template first. :)
You really should look at that article I posted, because you're still doing it all wrong. PHP Code:
|
Damn, that was simple. I see where I went wrong.
I never put this in the code at all. PHP Code:
--------------- Added [DATE]1333786475[/DATE] at [TIME]1333786475[/TIME] --------------- I read the article, I guess I just wasn't pay attention to it. I really do appreciate it. I've sent you a link to see what I'm trying to accomplish over-all. Just by seeing how it's done, I learned alot faster on how to accomplish this. Now I'm just trying to figure out the foreach statement. I figured I could use the vb:each statement in the template, but that didn't work. |
I'm going to focus on your second problem now:
PHP Code:
PHP Code:
I've replace your unnecessary variables with an array and, furthermore, I've made sure each row gets it own place in the array. PHP Code:
Now replace all that ugliness in your first template render with: PHP Code:
I'd recommend using {vb:each [, ]} to loop through that array and do that. Read my article, it should help you get the basics down: https://vborg.vbsupport.ru/showthread.php?t=280880 |
Appreciate it so much. Just some free time during this deployment. I will read this article one more.
--------------- Added [DATE]1333821880[/DATE] at [TIME]1333821880[/TIME] --------------- I've been trying for hours. I've search on google, and read through your article. I'm assuming that I am making a mistake as to where I'm suppose to put the php code foreach. |
Yo, I am seriously lost.
This is my code in the template PHP Code:
PHP Code:
|
What are you doing? The code I gave you is what you should be using! What you're doing won't work. vb:each replicates the foreach function, so you shouldn't be using an actual foreach in your php code!
HTML Code:
<vb:each from="musicals" key="key" value="musical"> |
Okay, so I put the php code just like you shown, and I've put the vb:each in just like you just posted. Nothing shows.
I've been reading alot of articles. |
Post your complete PHP code and template code.
|
Php Code
PHP Code:
PHP Code:
|
Is the HTML you're showing me from template: vbmusic_latest, or from template: vbmusic
If it's from template: vbmusic, then you need to add: $templater->register('musicals', $musicals); to the register in that template. |
Well god damn, I knew it was something simple that I was over looking. That was it.
I see that your site is music related as well. I'm currently deployed to Afghanistan right now. If it's not to much, can I continue to ask you for help from time to time. I get about six hours of free time each day. If possible how may I contact you. |
Feel free to PM me.
|
All times are GMT. The time now is 10:03 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:
|