Looking for a way to call a php function that has its include 'functions.php' in the original file.
This is what is in my index.php file, so when i click on a link it will load (new.php) into the (#container) div.
<?php include 'functions.php' ?>
<script type="text/javascript">
$(document).ready(function() {
$('a').click(function(e) {
$('#container').load(new.php).hide().fadeIn(500);
return false;
});
});
</script>
So in my new.php, i want to call a function that is located in functions.php, but obviously i get an undefined error.
<?php some_func() ?>
I know you can just put another include 'functions.php' inside the new.php
but since the functions.php contains mysql connections/queries and other includes etc.. i dont really want to keep reloading it.
so is there any way i can reload the functions.php into the newly loaded div and call functions from it?
<?php include 'functions.php' ?>into thenew.phpfile and try again. also make sure the paths to the files are correct.require_onceorinclude_oncethefunctions.phpwill be included only once (for the first time it is needed) and won't be reloaded everytime ;-)