Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jan 2001
Posts: 374
Enthusiast
Enthusiast
Offline
Joined: Jan 2001
Posts: 374
edited by caymuc (I put in Astaran's corrections of the instructions):
Original title was "6.1.1: Count letters of Signature in profile"
Changed that as my instructions were for the Bio, actually. But that all would work for the signature as well, of course. You actually can use the script for both fields with a few changes in the code, I think. - I'll neet to figure out, how.

-------

Where: EditBasic
---
What: A counter of how many letters are still free for use in the bio field.
---
Note: To change the default of how many letters can be uses maximum, change the number at that code in my hack:
var maxlang=250;
---
Status of the hack: Works well in 6.1.1.
---
Status of the instructions: beta - let me know if you understand this here and get it working
---
Example: running on my board; login info, see signature below.
---
Autor: Me, Myself and I


------------
In EDITBASIC.PHP

Replace:

$formmethod = "<form method="post" action="{$config['phpurl']}/changebasic.php">";
By:
// Count-hack next line, name="Profil" added:
$formmethod = "<form name="Profil" method="post" action="{$config['phpurl']}/changebasic.php">";

and

Replace:

$formmethod = "<form method="post" enctype='multipart/form-data' action="{$config['phpurl']}/changebasic.php">";
By:
// Count-hack next line, method="post" added:
$formmethod = "<form name="Profil" method="post" enctype='multipart/form-data' action="{$config['phpurl']}/changebasic.php">";


(Scream, why don't you give all forms a "name" by default? Makes JavaScripts easier to apply. )



In EDITBASIC.TMPL


After:

{$ubbt_lang['PROF_HEAD']} $Username
</td>
</tr>
</table>
</td>
</tr>
</table>

Insert this:

<!-- Count-hack begin -->
<script language="javascript" type="text/javascript">
<!--
var formfeld=" ";
var maxlang=250;
function z()
{
if (window.document.Profil.Bio.value.length>maxlang)
{
window.document.Profil.Bio.value=formfeld;
return;
}
else
{
formfeld=window.document.Profil.Bio.value;
window.document.Profil.anzeigen.value=maxlang-window.document.Profil.Bio.value.length;
}
}
//-->
</script>
<!-- Count-hack end -->

and

replace the full line starting with:

<textarea name="Bio"

by these two lines:
<!-- Count-hack begin -->
<textarea name="Bio" cols="$TextCols" rows="$TextRows" wrap="soft" class="formboxes" onkeyup="javascript:z()">$Bio</textarea>
<input type="text" value="-?-" name="anzeigen" class="formboxes" size="3" />
<!-- Count-hack end -->

Last edited by caymuc; 11/04/2002 3:05 AM.
Sponsored Links
Joined: Dec 2000
Posts: 1,471
Addict
Addict
Offline
Joined: Dec 2000
Posts: 1,471
Hi Carl,
i took a look at this hack.
Really nice idea, very useful.
But i noticed a few issues during appling this hack.

The changes have to be made in editbasic.php and editbasic.tmpl.
The instructions are written to apply that hack to the bio field an not to the signature field.
You could the variable $config['Sig_length'] to get the maxlength of the signature field from the config file.

Joined: Jan 2001
Posts: 374
Enthusiast
Enthusiast
Offline
Joined: Jan 2001
Posts: 374
Hi,
yes, i feared that the instructions are not perfect yet.
Also I like your idea to grab the needed variable from the database instead of hard coding it. But I wasn't 100% sure how to do it (and had no time testing it) and what I have here is better than nothing...

Actually I wanted to spread the idea and see whether there is any interest in this feature before I spend any extra time on it. (At the moment I have a so much work at my job that there is no extra time for playing around too much...)
Also there is the hope that Scream would like to include that feature in a standard version, anyway. This Script is a nice service to all board users I think and almost zero effort to include.

Last edited by caymuc; 11/04/2002 3:06 AM.

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Posts: 70
Joined: January 2007
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240430)