News: April 7th, 2019, The Tinyportal team is pleased to announce the release of ~~ TinyPortal 1.6.3! GET IT NOW!!!

Login  |  Register
HTML5 Icon HTML5 Icon
TP on Social Media
Welcome, Guest. Please login or register.
Did you miss your activation email?

August 25, 2019, 05:50:53 PM

Login with username, password and session length

Recent

Members
  • Total Members: 3751
  • Latest: tom888
Stats
  • Total Posts: 188704
  • Total Topics: 20746
  • Online Today: 95
  • Online Ever: 629
  • (November 08, 2018, 01:36:54 PM)
Users Online
Users: 0
Guests: 59
Total: 59

Author Topic: Weird php block reaction  (Read 9215 times)

0 Members and 1 Guest are viewing this topic.

Ayan

  • Guest
Weird php block reaction
« on: July 24, 2009, 12:43:51 PM »
I've recenly written a guild recruitment block for my website (still in testing, not live).

I wrote the code in Notepad with a little help from a php editor (for syntax highlighting/troubleshooting).

Baically, it's written so that when you put an "A" through "E" next to the class you're trying to recruit, it echo's a priority on the front page for that class.

Code: [Select]
// Class Status
// Your class status should reflect the highest need based on the spec priority.
// A = Closed - no longer accepting
// B = Low - Recruiting this class, but on a select basis
// C = Medium - Recruiting this class, needed to fufill a group role (Tank, Mele, Ranged, Healing)
// D = High - Recruiting this class, imperitive to fufill class rolls
// E = Open - Recruiting members of this class, regardless of need

$class_dkn = A;
$class_dru = B;
$class_hun = C;
$class_mag = D;
$class_pal = E;
$class_pri = A;
$class_rog = B;
$class_sha = C;
$class_wal = D;
$class_war = E;

Pretty simple, right?

When I change a letter and cut the entire code from Notepad and paste it into the php block, it works perfectly.  When I go into the block code and individually change a letter without repasting the entire code, the whole block breaks, and I get random code scattered all over my frontpage. 

Anyone else run into this problem?

JPDeni

  • Guest
Re: Weird php block reaction
« Reply #1 on: July 24, 2009, 12:51:35 PM »
I would use the php editor instead of Notepad. Or edit the code in the block itself. I've had really poor luck with Notepad.

Ayan

  • Guest
Re: Weird php block reaction
« Reply #2 on: July 24, 2009, 01:32:01 PM »
I did a complete rewrite of the code in the editor, and it still only works with a cut and paste.  I'm going to need to be able to change the strings in the php block, because there will be six people with access to change the status as  needed.

At fist I was thinking it may be a problem with the length of code, but since it works fine with the cut and paste, I'm ruling that out.

JPDeni

  • Guest
Re: Weird php block reaction
« Reply #3 on: July 24, 2009, 01:47:45 PM »
Have you tried other php code in another block?

Ayan

  • Guest
Re: Weird php block reaction
« Reply #4 on: July 24, 2009, 02:19:13 PM »
Yes.  I have another block for raid progress which requires changing the strings in the same way to show which bosses have been killed, attempted, and not attempted.  When I change these in the php block, it works fine.

Ayan

  • Guest
Re: Weird php block reaction
« Reply #5 on: July 24, 2009, 02:23:49 PM »
I have 3 sets of strings that are designed to be altered.  If I change any string in any of the three sets (all affect the block differently by design), the php block reacts the same way.  So, hopefully, I've ruled out a program error causing only one section of the block to go haywire.

JPDeni

  • Guest
Re: Weird php block reaction
« Reply #6 on: July 24, 2009, 02:55:57 PM »
So it's not an issue with TP and it's not an issue with the logic of your code. The only other possibility is that something has been corrupted somewhere, either in your code or in your database.

I would delete the block in question and try it again.

Ayan

  • Guest
Re: Weird php block reaction
« Reply #7 on: July 24, 2009, 03:26:14 PM »
I'll give it a shot.  Thanks!

Ayan

  • Guest
Re: Weird php block reaction
« Reply #8 on: July 24, 2009, 04:00:39 PM »
OK.  Deleted the old block.  Just recreated the block in a different php editor.  Copied it in, good.  Made a change in the block editor, and the problem returned.

I'm using UTF-8 encoding for everything.  Could that be be the cause of the problems?
« Last Edit: July 24, 2009, 04:02:22 PM by Ayan »

JPDeni

  • Guest
Re: Weird php block reaction
« Reply #9 on: July 24, 2009, 04:05:26 PM »
Quote
I'm using UTF-8 encoding for everything.  Could that be be the cause of the problems?

It could be. I've never used it myself, so I don't know anything about it. I'm a "try it and see" sort of programmer, so I'd probably change the encoding and see what happens.