PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
hrubos
Forum Contributor
Posts: 172 Joined: Sat Oct 07, 2006 3:44 pm
Post
by hrubos » Fri Dec 29, 2006 5:49 am
how have I donw wrong???
so I received this message "Fatal error: Call to undefined function top_title() in D:\htdocs\BP\temp\function_temp.php on line 4"
function.php
Code: Select all
<?php
function top_title() {
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
echo '<tr>';
echo '<td height="26" align="left" valign="top"> </td>';
echo '</tr>';
echo '<tr>';
echo '<td width="168" align="left" valign="top"> ';
echo '</td>';
echo '<td align="left" valign="top"><table width="573" border="0" cellspacing="0" cellpadding="0">';
echo '<tr>';
echo '<td height="26" align="left" valign="top"> </td>';
echo '</tr>';
echo '<tr>';
echo '<td align="center" valign="middle" bgcolor="#B97429" style="font-size:10px; color:#FFF;"> </td>';
echo '</tr>';
echo '<tr>';
echo '<td align="left" valign="top"> </td>';
echo '</tr>';
echo '<tr>';
echo '<td align="left" valign="top" style="text-align:justify;">';
}
function bottom_title() {
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td align="left" valign="top">';
echo '</td>';
echo '</tr>';
echo '</table></td>';
echo '</tr>';
echo '</table>';
}
?>
funtion_temp.php
Code: Select all
<?php
include ("header_page.php");
include ("menu_index.php");
top_title();
include ("../autorizace/registrace_display.php");
bottom_title();
?>
Corvin
Forum Commoner
Posts: 49 Joined: Sun Dec 03, 2006 1:04 pm
Post
by Corvin » Fri Dec 29, 2006 5:56 am
You have to include function.php .
hrubos
Forum Contributor
Posts: 172 Joined: Sat Oct 07, 2006 3:44 pm
Post
by hrubos » Fri Dec 29, 2006 6:09 am
Corvin wrote: You have to include function.php .
yeah, thank
and so too can use require
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Fri Dec 29, 2006 6:14 am
hrubos wrote: and so too can use require
Yes, and if your script will unconditionally fail with a fatal error if the file cannot be included I'd rather use require than include
Ollie Saunders
DevNet Master
Posts: 3179 Joined: Tue May 24, 2005 6:01 pm
Location: UK
Post
by Ollie Saunders » Fri Dec 29, 2006 8:40 am
top_title can be written as
Code: Select all
function top_title() {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">';
<tr>
<td height="26" align="left" valign="top"> </td>
etc....
<?php
}Which saves on all that echoing and quoting. If you need to use php in the middle just open the tag <?php and close it again ?> when you're done.
hrubos
Forum Contributor
Posts: 172 Joined: Sat Oct 07, 2006 3:44 pm
Post
by hrubos » Fri Dec 29, 2006 11:16 am
so html can be wrtitten in function?Really I don't know it
and I have a question about CSS, when I require so css doesn't run.
I have written a page student_page.php, and I use aplication CSS here, but when I try only student_page.php, it's ok, but when I require, so only there is HTML.
I don't know where are errors???
Code: Select all
else if($isAdmin =='2' ) {
// echo "<a href='../temp/student_page.php'>Rezervace </a>";
// include ('../temp/header_page.php');
//echo "hello you here";
include ("../temp/student_menu.php");
top_title();
bottom_title();
//echo "<p> <a href='../temp/student.php'> </a> </p>";
$_SESSION['valid_user']=$login;
return $return_array;
}
}