Pirata Nervo
NervOS Developer
Posts: 699.4765 Threads: 39
Joined: 20th Jun 2007
Reputation: -0.79225
E-Pigs: 19.2466
|
Need help with php
Im trying to make a plugin like zinga's plugin(username color just that), im trying to make this:
replace in functions.php:
this:
with this:
It doesn't show the colors...but it affects the colors because it shows the default color in all usernames
(This post was last modified: 07/09/2007 04:03 PM by Pirata Nervo.)
|
|
07/09/2007 07:13 AM |
|
Th3_Hellrider
Existential Entity
Posts: 17.2600 Threads: 3
Joined: 10th Aug 2007
Reputation: 0.76198
E-Pigs: 0.6697
|
RE: Need help with php
Hmm, i haven't got too much experience in PHP scripting, but it should be ok... Probably mistake:D
{Translated with google -.-}
Hellrider®: Your Connection to Perfection.
|
|
07/09/2007 08:52 AM |
|
Pirata Nervo
NervOS Developer
Posts: 699.4765 Threads: 39
Joined: 20th Jun 2007
Reputation: -0.79225
E-Pigs: 19.2466
|
RE: Need help with php
but it isn't working lool and what was translated with google?
|
|
07/09/2007 09:12 AM |
|
Pirata Nervo
NervOS Developer
Posts: 699.4765 Threads: 39
Joined: 20th Jun 2007
Reputation: -0.79225
E-Pigs: 19.2466
|
RE: Need help with php
Updated with a new question as i resolved my other problem.
Also zinga changed the php code i don't know why but its:
$ugroup = $groupscache[$usergroup];
$format = "<span style=\"color:{$userfields['fid5']};\">{username}</span>";
$userin = substr_count($format, "{username}");
not
$ugroup = $groupscache[$usergroup];
$format = "<span style=\"color:{$userfields['fid5']};\">{username}</span>";
$userin = substr_count($format, "{username}");
(This post was last modified: 08/09/2007 12:44 AM by Pirata Nervo.)
|
|
07/09/2007 03:36 PM |
|
ZiNgA BuRgA
Smart Alternative
Posts: 17,022.2988 Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.1274
|
RE: Need help with php
Firstly, the code you supplied is rather illogical and obviously doesn't work...
Secondly, it's very inefficient - you make a query every time you have to format a name - for example, if there's 100 names needing to be formatted, your code queries the database 100 times just to do that.
My method hardly affects speed, but to achieve that, a lot of code edits are needed.
I'll point out some problems with your script, however, I'm not going to provide you with a full solution (since it won't be "good" anyway):
- The query isn't used anywhere
- $uid is not initialized, and means nothing
The rest looks like it will work.
Pirata Nervo Wrote:Updated with a new question as i resolved my other problem.
Also zinga changed the php code i don't know why but its:
$ugroup = $groupscache[$usergroup];
$format = "<span style=\"color:{$userfields['fid5']};\">{username}</span>";
$userin = substr_count($format, "{username}");
not
$ugroup = $groupscache[$usergroup];
$format = "<span style=\"color:{$userfields['fid5']};\">{username}</span>";
$userin = substr_count($format, "{username}");
What???
|
|
07/09/2007 09:10 PM |
|
Pirata Nervo
NervOS Developer
Posts: 699.4765 Threads: 39
Joined: 20th Jun 2007
Reputation: -0.79225
E-Pigs: 19.2466
|
RE: Need help with php
You probably changed the php bbcode so it doesn't say / it says \
its not that.
its:
$format = "<span style=\"color:{$userfields['fid5']};\">
O and thanks, but it isn't working with my code lol
(This post was last modified: 08/09/2007 01:07 AM by Pirata Nervo.)
|
|
08/09/2007 12:45 AM |
|
Pirata Nervo
NervOS Developer
Posts: 699.4765 Threads: 39
Joined: 20th Jun 2007
Reputation: -0.79225
E-Pigs: 19.2466
|
RE: Need help with php
I deleted everything in this post.
Its not \ its \ , i don't know what does it means but its not that, but it says that inside of php tags.
im trying to make a function:
I don't know why it isn't working do i need to call anything before using the userfields['fid5'] ?
Because it always uses the else condition insteaad of using the first one.
(This post was last modified: 08/09/2007 03:55 PM by Pirata Nervo.)
|
|
08/09/2007 05:58 AM |
|
ZiNgA BuRgA
Smart Alternative
Posts: 17,022.2988 Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.1274
|
RE: Need help with php
double you tee eff? First thing, $userfields is undeclared...
|
|
08/09/2007 07:11 PM |
|
Pirata Nervo
NervOS Developer
Posts: 699.4765 Threads: 39
Joined: 20th Jun 2007
Reputation: -0.79225
E-Pigs: 19.2466
|
RE: Need help with php
but how do i check if it exists in the db? that's my main question.
Im also using require_once "./member.php"; and still doesn't work.
(This post was last modified: 09/09/2007 02:47 AM by Pirata Nervo.)
|
|
09/09/2007 02:25 AM |
|
ZiNgA BuRgA
Smart Alternative
Posts: 17,022.2988 Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.1274
|
RE: Need help with php
Check what exists in the DB? You have an undeclared variable - that's your issue. A lot of scripting languages don't require explicit variable declaration, so sticking in a variable that doesn't exist won't cause an error. In C, for example, using an undeclared variable would cause a compiler error, eg:
The above would obviously not compile.
In PHP, no error would be generated however - nonExistantVariable would just be null.
Pirata Nervo Wrote:Im also using require_once "./member.php"; and still doesn't work.
Do you have the path right? But why do you want to include member.php anyway?
|
|
09/09/2007 05:10 AM |
|