Forum Moderators: coopster

Message Too Old, No Replies

Fatal Error

         

phprookie

1:35 am on Feb 11, 2007 (gmt 0)

10+ Year Member



As my name implies, I'm in trouble already.

Opened index.php in Dreamweaver to change some post codes (zip codes), then uploaded same back vif FTP.

Now when I open my site all I get is the following:

Fatal error: Call to undefined function: inserteditorjava() in /home/example/public_html/index.php on line 36

The code:

LINE 36 <?php inserteditorjava();?>
<?php
if($blockid!="newaddition"){
metadescription($blockid);
metakeywords($blockid);
}
?>

</head>

Any help will me much appreciated.

Cheers

Mike

[edited by: encyclo at 1:58 am (utc) on Feb. 11, 2007]
[edit reason] no URLs please, see TOS [webmasterworld.com] [/edit]

scriptmasterdel

1:49 am on Feb 11, 2007 (gmt 0)

10+ Year Member



The error is informing you that a function has not been found, either it has been removed or a page / referance that stores the function in it has been lost.

Basically you need to have the function called "inserteditorjava" included

It should look something like this....

function inserteditorjava()
{
// this could be anything, we are inside a function.
}

I hope i have made some sence, it's almost 2am =)

Del

scriptmasterdel

1:50 am on Feb 11, 2007 (gmt 0)

10+ Year Member



P.S. I would snip the URL out before an mod does ;-)

Del

I spoke to soon, you gotta be quick in this place!

phprookie

2:31 am on Feb 11, 2007 (gmt 0)

10+ Year Member



Thanks Del ... I just don't know what is what pointing to?

phprookie

5:19 am on Feb 11, 2007 (gmt 0)

10+ Year Member



I tried cleaning up the code - but the problem remains and I receive the same error massge. I can't see what I am missing.

How should the code look? What should precede the doe for example?

This is how it should look, correct?
<php inserteditorjava(); >
<php
if($blockid!="newaddition"){
metadescription($blockid);
metakeywords($blockid);
}
>

Even though that is how it now appears, it's still not working and the fatal error message remains. I appreciate any help/advice or assistance.

Mike

scriptmasterdel

12:58 pm on Feb 11, 2007 (gmt 0)

10+ Year Member



It's missing someting that contais the following:

function inserteditorjava()
{
// this could be anything.
}

It's called a function.

If you removed any lines of code with the following skeleton then you need to re-instate it, if you have not removed anything then you need to put the actual function you are tryin to use in place.

Where did you get the code that you are using from?

phprookie

6:39 pm on Feb 11, 2007 (gmt 0)

10+ Year Member



Hi
The code is from the index.php file.
I didn't touch this part of the code at all ... i changed only two numbers in the post code (zip code) from a weather script.
So the offending code is looking for a function from another file? Here's the index page code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>::::</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function Resize(ID,heightNumber,widthNumber) {
document.getElementById(ID).height=heightNumber;
document.getElementById(ID).width=widthNumber;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

funtion inserteditorjava();
if($blockid!="newaddition"){
metadescription($blockid);
metakeywords($blockid);
}
//-->
</script>
<link href="css/default.css" rel="stylesheet" type="text/css">
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('template_images/dm_over.gif')">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="266" valign="top" background="template_images/header_bg_tile.jpg"><table width="100%" height="266" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="266" align="left" valign="top"> <table width="100%" height="266" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" align="left" valign="top"> <img src="template_images/bg1.jpg" width="765" height="266"></td>
<td align="left" valign="top" background="template_images/header_big_bg.jpg"><table width="240" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;</td>
</tr>
</table></td>
<td width="100%" align="left" valign="top">&nbsp;</td>
</tr>
</table></td>
</tr>
</table> </td>

phprookie

6:48 pm on Feb 11, 2007 (gmt 0)

10+ Year Member



The other thing is, I am only updating the content, not the code. Unfortunately, I don't know what the function is for, but when I did delete it as a trial, another function below would then be given the fatal error messsage. So no matter where any PHP script might be in the body, it would not work.
Important? It's the first time I've edited it (Dreamweaver) outside of the CMS where u have side blocks, page blocks, etc.
Cheers
Mike

scriptmasterdel

10:57 pm on Feb 11, 2007 (gmt 0)

10+ Year Member



I now see the problem ;-)

Ok so the php function inserteditorjava() is inside the javascript tags.

e.g.

<script>
funtion inserteditorjava();
if($blockid!="newaddition"){
metadescription($blockid);
metakeywords($blockid);
}
</script>

Whereas it should be inbetween the PHP tags.

<?php
funtion inserteditorjava();
if($blockid!="newaddition"){
metadescription($blockid);
metakeywords($blockid);
}
?>

You also need to correct the spelling of the word "function", it currently reads "funtion".

Once you do this the function will be defined and the error you are seeing will disappear

Del

phprookie

11:31 pm on Feb 12, 2007 (gmt 0)

10+ Year Member



Thanks Del - I appreciate all your help!