TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 28, 2024, 08:57:02 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,104
  • Total Topics: 21,212
  • Online today: 212
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 179
  • Total: 179

Weird php block reaction

Started by Ayan, July 24, 2009, 07:43:51 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ayan

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.

// 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

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

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

Have you tried other php code in another block?

Ayan

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

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

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

I'll give it a shot.  Thanks!

Ayan

#8
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?

JPDeni

QuoteI'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.