Jump to content

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>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.