PDA

View Full Version : two <IF>???


Chewy75
11-12-2010, 07:59 AM
Hi,

our users which to have an higher threadview as standard 150px.

I found this in the styles at showthreadlist:

<div style="height:auto; <if condition="$show['postlistwidth']">width:$postlistwidth;</if> overflow:auto; border:2px inset; padding: 0px; text-align:$stylevar[left];" class="alt1" id="links">

there i change the standard from 150px into auto, but for some users it is to much, they more like the smaller view...
Then I made an extra profilfield with radio-buttons, so they can chose a standard of 150px, double height of 300px or auto height.
But I don?t know how to put it into the style.

I just took the above code snippet and packed it into a simple if block:
<if condition="$post['field16'] & 1">
<div style="height:150; <if condition="$show['postlistwidth']">width:$postlistwidth;</if>
overflow:auto; border:2px inset; padding: 0px;
text-align:$stylevar[left];" class="alt1" id="links">
</if>

<if condition="$post['field16'] & 2">
<div style="height:300; <if condition="$show['postlistwidth']">width:$postlistwidth;</if>
overflow:auto; border:2px inset; padding: 0px;
text-align:$stylevar[left];" class="alt1" id="links">
</if>

<if condition="$post['field16'] & 4">
<div style="height:auto; <if condition="$show['postlistwidth']">width:$postlistwidth;</if>
overflow:auto; border:2px inset; padding: 0px;
text-align:$stylevar[left];" class="alt1" id="links">
</if>
but this doesn?t work. I don?t know realy much about it, but is ist possible that my code isn?t working because there are to if-questions in one block?
Is any one out here who has an idea to solve my problem?

best regards

Chewy

kh99
11-12-2010, 08:44 AM
I think maybe the problem is that with three radio buttons the possible values of field16 would be 1, 2, 3, ...

Edit: I think that was wrong...see below.

Chewy75
11-12-2010, 08:52 AM
Hi,

thanks for your reply, but the first radio button has an value of 1, the second has two, the third hast 4, the fifth has 8, 16, 32, 64 and so on

kh99
11-12-2010, 09:09 AM
That kind of sounds like checkboxes vs radio buttons, but maybe you're doing something I don't understand.

In either case, I think I was wrong - I think the values of a radio button field would be whatever strings are listed as the options in the profile field manger (I'm changing my mind because I went back and looked at a plugin a wrote a while back that checks the value of a custom user radio button field).

But again - maybe you're doing something different.

Chewy75
11-12-2010, 09:37 AM
I will try to explain exactly what I want to do, perhaps I am goning a totaly wrong way...

If you select thread-view or hybrid-view in a thread, then you will see a tree-structure in top of the postings in that thread. This tree structure is normaly 150 Pixels high. What I want to do is to allow users to change this height by their own.
I found the height in template: "showthread_list" and I thought best way to solve my problem is adding a field for the users selection and adding some little code to this template, but I am not a real coder so I looked arround for the syntax and so on and thougt the code of my frist posting would be near to that what I need...

kh99
11-12-2010, 12:10 PM
Well, it's easy enough to test what the value of field16 actually is: put this in your template:

<!-- Field16: $post[field16] -->

then view your HTML source to see what it is.

ETA: I think you are doing the right thing, I'm just thinking that if it's not working the problem may be the "if" conditions - but I could be wrong.

Chewy75
11-12-2010, 12:43 PM
Ok, this should be fault 1, in source it is empty: "<!-- -->"

--------------- Added 1289573415 at 1289573415 ---------------

ok the fault was that I was using the field from the wrong user...

<!-- $bbuserinfo[field13] --> outputs the value of the option exactly as you told earlier!

kh99
11-12-2010, 12:52 PM
(nvm - posted this before I read the above)

Chewy75
11-12-2010, 12:54 PM
I got it now in a very more simple way than I thought...

<div style="height:$bbuserinfo[field16]; <if condition="$show['postlistwidth']">width:$postlistwidth;</if>overflow:auto; border:2px inset; padding: 0px; text-align:$stylevar[left];" class="alt1" id="links">

kh99 I like to thank you very very much, you kicked me into the right direction ;-)