Page 1 of 1

Parse, Syntax Error -- Please help!

Posted: Thu Dec 04, 2008 2:22 am
by EyeCree8
I am a graphic designer and whereas I know how to code html and css, I know very little about php. I've been asked to add some information to a site (closed deal pages). The site contains numerous php files. I attempted to change a menu link from the content end of the site using my client's software, SnippetMaster. I was going to link the closed deals to my new static deals.html page.

This is the page containing the sub(left column) menu. You will see the error message after I attempted to link to the deal.html page. http://www.mcalcamo.com/management.php

And this is the php code from a file called management_sub_menu.php which is brought into the management.php page.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Untitled document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<li><?php if ($thisSubPage=="fund_management")
echo " class=\"currentpage_sub\""; else
echo " class=\"otherpage_sub\"";?>>
<a href="fund_management.php">Fund Management</a></li>

<li><?php if ($thisSubPage=="contact_sub")
echo " class=\"currentpage_sub\""; else
echo " class=\"otherpage_sub\"";?>>
<a href="contact_sub.php">Email Us</a></li>

<li><?php if ($thisSubPage=="in_the_news")
echo " class=\"currentpage_sub\""; else
echo " class=\"otherpage_sub\"";?>>
<a href="in_the_news.php">In The News</a></li>

<li class="otherpage_sub"><a href="deals.php?section=m">Closed Deals</a></li>
</body>
</html>

Please help!
Sara :(

Re: Parse, Syntax Error -- Please help!

Posted: Thu Dec 04, 2008 2:28 am
by mikelbring
i am dumb edited out

Re: Parse, Syntax Error -- Please help!

Posted: Thu Dec 04, 2008 2:30 am
by groc426
I'm fairly new with php myself, but if you have an if statement, then I would imagine you need the curly braces after:

Code: Select all

 
<li><?php if ($thisSubPage=="fund_management")[b]{[/b]
echo " class=\"currentpage_sub\""; [b]}[/b]else[b]{[/b]
echo " class=\"otherpage_sub\"";[b]}[/b]?>>
<a href="fund_management.php">Fund Management</a></li>
 
Something like that. Again I'm new, but it couldn't hurt:) Good luck!

Re: Parse, Syntax Error -- Please help!

Posted: Thu Dec 04, 2008 2:33 am
by EyeCree8
Thanks for the quick reply.....So I need to remove those?

I didn't write this php, and I basically know nothing of php. I was fiddling around with the link in something like the administration end of Joomla a what you see is what you get admin for the site.

Do you know how to make the "closed deals" menu item go to a file called deals.html?

Re: Parse, Syntax Error -- Please help!

Posted: Thu Dec 04, 2008 2:47 am
by groc426
No you want to add those curly braces...they are in bold where I put the code (4 of them), but you will need to apply them to each of the 3 if statements in the same manner.

*I edited my original post...put the last curly brace in the wrong place.

Re: Parse, Syntax Error -- Please help!

Posted: Thu Dec 04, 2008 3:14 am
by EyeCree8
Thanks for your help.

I applied the curly brackets to the first if/else statement to see if it would make a difference -- I think it only matters when there is a false applied as well.

But first post was correct about the ? in the first line.

But now take a look at the page.

http://www.mcalcamo.com/management.php

Sara

Re: Parse, Syntax Error -- Please help!

Posted: Thu Dec 04, 2008 3:35 am
by papa
You say you know HTML. Then you will know the answer for your question.

Re: Parse, Syntax Error -- Please help!

Posted: Thu Dec 04, 2008 3:55 am
by EyeCree8
Yeah, thanks for your help...but below in blue is what I see when editing this page -- clearly enough php to throw off a newbie. The page, http://www.mcalcamo.com/management.php is pulling management.php, management.html, management_sub_footer.php, header.php and management_sub_menu.php

So, tell me then why the page renders with a bullet and then class="otherpage_sub" when that coding is part of the php?

What you are looking at when you view the source is not one complete file I can edit. Yes, if it didn't pull all those php files, I could easily enclose the class in the <li> tag and make those nasty extras disappear. But, I don't have that option.

Sara

<xml version="1.0" encoding="utf-8">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Untitled document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<li><?php if ($thisSubPage == "fund_management")
{ echo " class=\"currentpage_sub\""; }else{
echo " class=\"otherpage_sub\"";}?>
<a href="fund_management.php">Fund Management</a></li>
<li><?php if ($thisSubPage=="contact_sub")
echo " class=\"currentpage_sub\""; else
echo " class=\"otherpage_sub\"";?>
<a href="contact_sub.php">Email Us</a></li>
<li><?php if ($thisSubPage=="in_the_news")
echo " class=\"currentpage_sub\""; else
echo " class=\"otherpage_sub\"";?>
<a href="in_the_news.php">In The News</a></li>
<li class="otherpage_sub"><a href="deals.php?section=m">Closed Deals</a></li>
</body>
</html>



And this is the code for the management.php page.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Untitled document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?php $thisPage="management"; ?>
<?php $thisSubPage="management"; ?>
<?php include 'header.php' ?>
<?php include 'management_sub_footer.php' ?>
</body>
</html>

Re: Parse, Syntax Error -- Please help!

Posted: Thu Dec 04, 2008 4:06 am
by papa
Just try to see what's php and what's html and it will get easier for you to spot errors etc:

Code: Select all

 
<li><?php if ($thisSubPage == "fund_management")
{ echo " class=\"currentpage_sub\""; }else{
echo " class=\"otherpage_sub\"";}?>
<a href="fund_management.php">Fund Management</a></li>
What you echo here is either class="currentpage" or class="otherpage_sub" which is css classes.

How do you usually add a class to an html element?

Either you want it in <li class=myclass> or in the <a> element.

So maybe rewrite the code so it's easier to see:

Code: Select all

 
<?php 
if ($thisSubPage == "fund_management") { $page_class="currentpage_sub"; }
else{ $page_class="otherpage_sub";}
echo "<li class=\"$pageclass\">\n";
?>
<a href="fund_management.php">Fund Management</a></li>

Re: Parse, Syntax Error -- Please help!

Posted: Thu Dec 04, 2008 4:40 am
by EyeCree8
Actually, just extending the <li> tag to enclose the entire php string did the trick. And interestingly the TinyMCE editor that they had me use changed the code to this after I saved it....totally took out all the echos and if/else statements.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Untitled document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<li ($thissubpage="=" class="\">
<a href="fund_management.php">Fund Management</a></li>
<li class="otherpage_sub">
<a href="contact_sub.php">Email Us</a></li>
<li class="otherpage_sub">
<a href="in_the_news.php">In The News</a></li>
<li class="otherpage_sub"><a href="deals.php?section=m">Closed Deals</a></li>
</body>
</html>


Thank God the page is fixed I was originally trying to swap out one link address for another, but the TinyMCE changed all the code to be the garbled mess it was.


Caio

Re: Parse, Syntax Error -- Please help!

Posted: Thu Dec 04, 2008 4:53 am
by papa
:) html is the <span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span>.