The forum of the forums
Welcome on the Forumotion Support Forum.

To take full advantage of everything offered by our forum, please log in if you are already a member or join our community if you're not yet....



Create a free forum like this one.

PHP/JScript Question? : ID etc. Selector for Individual Profile Field

View previous topic View next topic Go down

Solved PHP/JScript Question? : ID etc. Selector for Individual Profile Field

Post by ElMuggs on August 7th 2011, 12:36 am

Okay this is a bit of a curly question.

I've been working on toggling the profile field information shown under the avatar to save space on posts. I'm using punBB in this case on our testboard.

Now I have two fields that I want to always display.

you can see it working here with the show/hide button under the Avatar.

I want to set the Nationality icon and Race (Muggle) Icon to always display

should be pretty simple right?

Except that it involves having a unique ID for each field.
Which Forumotion's doesn't seem to have (though logically one must exist).

Anyone got any ideas?

ElMuggs
Forumotion Member

Posts: 90
Age: 26
Language: CSS / HTML / BBcode / Javascript / Graphics and Tech Support yeech..
Location: Deep in the belly of the code
Points: 77
Join date: 2011-05-01

http://wizardswb.forumotion.com

Back to top Go down

Solved Re: PHP/JScript Question? : ID etc. Selector for Individual Profile Field

Post by slg on August 7th 2011, 12:39 am

Can you not just remove those two items from the code, so they appear?

----------------------------

Helpful Links

Forum Rules

Lost Founder's Password
(Do not send me a PM about resetting your password.
Send a PM to one of the listed staff members in the link.)

Tricks & Tips

Frequently Asked Questions

How To Report A Forum

slg
Support Moderator
Support Moderator

Male
Posts: 5072
Age: 39
Language: English
Location: Texas, United States
Points: 6711
Join date: 2009-08-17

http://www.zootycoonwildlife.aforumfree.com

Back to top Go down

Solved Re: PHP/JScript Question? : ID etc. Selector for Individual Profile Field

Post by ElMuggs on August 7th 2011, 1:09 am

I wish!

