PDA

Click to See Complete Forum and Search --> : Parsing Error, Code Problem


Ovaltine
10-27-2007, 05:08 AM
I'm trying to add some fun home projects to my site, Halloween costumes and home improvement stuff.

I've been trying for hours and hours to figure this out, and just when I thought I had it, I posted it and the page won't display because of a parsing error on line 44 (the <!DOCTYPE line). Here's the code.

Oh, and I'd also like the links NOT to be underlined, but can't figure out where to add the style code, what with the code being part php, part Java, part html, and who knows what else. It's a mess, I know, if I knew better what I was doing, I wouldn't need this help, and the code would be prettier.

<?php
/* ......... this goes at in the html document before everything ........... */
/* create array with all the image names inside it. each image should
be a separate image on the array */
$images = Array('HalPika1999.jpg','HalPo2000.jpg','HalGnomeB aby2002','HalUltraManColorBoy2006.jpg','HalUltraMa nColorBoy2006.jpg');
/*create array of all the information*/
$info = Array(
'1999 Pikachu for my son. I started the costume when he was 7 months and sitting. By the time he wore it he was 9 months and walking. He was not happy about being stuck sitting in a costume but he was cute. We got 2nd place in the SCAD costume contest.',
'2000 Teletuby Po. My son requested the character I just made it. He loved it',
'2002 Fairy and Baby Gnome. This year I was going for simple so I made a Gnome hat for my youngest son. For myself I made a bodice to which I attached a pair of fairy wings. The way it is made, I can cause the wings to flap at will.',
'2006 Ultra Man and Color Boy. My oldest son decided to be Ultra Man, my husband found the mask online and I hand stitched the outfit. I used his pjs as a template for the basic pattern. My youngest son imagined Color Boy himself and told me what he looked like so I could create his costume. Both Boys were ecstatic about their outfits.',
'2007 Madcat Mech Warrior. This costume was the result of my wanting to save money. I talked my son into being a robot so I could just use the boxes around the house. He decided he wanted to be a cool robot, and cool meant a Mech. I researched the robot, drew-up a plan in Photoshop, and built the costume using only cardboard boxes, packing tape, and glue. I did have to purchase spray paint, but only a few cans.'
);
function showImageNavigation($images) {
for($i=0; $i<count($images); $i++) {
echo '<a href="'. $_SERVER['PHP_SELF'] .'?image='. $i .'">'. ($i+1) .'</a> ';
}
} /* end of showImageNavigation function */

