Re: newbie - function is undefined

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Jim,

Strange  enough :-). Your are trying to include a JavaScript file into
a Php script.
You have two routines to accomplish:
1.  Either rewrite your GetText function in PHP instead of JavaScript.
By  the way, I would suggest you to rename the function since there is
an  extension  called  GetText  and  a function called the same. It is
needed for the i18n and l10n purposes.
2. Replace your include with the following:
<script                                         type="text/javascript"
src="../php/inc/js/getText.js"></script>
And call the function in JavaScript.
Hope this helps!

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

------------ Original message ------------
From: Jim Giner <jim.giner@xxxxxxxxxxxxxxxxxx>
To: php-general@xxxxxxxxxxxxx
Date created: , 12:07:44 AM
Subject:  newbie - function is undefined


      I have this code in my php script.  A simple page to test out a function 
that I learned from a book I bought.

<?php
$root = $_SERVER['DOCUMENT_ROOT'];
include($root.'/../php/inc/js/getText.js');
?>

</head>


The include gets a function I wrote called getText and I have dumped the 
source code of my webpage after I get the error and i see that the include 
did in fact work.  There is a function with that name.  Here is the header

<script type="text/javascript">
function getText(e)
{
.

.

.}
</script>
</head>


In the body of my html doc built by this script I have the following lines:

echo 'para contains: ';
echo getText("p1");    ****
echo '<br><br>';
echo 'heaading contains: '.getText("h2");
?>
</body>


I get this output on the line containing the ****

para contains:
Fatal error: Call to undefined function getText() in 
/home/albany/public_html/players_dir/test_gettext.php on line 23


As you can see my output starts out as I expect but then I get the undefined 
function message.

What am I not doing correctly?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux