The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#11
|
||||
|
||||
If you use a new API like ARR, make it your own API and don't extend it.
You could extend API like Page, Node, User... but why your own?! PHP Code:
HTML Code:
{vb:data userIds, testimportarray:arr, getArray} {vb:debugvardump $userIds} |
#12
|
||||
|
||||
It works like a charm. Thank you shka! Thank to all!
--------------- Added [DATE]1544164891[/DATE] at [TIME]1544164891[/TIME] --------------- One problem left. Why I cannot use that array in a condition? Code:
{vb:data arrayofuserids, arr, getArray} {vb:debugvardump $arrayofuserids} HTML Code:
var_dump: $arrayofuserids array(4) { [0]=> string(2) "1 " [1]=> string(4) "2 " [2]=> string(2) "3 " [3]=> string(1) "4" } But... Code:
{vb:data arrayofuserids, arr, getArray} <vb:if condition="in_array($conversation['userid'], $arrayofuserids)">...</vb:if> Solved. My solution: PHP Code:
Code:
{vb:data arrayofuserids, arr, getArray} {vb:set userIds, {vb:php explode, ',', {vb:raw arrayofuserids.0}}} <vb:if condition="in_array($conversation['userid'], $userIds)">...</vb:if> |
#13
|
|||
|
|||
Von hinten durch die Brust
|
#14
|
||||
|
||||
Ja, voll. Die vB-Templates nerven ganz sch?n. Das dauert noch, bis ich das kann.
|
#15
|
||||
|
||||
Dein Array-Inhalt sind strings. Du ben?tigst aber int.
PHP Code:
HTML Code:
var_dump: $array array(3) { [0]=> int(2) [1]=> int(3) [2]=> int(4) } HTML Code:
<vb:if condition="in_array($user['userid'], $array)"> Yes <vb:else /> No </vb:if> |
#16
|
||||
|
||||
Die Vermutung hatte ich auch. Ich lade das Array aber aus einer Datei. Will nicht jedesmal neu aus der DB laden. Bei mir lautet die Zeile also return file('path/file'); wo vorher die userids untereinander standen und jetzt als eine Zeile, durch Kommas getrennt. Diesen ganzen Aufwand k?nnte ich mir sparen, wenn ich die Tabelle in der Foren-DB anlegen w?rde. Da ?berlege ich noch, weil ich Sicherheitsbedenken habe.
|
#17
|
|||
|
|||
I think the problem with his first try is - his strings are two chars (with \n ?)
He wrotes PHP Code:
|
#18
|
||||
|
||||
Quote:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|