but the profile fields are all dynamically added though php (which can't be modified in the template). there's no way to separate them in the code.

The code is as follows:

Code:
   <div class="user-info toggle">
                        <!-- BEGIN profile_field -->
{postrow.displayed.profile_field.LABEL}{postrow.displayed.profile_field.CONTENT}{postrow.displayed.profile_field.SEPARATOR}
                        <!-- END profile_field -->
                        {postrow.displayed.POSTER_RPG}
                     </div>


Ideally there would be a field such as {postrow.displayed.profile_field.ID} but I've been using trial and error to find one without any luck.

ElMuggs
Forumotion Member

Posts: 90
Age: 26
Language: CSS / HTML / BBcode / Javascript / Graphics and Tech Support yeech..
Location: Deep in the belly of the code
Points: 77
Join date: 2011-05-01

http://wizardswb.forumotion.com

Back to top Go down

Solved Re: PHP/JScript Question? : ID etc. Selector for Individual Profile Field

Post by Darren1 on August 7th 2011, 1:49 am

G'Evening Very Happy

That's the thing with our templates, there's alot that are either too closely links so if u edit it, it screw the other over, or it's all mashed into 1 code so u can't edit it TT

I'm not aware of a code, or way that's able to do what you wish.

Darren1
Helper
Helper

Male
Posts: 11525
Age: 20
Language: Australian, English - UK
Location: Mass release of tutorials coming!
Points: 35869
Join date: 2008-07-09

http://testorial.forumotion.com

Back to top Go down

Solved Re: PHP/JScript Question? : ID etc. Selector for Individual Profile Field

Post by ElMuggs on August 7th 2011, 3:18 am

Cheers Darren, I wanted to know if i was overlooking anything before I started looking at some curly Javascript solutions Razz

Looks like it might be a case of finding a way to 'strip' the dirtycode from the label variable to create a id or somesuch. *sigh* fun fun.

ElMuggs
Forumotion Member

Posts: 90
Age: 26
Language: CSS / HTML / BBcode / Javascript / Graphics and Tech Support yeech..
Location: Deep in the belly of the code
Points: 77
Join date: 2011-05-01

http://wizardswb.forumotion.com

Back to top Go down

Solved Re: PHP/JScript Question? : ID etc. Selector for Individual Profile Field

Post by Guest on August 7th 2011, 1:02 pm

Change this:

Code:
<div class="user-info toggle">
<!-- BEGIN profile_field -->
    {postrow.displayed.profile_field.LABEL}{postrow.displayed.profile_field.CONTENT}{postrow.displayed.profile_field.SEPARATOR}
<!-- END profile_field -->
<div>

to this:

Code:
<!-- BEGIN profile_field -->
    <div class="profile-field">
        {postrow.displayed.profile_field.LABEL}{postrow.displayed.profile_field.CONTENT}
    </div>
<!-- END profile_field -->

<div class="user-info toggle"></div>

<script type="text/javascript>
(code to append profile fields to toggle DIV)
</script>

Each profile field will now be enclosed in a DIV tag with a class name. Since you know the order of the profile fields, all you need is a short script that appends the desired profile field DIVs into the toggle DIV.

Guest
Guest


Back to top Go down

Solved Re: PHP/JScript Question? : ID etc. Selector for Individual Profile Field

Post by ElMuggs on August 7th 2011, 8:00 pm

Thanks heaps!

but it still doesn't assign the class values

using <div class="profile-field"> just gives all of them a value of profile-field

figuring a typo i tried <div class={profile-field}> but all that did was give them a blank value.

ElMuggs
Forumotion Member

Posts: 90
Age: 26
Language: CSS / HTML / BBcode / Javascript / Graphics and Tech Support yeech..
Location: Deep in the belly of the code
Points: 77
Join date: 2011-05-01

http://wizardswb.forumotion.com

Back to top Go down

Solved Re: PHP/JScript Question? : ID etc. Selector for Individual Profile Field

Post by Mr.Rulez on August 7th 2011, 8:28 pm

How did you make your background green?

Mr.Rulez
Forumotion Member

Posts: 36
Language: English
Points: 24
Join date: 2011-08-01

Back to top Go down

Solved Re: PHP/JScript Question? : ID etc. Selector for Individual Profile Field

Post by ElMuggs on August 7th 2011, 8:31 pm

Green is from the THANKS button. Smile

and good news!

Turns out that everything between the comments seems to run for each profile field.

So writing a little javascript I was able to generate a counter and assign it to a span around the value.

It's not perfect but it works Very Happy

first you need to define i in the header.
simple as adding

Code:


<script type="text/javascript">
var i = 1;
</script>


then insert the javascript between profile_field.LABEL and CONTENTS
Code:
<!-- BEGIN profile_field -->
    <div class=profile_field>
        {postrow.displayed.profile_field.LABEL}

<script type="text/javascript">
i++;

var id = "a" + i;

document.write('<span id="'+id+'">');

</script>

{postrow.displayed.profile_field.CONTENT}</span>
    </div>
<!-- END profile_field -->


so this is solved Rolling Eyes

ElMuggs
Forumotion Member

Posts: 90
Age: 26
Language: CSS / HTML / BBcode / Javascript / Graphics and Tech Support yeech..
Location: Deep in the belly of the code
Points: 77
Join date: 2011-05-01

http://wizardswb.forumotion.com

Back to top Go down

Solved Re: PHP/JScript Question? : ID etc. Selector for Individual Profile Field

Post by kirk on August 7th 2011, 9:14 pm

cool stuff.

Since the topic now appares to be solved i will now mark and lock the thread.

----------------------------



kirk
Manager
Manager

Male
Posts: 9943
Language: Computer Science, Adobe Photoshop CS5 Extended, Magix Pro X3 Video Editing, Web/Social Networking & Development
Points: 35446
Join date: 2008-09-17

http://www.forbiddentempleofart.org/

Back to top Go down

View previous topic View next topic Back to top


Permissions in this forum:
You cannot reply to topics in this forum