DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • November 23, 2017, 02:59:48 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: Weird php Error: Unexpected $  (Read 4250 times)
0 Members and 1 Guest are viewing this topic.
Ironman
Guest
« on: January 08, 2006, 12:43:17 PM »

I am totally baffled by what php is telling me.

imgary@omega% php -f garrisons.php

Parse error: parse error, unexpected $ in /usr/www/users/imgary/logd104/modules/
garrisons.php on line 301
imgary@omega% wc -l garrisons.php
     300 garrisons.php

If my file is 300 lines, how can I have an unexpected $ on line 301?  Since the script is 300 lines and I could have an error on line 1 for all I know, I placed the script here:

http://www.dragonprime.net/users/Ironman/garrisons.txt

Thanks in advance!
Logged
XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #1 on: January 08, 2006, 12:48:39 PM »

you forgot one "}" at the end of the file... Smiley

It's quite easy... You should also try tabbing you code... makes it a lot easier to read (and to find the sources of such errors...)
Logged

Running for more than three years now:
SaucyWench
Mod God
*****
Offline Offline

Posts: 2238


I'm a good girl.


View Profile WWW
« Reply #2 on: January 08, 2006, 05:25:38 PM »

XChrisX makes a really good point here.

Also, anyone I have taught to code modules will tell you how anal I am about tab stops.

Kendaer taught me... and he is the same. If you look at any of his work in the core, or any of Sichae's, mine, JRMinga, Atrus... they are all pedantic about those tab stops, because I absolutely picked the people to pieces until those tab stops were perfect. Tongue

I sometimes see released code by other authors and am horrified by the higgeldy-piggeldy spacing and tabbing. It's enormously difficult to read and as you've seen, missing braces are impossible to see. If it had been tabbed correctly it would have shown up straight away when one of the lines was further in than the others.

If there is one habit you should make a point of developing, in my opinion, it's this one. It has served many of us really well. Smiley
Logged

SaucyWench
Owner of GemDust.com and Darton City proudly hosted by LunarPages
Ironman
Guest
« Reply #3 on: January 08, 2006, 07:47:02 PM »

I agree, actually.  And when I was sighted, I used tabs religiously.  As a blind programmer, they don't help much.  I'll need to play around with different editors (find one that displays a status bar with row and column counts).

Thanks for the help!
 
Logged
Sichae
iMod God
SVN Users
Mod God
*
Offline Offline

Posts: 3458


If ya didn't get it by now... you're hopeless...


View Profile WWW
« Reply #4 on: January 08, 2006, 08:26:20 PM »

Notepad++ has a Ln (line) Number Count and a Col(column) Number Count near the bottom of the editor. I don't know if that would help any.
« Last Edit: January 08, 2006, 08:26:33 PM by Sichae » Logged

If you didn't understand anything in the above post, don't try to attempt anything suggested.

kickme
Global Moderator
Mod God
*****
Offline Offline

Posts: 1589


Yay for elephants!


View Profile WWW
« Reply #5 on: January 08, 2006, 09:40:52 PM »

I also use tabs. I have missed a brace or two in my coding, so the tabbing helps. Also, my editor (PageSpinner, mac only) keeps tabs on newlines, so that i don't have to remeber how many tabs I've used.
Logged

Waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka
Ironman
Guest
« Reply #6 on: January 11, 2006, 05:47:05 AM »

Thanks for recommending Notepad++, it works great!

Now, I have a new problem. Sad  Forgive me, this is my first 1.x village module.  When I install this module, the link appears properly in the Town Square, but when I click on it, all I get is a blank screen.  I tried comparing my code to other similar mods, but after nearly three days of staring at the code, I'm defeated.

   http://dragonprime.net/users/Ironman/garrisons.txt

Thanks in advance.
Logged
Nightborn
Guest
« Reply #7 on: January 11, 2006, 05:52:43 AM »

looks like you forgot page_footer in your module or like that.

you also may take a look at your error log where this error might be described.
Logged
Ironman
Guest
« Reply #8 on: January 11, 2006, 06:02:40 AM »

You were close. Wink  I had the page footer between the wrong set of braces.  Works fine now.  Thanks again.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Please take the time to read the FAQ and browse the DragonPedia

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
20 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search