Jump to content

[SOLVED] php function problem


desithugg

Recommended Posts

Umm I have a php function for a tab menu

<?
function tabarea()
{
print("
<div class='tabArea'>
  <a href='?do=page&action=main' class='tab'>Home</a>
  <a href='?do=page&action=rpg' class='tab'>RPG</a>
  <a href='index.php' class='tab'>Forums</a>
  <a href='do=page&action=chatroom' class='tab'>Chatroom</a>
</div>
");
}
echo"
<head>
<link rel='stylesheet' type='text/css' href='http://7thsky.7t.funpic.org/rpg/Themes/default/style.css?fin11' />
<style>
.abody
{
background-image: url(http://7thsky.7t.funpic.org/rpg/images/banner.png);
}
body
{
background-image: url(http://7thsky.7t.funpic.org/rpg/images/background.png);
}
</style>
</head>
<body>
<body valign='top'>
<div class='abody'>
".tabarea()."
<div class='body'>
<table width='100%' cellspacing='0' cellpadding='0'><tr>
<td class='leftmenu' valign='top' rowspan='2'>
left menu here
</td></tr>
</table>
</div>
";
?>

Um the problem is that instead of the menu showing up between

<div class='abody'>
".tabarea()."
<div class='body'>

it shows up at the very top of the page

I tried changing the print to echo and stuff but it didn't work.

Here's the page source of how it shows up

<div class='tabArea'>
  <a href='?do=page&action=main' class='tab'>Home</a>
  <a href='?do=page&action=rpg' class='tab'>RPG</a>
  <a href='index.php' class='tab'>Forums</a>
  <a href='do=page&action=chatroom' class='tab'>Chatroom</a>
</div>

<head>

<link rel='stylesheet' type='text/css' href='http://7thsky.7t.funpic.org/rpg/Themes/default/style.css?fin11' />
<style>
.abody
{
background-image: url(http://7thsky.7t.funpic.org/rpg/images/banner.png);
}
body
{
background-image: url(http://7thsky.7t.funpic.org/rpg/images/background.png);
}
</style>
</head>
<body>
<body valign='top'>
<div class='abody'>
<div class='body'>
<table width='100%' cellspacing='0' cellpadding='0'><tr>
<td class='leftmenu' valign='top' rowspan='2'>
left menu here
</td></tr>
</table>
</div>

Any idea's how i can get it to show up where i execute the function?

Link to comment
https://forums.phpfreaks.com/topic/51097-solved-php-function-problem/
Share on other sites

Try this! You're trying to mixed php with html

a little too much. Its ok IF you were using php5,

then you could use the print <<< HERE HERE;

 

Why are you using a Internal style sheet and a External sheet?

 

<?php
function tabarea()
{
print("
<div class='tabArea'>
  <a href='?do=page&action=main' class='tab'>Home</a>
  <a href='?do=page&action=rpg' class='tab'>RPG</a>
  <a href='index.php' class='tab'>Forums</a>
  <a href='do=page&action=chatroom' class='tab'>Chatroom</a>
</div>
");
}
?>
<head>
<link rel='stylesheet' type='text/css' href='http://7thsky.7t.funpic.org/rpg/Themes/default/style.css?fin11' />
<style>
.abody
{
background-image: url(http://7thsky.7t.funpic.org/rpg/images/banner.png);
}
body
{
background-image: url(http://7thsky.7t.funpic.org/rpg/images/background.png);
}
</style>
</head>
<body>
<body valign='top'>
<div class='abody'>
<?php echo tabarea();?>
<div class='body'>
<table width='100%' cellspacing='0' cellpadding='0'><tr>
<td class='leftmenu' valign='top' rowspan='2'>
left menu here
</td></tr>
</table>
</div>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.