vForums Support Banner



 

Welcome Guest! Please Login or Register
vForums Support :: Programming & Coding :: Code Requests & Support :: Need help with code on mini-profile template - View Topic
Topic Rating: *****
Printable View
Aiken
Full Member
***

[Avatar]

Posts: 333
Status: Offline
Gender: Male
Location: In a very lonely place, the domain of despair
Age: 35
Joined:  
Reputation: 12%  


pmtwitterskypemsnyahooxfire
Need help with code on mini-profile template (7th Dec 09 at 7:02pm UTC)
Resolved - A code for custom profile field
The only thing I see is what is in the div by default

Code:
 
  1. <div id="DyouPost">{custom_value_2} Dyou</div>
  2. <script>
  3.  
  4. var Dyou; DyouNum, DyouBox; DyouBox1K; DyouPost;
  5.  
  6. Dyou = {custom_value_2};
  7.  
  8. DyouNum = (Dyou)/10;
  9.  
  10. DyouPost = '<div style="text: #000000;">';
  11.  
  12. DyouBox1K = new Array()
  13.  
  14. var n = -1;
  15.  
  16. if(DyouNum > 1000)
  17. {
  18. DyouPost = '<div style="height: 8px; width: 100px; background-color: #C0C000; float: left; margin: 1px;">10000+ Dyou</div>';
  19. } else {
  20.  
  21. if(DyouNum >= 100)
  22. {
  23. while(DyouNum >= 100)
  24. {
  25.  
  26. DyouBox1K[n++] = '<div style="height: 8px; width: 8px; background-color: #FFFF00; float: left; margin: 1px;">1K</div>';
  27. DyouNum -= 100;
  28.  
  29. }
  30. }
  31.  
  32. DyouBox = '<div style="height: 8px; width: ' + DyouNum + 'px; background-color: #FFFF00; float: left; margin: 1px;">' + DyouNum + ' Dyou</div>';
  33.  
  34. if(DyouBox1K.length > 0)
  35. {
  36. for(i = 0; i <= DyouBox1k.length; i++)
  37. {
  38.  
  39. DyouPost += DyouBox1K[i];
  40.  
  41. }
  42.  
  43. DyouPost += "<br>";
  44.  
  45. }
  46.  
  47. DyouPost += DyouBox;
  48.  
  49. }
  50.  
  51. DyouPost += "</div>
  52.  
  53. document.getElementById("DyouPost") = DyouPost;
  54.  
  55. </script>
  56.  
 



vF forums:
Perfect World RP
BLEACH Universe - Under Construction / Testing Phase
Xen Qarna RP - Stage I
Vyren Entar Battle Network RP - Under Construction / Maintenance Mode Enabled
the Final Anime Hideout
Ross
Administrator
*****

[Avatar]

Posts: 3,709
Status: Offline
Gender: Male
Age: 9 14
Joined:  

Additional Groups:
Support Team
***


Reputation: 45%  


pmwwwtwittergtalkvForum
Re: Need help with code on mini-profile template (7th Dec 09 at 10:46pm UTC)
Hi,

Can you post the link to your forum so I can check how that custom field is setup? You can PM it if you prefer {Smile}

Image
Aiken
Full Member
***

[Avatar]

Posts: 333
Status: Offline
Gender: Male
Location: In a very lonely place, the domain of despair
Age: 35
Joined:  
Reputation: 12%  


pmtwitterskypemsnyahooxfire
Re: Need help with code on mini-profile template (8th Dec 09 at 3:54am UTC)
http://xenqarnarp.vforums.co.uk/

vF forums:
Perfect World RP
BLEACH Universe - Under Construction / Testing Phase
Xen Qarna RP - Stage I
Vyren Entar Battle Network RP - Under Construction / Maintenance Mode Enabled
the Final Anime Hideout
Ross
Administrator
*****

[Avatar]

Posts: 3,709
Status: Offline
Gender: Male
Age: 9 14
Joined:  

Additional Groups:
Support Team
***


Reputation: 45%  


pmwwwtwittergtalkvForum
Re: Need help with code on mini-profile template (8th Dec 09 at 6:16pm UTC)
Hi,

There were a couple of little errors in the javascript which were stopping it from working. Things like:

DyouBox1K = new Array();

DyouPost += "</div>";

document.getElementById("DyouPost").innerHTML = DyouPost;

I have fixed them on your forum for you {Smile}

Image
Aiken
Full Member
***

[Avatar]

Posts: 333
Status: Offline
Gender: Male
Location: In a very lonely place, the domain of despair
Age: 35
Joined:  
Reputation: 12%  


pmtwitterskypemsnyahooxfire
Re: Need help with code on mini-profile template (11th Dec 09 at 5:22pm UTC)
I see there is a problem with the code, in a thread only the profile on the top seems to be using the code

