Greetings,
Ok so, what I am trying to do is have one file that stores several functions so I can use them across the entire site.
So first I have the page, in every page I call header.php, and inside that I call functions.php
But when I try to run the function I get this error:
PHP Fatal error: Call to undefined function clean()
Since I am pretty sure it is being caused simply becuase the function in inside an include (I have tested and found this to be the case as the function works just fine if placed in the body page) I will keep my examples to just the calling of the function and the function.php file.
So my pages are setup like this:
functions.php
I need the functions in a seprate file as I will probably need to edit them but I need to call it from about 6 to 10 different pages.
Any help would be appriciated.
Ok so, what I am trying to do is have one file that stores several functions so I can use them across the entire site.
So first I have the page, in every page I call header.php, and inside that I call functions.php
But when I try to run the function I get this error:
PHP Fatal error: Call to undefined function clean()
Since I am pretty sure it is being caused simply becuase the function in inside an include (I have tested and found this to be the case as the function works just fine if placed in the body page) I will keep my examples to just the calling of the function and the function.php file.
So my pages are setup like this:
functions.php
Code:
<?php
function clean($data)
{
$data = str_replace("&", "&", $data);
$data = str_replace("'", "'", $data);
$data = str_replace("\"", """, $data);
return $data;
}
?>
body.php uses this code to call the function
<?
$title = clean($_POST['title']);
?>
Any help would be appriciated.
Comment