I have this script for switching headers and footers, and i want to have a contact block function in the footers function...i thought that it was enough to put $contact(); in the footers function, and then in the contact script put $contact = 'contact_block'; to make it work......
Here is the switch function for the headers and the footers, and the contact block functin, with an attempt to make it work...:
<?
$site_encoding = 'XHTML';
$contact_block = 'show';
$owner_email = 'myemail@hotmail.com';
$owner_number = '123454567';
$owner_name = 'blabla';
opentable();
closetable();
//================================//
// Site Encoding Switcher //
//================================//
function opentable() {
global $site_encoding;
switch ($site_encoding) {
case 'XHTML':
XHTML_header();
break;
case 'WML':
default:
WML_header();
break;
}
}
function closetable() {
global $site_encoding;
switch ($site_encoding) {
case 'XHTML':
xhtml_footer_block()
xhtml_footer();
break;
case 'WML':
default:
wml_footer_block();
wml_footer();
break;
}
}
//================================//
// WML Header //
//================================//
function wml_header() {
header('Content-type: text/vnd.wap.wml');
echo '<?xml version="1.0"?>';
print<<<_WML_
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head>
<meta forua="true" http-equiv="Cache-Control" content="max-age=0"/>
</head>
_WML_;
}
//================================//
// WML Footer //
//================================//
function wml_footer() {
print<<<_WML_
</card>
</wml>
_WML_;
}
//================================//
// WML Footer Block //
//================================//
function wml_footer_block() {
$contact();
}
//================================//
// XHTML Header //
//================================//
function xhtml_header() {
echo '<?xml version="1.0" encoding="ISO-8859-1"?>';
print<<<_XHTML_
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
"http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
_XHTML_;
}
//================================//
// XHTML Footer //
//================================//
function xhtml_footer() {
print<<<_XHTML_
</body>
</html>
_XHTML_;
}
//================================//
// XHTML Footer Block //
//================================//
function xhtml_footer_block() {
$contact();
}
//================================//
// Contact Block Function //
//================================//
$contact = 'contact_block';
function contact_block() {
global $contact_block;
switch ($contact_block) {
case 'show':
show_contact_block();
break;
case '':
default:
show_contact_block_null();
break;
}
}
function show_contact_block() {
print<<<_WML_
<br/>
<a href="mailto:$owner_email">Send me an Email</a><br/>
<a href="wtai://wp/ap;$owner_number;$owner_name">Add my name to your phonebook</a><br/>
_WML_;
}
function show_contact_block_null() {
print<<<_WML_
_WML_;
}
?>
All the config variables are at the top, and the $contact(); is located in the xhtml_footer_block() and wml_footer_block() functions in an attempt to call the function.