The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
template reading database data
hello,
I have a problem (how-to).. let me show you an example: PHP Code:
is there any way to solve that? cuz my brain out of data now! I try something like this but it's the same: PHP Code:
what I'm trying to achive? what is my idea? I want to show ads in a forum by a templete in a plugin, I read the ads data from the database then use str_replace to fetch that template in exact place where i want regarding to the if statment if there is a better way please tell me I think my way to achive this is wrong! thanks alot |
#2
|
||||
|
||||
It's hard to tell what you are doing wrong since you aren't giving us the real if statements.
|
#3
|
||||
|
||||
sorry the if statements look like:
PHP Code:
PHP Code:
PHP Code:
the template always read the last variable in the plugin no matter if there is (if)s or not hope it's clear to find where is the problem thanks for your response |
#4
|
||||
|
||||
The way things are written, all three variables could be non-zero (I would guess) and so you end up going through each if statement and they write over each other (in each you set $ain_id to something).
If all you are doing is placing something at the beginning or end of the navbar, why don't you just append it instead of using str_replace? (something like $navbar = $navbar . $ain_tableh . $ain_tablef) |
#5
|
||||
|
||||
I see.. if all three variables non-zero they write over each other
so what should I do to execute the code after each if statement before get ride of it? it's not always placing at the beginning or end of the navbar |
#6
|
||||
|
||||
Since I don't know what you are doing, or what your thinking is, I really can't recommend anything else to do. Sometimes it helps to write out what you want in english and write out all the logic involved and then write your conditions afterwards.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|