PDA

View Full Version : Display names


Mysterious2207
10-18-2009, 01:51 PM
Well, I was trying to implement a "Display names" system into my forum, but it crossed my mind that a text field couldn't easily handle the HTML and stuff from usergroups.

Bascially, my question is, how would I go about editing "musername", the actual variable, to contain something like:
<if condition="$post['field10']">
ALL THE STUFF WITH HTML HERE
<else />
$musername
</if>
My current code (edited in postbit) looks like:
<if condition="$post['field10']">
$post[field10]
<else />
$post[musername]
</if>
</a>

Or something similar in style, pretty much all I need is the location of the actual "musername".

Thanks,
Danny

DeanLag
10-18-2009, 02:14 PM
I think your condition code is missing something.
Lets assume the name field is field10 and it contains 'Mysterious'

Then your code is only doing
If Mysterious then
ALL THE STUFF WITH HTML HERE
Else
Mysterious2207
Endif

I think what you want to do is

<!-- If name field is not empty -->
<if condition="$post['field10'] !== (NULL)">
<!-- then display name -->
$post['field10']
BLA BLA
<else />
<!-- if name field is empty then display username markup-->
$post[musername]
</if>

I'm not sure about that and I don't really understand what you're really trying to do.
I don't know whats the value of an empty field. Is it '0'? So might want to know the default value for an empty field first D:

Mysterious2207
10-18-2009, 02:18 PM
I know that, however, I need the HTML to stay from the usergroup markup. So, right now, I want to edit "musername" itself to check for field10, if that's possible.

DeanLag
10-18-2009, 03:18 PM
<!-- If name field is not empty -->
<if condition="$post['field10'] !== '' ">
<!-- then display name -->
$post['opentag'] $post['field10'] $post['closetag']
BLA BLA
<else />
<!-- if name field is empty then display username markup-->
$post[musername]
</if>

Try it, not sure =x

Mysterious2207
10-18-2009, 03:27 PM
That will display opening and closing HTML then, right?

DeanLag
10-18-2009, 03:28 PM
Try it and lemme know!

Mysterious2207
10-18-2009, 04:48 PM
It didn't work :(.

By the way, the first codebox I showed was my idea of what to do with musername, I'm more fond of Java so here's what it would look like in Java:
public class musername() {
if(field10.doesContainText()) {
showHTMLBegin();
showDisplayName();
showHTMLEnd();
} else {
showHTMLBegin();
showUsername();
showHTMLEnd();
}
}

That may look a little simpler as what I'm trying to do, that way, instead of editing the actual template, the username itself would change and keep the same HTML markups.