NineChime forum

Furry stuff, oekaki stuff, and other stuff.

You are not logged in.

Post a reply

Write your message and submit
Options
Humanity test

What is nine + one?

Go back

Topic review (newest first)

Waccoon
12-05-2005 01:32:46

To connect PHP syntax check to a user tool in EditPlus, go to Tools -> Preferences.  Select Tools -> User Tools from the column list.

Then set it up as follows:

Code:

Menu text:  Check
  Command:  C:\PHP\cli\php.exe (or, path to CLI version of PHP)
 Argument:  -l "$(FilePath)"

After this, you only need to click a User Tool button to check PHP syntax of whatever you have in your editor.  It's very handy.

Just keep in mind that it saves the file to do the syntax check.  Just hold down Ctrl-Z to undo changes, up to when you first loaded the file.  Ctrl-Y will redo.  The undo/history features are very nicely done, too.

Pinkie
12-04-2005 04:38:08

Thanks for your help. I appreciate it. I may consider actually buying EditPlus. $30 isn't alot. I'll download the trial version some time and see if I'm happy with it. Thank you for your reccomendation!

Waccoon
12-03-2005 20:14:11

The first problem is because you have mismatched PHP tags, or the <? and ?> tags.  You can't use them within a string used for an echo statement.

Use this:

Code:

<?

if ($outerrow['santa'] == '1')
{
   echo "Secret Santa"; 
}
else
{
   echo "<a onClick=\"openWindow('profile.php?user=" . urlencode($outerrow['usrname']) . "', 300, 400); return false\" href=\"profile.php?user=" . urlencode($outerrow['usrname']) . "\">{$outerrow['usrname']}</a>"; 
}

?>

Trust me, you don't want to start using command-line MySQL.  Get MySQL Control Center, instead.

Ah.  I see they renamed it to MySQL Administrator.  Same app, new interface.

BTW, I have question. Recently I've installed apache + mySQL + PHP on my Windows XP machine for testing purposes.

If you want to check the syntax of your PHP code, go to the command line, CD to the folder with the script in it, and type this:

php -l script.php

(The operator is a lower case L, as in "lunatic")

If there's a syntax error, it will give you the line number with the problem, and, usually, a somewhat comprehensible explanation of what's wrong.  A good text editor that allows you to run shell commands (like PHP syntax checking) with the click of a button is a good idea.  It just depends how serious you are about programming.  I bought EditPlus for $30, and I'm extremely happy with it.

Of course, you can ask questions here anytime you like.

Pinkie
12-03-2005 16:32:21

Well, I'm finally, very, very slightly getting to grips with PHP. I'm having this secret santa thing, where users have to guess who the artist is. I've managed to code up a new row in the database, and I've modified functions.php to allow people to select whether their picture is a secret santa image, and it works fine.

Now... I want to edit the following line (the part where the artist's name is displayed on the top bar):

Code:

<a onClick="openWindow('profile.php?user=<?=urlencode($outerrow['usrname']);?>', 300, 400); return false" href="profile.php?user=<?=urlencode($outerrow['usrname']);?>"><?=$outerrow['usrname']?></a>

to change it so that if the value of the 'santa' row (which I've created), is equal to 1, instead of the real artist's name I want it to display 'Secret Santa', and if not, I want the usuall to come up.

Here is what I've coded:

Code:

<?

if ($outerrow['santa'] == '1')
{
echo "Secret Santa"; 
}
else
{
echo "<a onClick=\"openWindow('profile.php?user=<?=urlencode($outerrow['usrname']);?>', 300, 400); return false\" href=\"profile.php?user=<?=urlencode($outerrow['usrname']);?>\"><?=$outerrow['usrname']?></a>"; 
}

?>

and it doesn't work....




But if I type:

Code:

<?

if ($outerrow['santa'] == '1')
{
echo "Secret Santa"; 
}
else
{
echo "artist"; 
}

?>

it works...but obviously I wouldn't want peoples' names to be displaying as 'artist'. I tried to backslash all of these: " as that seems obvious to cause problems if I didn't. Is it becuase I've tried to echo PHP code? Please help as I need this done urgently. ^^' I'm sure it isn't a big problem.... probably just my useless knowledge of php.

BTW, I have question. Recently I've installed apache + mySQL + PHP on my Windows XP machine for testing purposes. I know I can use the mySQL command line thing.... but I'm still used to used to using phpMyAdmin, do you think it's worth to download it onto my computer? If not...waht do I use? Can the command promt display, for example, a whole row from the database, etc. ?

Board footer

Yep, still running PunBB
© Copyright 2002–2008 PunBB