/*function to show the desired image if query is found*/
function showImage($images) {
$num = $_GET['image'];
$im = 'HomeProjects/'. $images[$num];
echo '<img src="'. $im .'" '. $imString[3] . ' />';
}
function showInformation($info) {
$num = $_GET['image'];
echo $info[$num];
}
function showDefaultImage($images) {
$im = 'HomeProjects/'. $images[0];
$imString = getimagesize($im);
echo '<img src="'. $im .'" '. $imString[3] . ' />';
}
/* ......... this goes at in the html document before everything ........... */
<!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">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="generator" content="Adobe GoLive" />
<title>Jennifer Lynn Mattingly Guthrie</title><style type="text/css">
.menutitle{
cursor:pointer;
margin-bottom: 5px;
background-color:#ECECFF;
color:##000000;
width:170px;
padding:2px;
text-align:left;
font-weight:bold;
font color="#9e6af8";
/*/*/border:0px solid #000000;/* */
}
.submenu{
margin-bottom: 0.5em;
}
</style>
<script type="text/javascript">
/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only
if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}
function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
if(el.style.display != "block"){ //DynamicDrive.com change
for (var i=0; i<ar.length; i++){
if (ar[i].className=="submenu") //DynamicDrive.com change
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(off set, end))
}
}
return returnvalue;
}
function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display ="block"
}
}
function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}
if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction
if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate
</script>
</head>
<body>
<table width="850" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="170"><img src="QuiteGraphicLogo40.jpg" alt="" height="201" width="170" border="0" /></td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="201">
<tr>
<td width="5%"></td>
<td></td>
<td width="7%"></td>
</tr>
<tr valign="bottom">
<td width="5%"></td>
<td><font size="6" color="#9e6af8">Home Projects </font></td>
<td width="7%"></td>
</tr>
<tr>
<td width="5%"></td>
<td valign="top">
<div align="left">
<font size="5" color="#9e6af8">Halloween Costumes </font></div>
</td>
<td width="7%"></td>
</tr>
<tr height="35%">
<td width="5%" height="35%"></td>
<td valign="top" height="35%"><?php if(isset($_GET['image'])) showInformation($info); else echo $info[0]; ?></td>
<td width="7%" height="35%"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" width="170"><!-- Keep all menus within masterdiv-->
<div id="masterdiv">
<div class="menutitle" onclick="SwitchMenu('sub1')">
<font color="#9e6af8"><a href="../Resume/ResumeObjEduEmp.html"><font color="#9e6af8">Resume</font></a></font></div>
<span class="submenu" id="sub1"><font color="#9e6af8">- <a href="../Resume/DesignedResume2007.pdf"><font color="#9e6af8">Download PDF</font></a></span>
<div class="menutitle" onclick="SwitchMenu('sub2')">
<font color="#9e6af8">Graphic Design Portfolio</font></div>
<span class="submenu" id="sub2">
<font color="#9e6af8">- <a href="../GraphicDesign/FlyerSnowWriter.html"><font color="#9e6af8">Flyers</font></a><br>
<font color="#9e6af8">- <a href="../GraphicDesign/ProductPackagingLiquidBeadz.html"><font color="#9e6af8">Product Packaging</font></a><br>
<font color="#9e6af8">- <a href="../GraphicDesign/ProductDesignCards.html"><font color="#9e6af8">Product Design</font></a><br>
<font color="#9e6af8">- <a href="../GraphicDesign/ProductLabelWood.html"><font color="#9e6af8">Product Labels</font></a><br>
<font color="#9e6af8">- <a href="../GraphicDesign/CatalogFMI2003.html"><font color="#9e6af8">Catalog Design</font></a><br>
<font color="#9e6af8">- <a href="../GraphicDesign/POPSnowHeader.html"><font color="#9e6af8">P.O.P Aids</font></a><br>
<font color="#9e6af8">- <a href="../GraphicDesign/MagazineJansen.html"><font color="#9e6af8">Magazine Layout</a><br>
<font color="#9e6af8">- <a href="../GraphicDesign/PresentationFMI.html"><font color="#9e6af8">Presentation Design</a><br>
<font color="#9e6af8">- <a href="../GraphicDesign/PhotogaphyVases.html"><font color="#9e6af8">Photography</a><br>
</span>
<div class="menutitle" onclick="SwitchMenu('sub3')">
<font color="#9e6af8">Fine Art Portfolio</font></div>
<span class="submenu" id="sub3">
<font color="#9e6af8">- <a href="../FineArt/DrawingChalkSelf.html"><font color="#9e6af8">Drawing</font></a><br>
<font color="#9e6af8">- <a href="../FineArtsPaintingPage.html"><font color="#9e6af8">Painting</font></a><br>
<font color="#9e6af8">- <a href="../FineArt/SculptureFlower.html"><font color="#9e6af8">Sculpture</font></a><br>
<font color="#9e6af8">- <a href="../FineArt/PhotographyGlasses.html"><font color="#9e6af8">Photography</font></a>
</span>
<div class="menutitle" onclick="SwitchMenu('sub4')">
<a href="../GraphicDesign/VideoOverview.html"><font color="#9e6af8">Videos</font></div>
<div class="menutitle" onclick="SwitchMenu('sub5')">
<a href="../AboutMe/BioPage.html"><font color="#9e6af8">About the Artist</font></div>
<div class="menutitle" onclick="SwitchMenu('sub6')">
<a href="../Contact/ContactPage.html"><font color="#9e6af8">Contact Information</font></div>
<div class="menutitle" onclick="SwitchMenu('sub7')">
<font color="#9e6af8">Home Projects</font></div>
<span class="submenu" id="sub7">
<font color="#9e6af8">- <a href="Halloween.php"><font color="#9e6af8">Halloween Costumes</font></a><br>
<font color="#9e6af8">- <a href="HomeImprovement.php"><font color="#9e6af8">Home Improvements</font></a>
</span>
<div class="menutitle" onclick="SwitchMenu('sub8')">
<a href="<A href="http://quitegraphic.com/index.html"><font">http://quitegraphic.com/index.html"><font color="#9e6af8">Home</font></div>
</div></td>