I written up a alternate code for this using the headers and footers, I just don't know how to use it in the template so that all profiles in a thread will use it

Here is the code for Global Header:

Code:
 
  1. <script>
  2.  
  3. function Dyou(dyou){
  4.  
  5. var Dyou; DyouMil; DyouPost;
  6.  
  7. Dyou = dyou
  8.  
  9. if(DyouNum > 1000000){
  10.  
  11. while(DyouNum > 1000000){
  12. ++DyouMil
  13. DyouNum -= 1000000;
  14.  
  15. DyouPost = '<div style="height: 20px; width: 30px; color: #000000; background-color: #C0C000; float: right; margin: 1px;">' + DyouMil + ' Mil</div>';
  16. DyouPost += '<div style="height: 20px; width: 70px; color: #000000; background-color: #FFFF00; float: right; margin: 1px;">' + Dyou + ' Dyou</div>';
  17.  
  18. } else {
  19.  
  20. DyouPost = '<div style="height: 20px; width: 100px; color: #000000; background-color: #FFFF00; float: right; margin: 1px;">' + Dyou + ' Dyou</div>';
  21.  
  22. }
  23.  
  24. return DyouPost;
  25.  
  26. }
  27.  
  28. </script>
 


This one might work better

vF forums:
Perfect World RP
BLEACH Universe - Under Construction / Testing Phase
Xen Qarna RP - Stage I
Vyren Entar Battle Network RP - Under Construction / Maintenance Mode Enabled
the Final Anime Hideout
Ross
Administrator
*****

[Avatar]

Posts: 3,709
Status: Offline
Gender: Male
Age: 9 14
Joined:  

Additional Groups:
Support Team
***


Reputation: 45%  


pmwwwtwittergtalkvForum
Re: Need help with code on mini-profile template (11th Dec 09 at 10:41pm UTC)
Hi,

I've updated your mini-profile template so it writes out the result of that Dyou function (although I had to fix a few errors in it). The most up-to-date Dyou function is now in your Global Header. I was unsure how you were hoping it to display but expect you can tweak it as needed now it is setup {Smile}

Image
Aiken
Full Member
***

[Avatar]

Posts: 333
Status: Offline
Gender: Male
Location: In a very lonely place, the domain of despair
Age: 35
Joined:  
Reputation: 12%  


pmtwitterskypemsnyahooxfire
Re: Need help with code on mini-profile template (12th Dec 09 at 6:53pm UTC)
I still seem to have a slight problem when I change the number in the additional information, when I change it from 185 to 1850000 it displays as 1850

vF forums:
Perfect World RP
BLEACH Universe - Under Construction / Testing Phase
Xen Qarna RP - Stage I
Vyren Entar Battle Network RP - Under Construction / Maintenance Mode Enabled
the Final Anime Hideout
Ross
Administrator
*****

[Avatar]

Posts: 3,709
Status: Offline
Gender: Male
Age: 9 14
Joined:  

Additional Groups:
Support Team
***


Reputation: 45%  


pmwwwtwittergtalkvForum
Re: Need help with code on mini-profile template (13th Dec 09 at 12:59am UTC)
Hi,

When a numeric custom field is greater than 1000 it adds commas (eg. 1,850,000). These were confusing the script. I've fixed that now {Smile}

Image
Aiken
Full Member
***

[Avatar]

Posts: 333
Status: Offline
Gender: Male
Location: In a very lonely place, the domain of despair
Age: 35
Joined:  
Reputation: 12%  


pmtwitterskypemsnyahooxfire
Re: Need help with code on mini-profile template (13th Dec 09 at 6:04pm UTC)
I made a modification to my code and because of what you did it works just the way I want it to, I made it so there is a maximum value

vF forums:
Perfect World RP
BLEACH Universe - Under Construction / Testing Phase
Xen Qarna RP - Stage I
Vyren Entar Battle Network RP - Under Construction / Maintenance Mode Enabled
the Final Anime Hideout
Aiken
Full Member
***

[Avatar]

Posts: 333
Status: Offline
Gender: Male
Location: In a very lonely place, the domain of despair
Age: 35
Joined:  
Reputation: 12%  


pmtwitterskypemsnyahooxfire
Re: Need help with code on mini-profile template (13th Dec 09 at 7:01pm UTC)
What is this for?

Code:
 
  1. <br style="clear: both;" />
 



vF forums:
Perfect World RP
BLEACH Universe - Under Construction / Testing Phase
Xen Qarna RP - Stage I
Vyren Entar Battle Network RP - Under Construction / Maintenance Mode Enabled
the Final Anime Hideout
 Printable View

All times are GMT+0 :: The current time is 3:46am
Page generated in 0.4696 seconds
This Forum is Powered By vForums (v2.4)
Create a Forum for Free | Find Forums