Forums › Forums › General Discussions › Open Topic › php parse error help
- This topic has 2 replies, 2 voices, and was last updated 19 years, 6 months ago by
axanthius.
-
AuthorPosts
-
July 28, 2006 at 12:41 pm #49354
Hey im working on updating my site, and im putting in a set of rollover images that are conditional to the user being logged in or not. to make life a bit simpler i set up the rollover script as a variable, and i am getting a parse error on that line…
Parse error: parse error, unexpected ‘.’
heres the line with the error
Code:$rollover1 = "<A><IMG></A>";and then where the rollover goes i have..
Code:if (isset($_SESSION[’user_id’]) AND
(substr($_SERVER[’PHP_SELF’], -10)
!= "logout.php")) {
echo $rollover1, $rollover2 ;}else{
echo $rollover3, $rollover4 ;
}help please!
July 29, 2006 at 7:01 am #119823Look at this:
rollover1 is yours, rollover2 is mine.
Note mine is all in red, minus the commas
[img]http://www.freesofree.net/images/temp/red_black_php.jpg[/img]I don’t know how to get rid of the comma, or make the javascript comma work inside of an ahref tag inside of a php tag, but a quick fix would be to declare the contents of onMouseOver="" as a php variable:
Code:$VARonMouseOver1="axsite_15′,’..axsite.data_/axsite_15_over.jpg";
$VARonMouseOut1="axsite_15′,’/axsite.data_/axsite_15.jpg";then you can simply say:
Code:onMouseOver=’ . $VARonMouseOver1 . ‘ onMouseOut=’ . $VARonMouseOut1. ‘You are in php code, inserting html code, and inside of the html code you are inserting javascript code. Easiest way would be to make it all php code
I haven’t had my coffee yet either. The ‘double-quotes’ ‘single-quotes’ and ‘commas’ are what is messing it up and giving you the ‘parse error’ code.A color coded html editor can be your best friend sometimes.
July 31, 2006 at 12:33 am #119824Thanks for the response.
I ended up abandoning the rollover images and instead set the background as i wanted and then used css styles to make the text change colors with mouse on and off. works great. now i have run into another problem that is absolutely driving me batty.
I have set up a header and footer include files, and have them include on my content pages. i have been using php designer to debug, and when i use it, it will show all the images with no problem, but when i debug the content page it wont show any of the images, nor when i upload everything and then view in a browser. it shows the pic frames but no images.. i get all the typed content, i even get the css styled rollovers with no problem (altho its hard to tell since the beginning text is white) so i have no clue what is going on, i have tried to move my image file, fixing the coding in the process, changed my include files to html files, not sure what else to do to straighten this out.
any ideas?……Edit:
Never mind, i figured it out.. –DOH!– basically i set the paths for the images relative to the includes, not the content pages, so its all straight.
-
AuthorPosts
- You must be logged in to reply to this topic.