<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
<tr height="5">
<td width="60" height="5"></td>
<td height="5"></td>
<td width="25%" height="5"></td>
</tr>
<tr>
<td align="left" valign="top" width="60"><?php showImageNavigation($images); ?></td>
<td align="center" valign="middle"><?php if(isset($_GET['image'])) showImage($images); else showDefaultImage($images); ?></td>
<td width="25%"></td>
</tr>
<tr>
<td align="right" valign="top" width="60"></td>
<td></td>
<td align="left" valign="top" width="25%"></td>
</tr>
</table>
</td>
</tr>
</table>
<p></p>
</body>
</html>

GraphixNPrint
10-27-2007, 05:24 AM
first, your combining html in php code... start by adding ?> after this

/* ......... this goes at in the html document before everything ........... */

or get rid of the original
<?php tag

the rest is all html and javascript so there is no need for the php tags


for the underline issue that is in your css, and since i haven't hardly slept the last couple of days it probably wouldnt be the best time for me to go through it to find out what you need to change... but to get you started, look after this point:

<title>Jennifer Lynn Mattingly Guthrie</title><style type="text/css">...

you define the title but nothing else...

you should have a definition for links, like this example:

a.link01:link { color: #FFFFFF; text-decoration: none; }
a.link01:visited { color: #FFFFFF; text-decoration: none; }
a.link01:hover { color: #FFFFFF; text-decoration: none; }

... hope this helps

Ovaltine
10-27-2007, 04:47 PM
Thanks, the <? part worked.

But the "no underline" didn't, this is where I put it. I also tried adding these <> to either side of the instructions, but that didn't work either and it took away the color "boxes" behind the menu options.

<title>Jennifer Lynn Mattingly Guthrie</title><style type="text/css">
a.link01:link {color: ##9e6af8; text-decoration: none; }
a.link01:visited {color: ##9e6af8; text-decoration: none; }
a.link01:hover {color: ##9e6af8; text-decoration: none; }

What did I do wrong?

...I'm off to fix a different error I found.

GraphixNPrint
10-27-2007, 05:05 PM
well, you have css calls all throughout the page, and no supporting css file and its not included in the head area; example:

<span class="submenu" id="sub3">

the classes have to be defined for them to work. Go here and look at this css file:

http://www.assetleader.com/CSS/text.css

then go here, and use >View>Source in IE, this will open the pages source code so you can see how the css interfaces with the html:

http://www.assetleader.com

Ovaltine
10-27-2007, 05:42 PM
Maybe I'm missing something. That site has only 1 span class, and it's at the bottom with no links in it, plus its menu is just a standard menu, not a switch menu. The only reason mine is set up the way it is, is because that's what the tutorial said to do.

If I'm understanding you correctly (and I admit I may not be) then this is head area info you're referring to, but it's already in the code:

/***********************************************
* Switch Menu script- by Martial B of http://getelementbyid.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only
if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}
function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById("masterdiv").getElementsBy TagName("span"); //DynamicDrive.com change
if(el.style.display != "block"){ //DynamicDrive.com change
for (var i=0; i<ar.length; i++){
if (ar[i].className=="submenu") //DynamicDrive.com change
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}


Here's the link, now that the images are at least working. However, when I click on the "Fun Home Projects" link (which has no "a href" reference itself in the code) it takes me to the Contact page. As far as I can see the code doesn't tell it to do that, so why is it?

http://www.quitegraphic.com/HomeProjects/Halloween.php

GraphixNPrint
10-27-2007, 06:45 PM
no, what I am referring to is this is all your css in its entirety:

<style type="text/css">
.menutitle{
cursor: pointer;
margin-bottom: 5px;
background-color:#ECECFF;
color:##000000;
width:170px;
padding:2px;
text-align:left;
font-weight:bold;
font color="#9e6af8";
/*/*/border:0px solid #000000;/* */
}
.submenu{
margin-bottom: 0.5em;
}
</style>

you need to define the a.link a.hover link etc before they will work.


then, you actually call them in your div class= part of the html

Ovaltine
10-27-2007, 07:18 PM
I'm working in GoLive, so I went to the page properties and specified the link info. Here's where it put the code and how it wrote it:

</head>
<body link="#9e6af8" vlink="#9e6af8" alink="#9e6af8">
<table width="850" border="0" cellspacing="0" cellpadding="0" align="center">

I tried to do this:
</head>
<body link="#9e6af8"; text-decoration: none; vlink="#9e6af8"; text-decoration: none; alink="#9e6af8"; text-decoration: none;>
<table width="850" border="0" cellspacing="0" cellpadding="0" align="center">
but it didn't change anything.

GraphixNPrint
10-27-2007, 08:34 PM
that wont work, golive is using presets. Your best bet like I said before is to review a css style sheet to see how it is laid out, and review a sites source code (html) so you have an understanding how it works.

Then with a text editor (notepad, synedit... something along these lines) manually edit the page(s) so that they work properly.

When using code generating programs you just get the poo the program spits out and you dont have control over the way the code functions in reality.

hope this helps a little (not sure of you html and css background so its kinda hard to guide you along the way).

tZ
10-28-2007, 09:56 PM
a {
text-decoration: none;
}

???

Its been about seven weeks since, I've looked at this stuff so I'm going to need a refresher,lol

The above though will remove the default underline on all anchors. If you want to remove it on certain ones your going to need to add a class to the anchor like so:

<a href="" class="remove">whatever</a>

then:

.remove {
text-decoration: none;
}

I think…

Ovaltine
10-29-2007, 03:21 AM
Thanks TZ, and Graphix...I finally figured out where to put the code...after a few misplacements :).

Now my only problem is this:
Here's the link. When I click on the "Fun Home Projects" link (which has no "a href" reference itself in the code) it takes me to the Contact page. As far as I can see the code doesn't tell it to do that, so why is it/ what's the problem?

http://www.quitegraphic.com/HomeProjects/Halloween.php

Also, I rewrote the code...again. It's still linking improperly and I can't figure out why.

GraphixNPrint
10-29-2007, 03:38 AM
from what I saw by a quick glance, your not shutting off your <div ...> tag so its carrying over to the next link

look at the html above that link and then look at the ones below it you will see what I mean

Ovaltine
10-29-2007, 03:54 AM
<div class="menutitle" onclick="SwitchMenu('sub6')">
<a href="../Contact/ContactPage.html"><font color="#9e6af8">Contact Information</font></div>
<div class="menutitle" onclick="SwitchMenu('sub7')">
<font color="#9e6af8">Fun Home Projects</font></div>
<span class="submenu" id="sub7">
<font color="#9e6af8">- <a href="../Halloween.php"><font color="#9e6af8">Halloween Costumes</font></a><br>
<font color="#9e6af8">- <a href="../HomeImprovement.php"><font color="#9e6af8">Home Improvements</font></a><br>
</span>

They both seem closed to me. Am I missing something?

Two-Toe Tom
10-29-2007, 04:48 AM
looks like you're missing a </a> for your first link?

Ovaltine
10-29-2007, 05:46 AM
thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you

that was aggravating. Now I can finish the other page, and fix all the menus.

Two-Toe Tom
10-29-2007, 06:28 AM
woot! :D