The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
Im trying to get my head round more of this plugin stuff.
In vB options I have a textarea. I explode that out into an array then I want to loop each item to display in an unordered list where ever on the template. How can I make this more compatable with vB? PHP Code:
![]() |
#2
|
||||
|
||||
![]()
Your only issue is the second <ul> tag. It should be a closing </ul> instead. Aside from that it should work, as long as the $vbulletin->options['html'] variable has newline characters in it. Otherwise it will all display on one line.
As a matter of convension, you should change those option names, go with a prefix like... $vbulletin->options['mymod_enabled'] $vbulletin->options['mymod_html'] That way nothing interferes with one another later on down the road. |
#3
|
|||
|
|||
![]()
Sorry that was a problem with my syntax but the original problem still exists.
How can I display this loop in a template? Would it be best to write whatever the loop outputs to a template then include that template on another template? If so, how would I do that? |
#4
|
||||
|
||||
![]()
You need to put that php in a plugin - php cannot go into a template.
|
#5
|
|||
|
|||
![]()
Yeah I know, I've got trouble showing the contents of this plugin though.
|
#6
|
||||
|
||||
![]()
To get it in a template, you shouldn't echo. You need to stuff it into a variable like $output_list.
PHP Code:
Code:
<if condition="$vbulletin->options[mymod_enabled]"> $output_list </if> |
#7
|
|||
|
|||
![]()
That doesn't work :|
|
#8
|
||||
|
||||
![]()
You may want to check if items exist in $items first.
|
#9
|
|||
|
|||
![]()
Yeah there is.
|
#10
|
||||
|
||||
![]()
I meant add a PHP code check, and then you can just do (in the template):
Code:
<if condition="$output_list">$output_list</if> |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|