Jump to content


Photo

Trouble in PHP-Land


  • Please log in to reply
9 replies to this topic

#1 ztagged

ztagged
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 15 May 2006 - 04:20 AM

Hi, I'm a bit confused with PHP right now. I have a page (PHP), with links to pages that I'd like to open in a div. Below is my code. I'm hoping this is something small that I lost.

<html> 

<head> 
<meta http-equiv="Content-Language" content="en-us"> 
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> 
<title>SpazzRadio</title> 

<script LANGUAGE="JavaScript"> 
<!-- Begin 
function popUp(URL) { 
day = new Date(); 
id = day.getTime(); 
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=150,left = 362,top = 234');"); 
} 
// End --> 
</script> 
</head> 

<body bgcolor="#333300"> 

<table border="1" width="65%" id="table1" bordercolorlight="#000000" bordercolordark="#000000" align="center" height="15%"> 
    <tr> 
        <td height="50%" bgcolor="#669900"> 
        <p align="center"><b><font face="Verdana" color="#FFFFFF"> 
        SpazzRadio.com </font></b></td> 
    </tr> 
    <tr> 
        <td bgcolor="#666633"> 
        <p align="center"><font color="#FFFFFF"><?php include 'staff/dj/overwrite.html' ?></font></td> 
    </tr> 
</table> 

<div align="center"> 

<table border="1" width="65%" id="table2" height="60" bordercolorlight="#000000" bordercolordark="#000000"> 
    <tr> 
        <td width="141" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#669900"> 
        <p align="center"><font face="Verdana" size="1" color="#FFFFFF"> 
        <b>Navigation<br><br></b>+ Home<br>+&nbsp;[b]<a href="green.php?page=test4">News</a[/b]><br>+ Staff<br>+ Junk!<br> 
        + Contact<br>+ Tune in!<br>+ Legal<br>+ Boards<br>+ Habbo Canada</font><p align="center">&nbsp;</td> 
        <td bgcolor="#666633"> 
        [b]     <div align="center"><?php include "test3.html"; ?></div>[/b] 
      <div align="center"></div> </td> 
    </tr> 
</table> 

</div> 

<table border="0" width="100%" id="table3" style="border-collapse: collapse"> 
    <tr> 
        <td></td> 
        <td><?php include "request/request.php" ?></td> 
        <td></td> 
         
    </tr> 
</table> 

<table border="0" width="80%" id="table4" style="border-collapse: collapse" align="center"> 
    <tr> 
        <td> 
        <br><p align="center"><?php include 'stats/radio_stats.php' ?><br><td> 
    </tr> 
</table> 

</body> 

</html>

Any help is more than appreciated.

#2 cunoodle2

cunoodle2
  • Members
  • PipPipPip
  • Advanced Member
  • 602 posts

Posted 15 May 2006 - 05:30 AM

Your post does not actually have a question. What is the EXACT problem that you are having? Are there any error messages? What is your page doing when you run it? What are you EXPECTING it to do?

If the code was working and now it's not, something changed. Did you change any code?

yeah, just a little bit, I am trying to start from beginning and trace my steps to see what i did wrong unless you see it.


#3 jeremywesselman

jeremywesselman
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts
  • LocationIndependence, KY

Posted 15 May 2006 - 05:33 AM

You need to be more specific with your problem. You didn't give us much to work with.

How are you having trouble? Are you trying to open it with <a href="green.php?page=test4">News</a>?

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--]

#4 ztagged

ztagged
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 15 May 2006 - 06:13 PM

Sorry about that. I'm trying to get other pages to open in a div, in a table. Possibly I'm not being too clear, but basically I'm trying to get the div to act SOMEWHAT as an iframe, but more as a content placeholder. The content being the other pages. Going into the div. Get what I'm saying? =x

#5 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 15 May 2006 - 06:20 PM

Your in the wrong forum. This is nothing to do with php, its a client-side / javascript issue. There is a client-side specific board.

#6 haydndup

haydndup
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts
  • LocationJohannesburg, South Africa

Posted 15 May 2006 - 06:23 PM

Have you considered using include()?

[a href=\"http://www.php.net/manual/en/function.include.php\" target=\"_blank\"]Manual[/a]
[!--coloro:#660000--][span style="color:#660000"][!--/coloro--]The Gene Pool Could Use A Little Chlorine[!--colorc--][/span][!--/colorc--]

#7 ztagged

ztagged
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 15 May 2006 - 06:39 PM

[!--quoteo(post=374077:date=May 15 2006, 02:23 PM:name=WhyWindows)--][div class=\'quotetop\']QUOTE(WhyWindows @ May 15 2006, 02:23 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Have you considered using include()?

[a href=\"http://www.php.net/manual/en/function.include.php\" target=\"_blank\"]Manual[/a]
[/quote]

I have the 'include' in there.
Here's what's going wrong so far.
[a href=\"http://spazzradio.com/green.php\" target=\"_blank\"]http://spazzradio.com/green.php[/a]
See on the right, the "aaa"? That's where I want the other pages to open. In that div. [[ Edit: Ignore the missing image. It thinks it's still in the correct directory.]]

[!--quoteo(post=374075:date=May 15 2006, 02:20 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ May 15 2006, 02:20 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Your in the wrong forum. This is nothing to do with php, its a client-side / javascript issue. There is a client-side specific board.
[/quote]
Not sure how this is a javascript issue (Aside from my script at the top of the code) but alrighty then..

#8 jeremywesselman

jeremywesselman
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts
  • LocationIndependence, KY

Posted 16 May 2006 - 10:38 AM

I understand what you are trying to do. You'll need to use a switch statement with includes.
<?php
//use a switch statement to find out which page is in the URL
switch($_GET['Page'])
{
     case 'About':
     {
      include('include/about.php');
     }
     break;
                    
     case 'Services':
     {
          include('include/services.php');
     }
     break;

     default:
     {
          include('include/home.php');
     }
     break;
}
?>

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--]

#9 ztagged

ztagged
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 16 May 2006 - 09:24 PM

[!--quoteo(post=374238:date=May 16 2006, 06:38 AM:name=jeremywesselman)--][div class=\'quotetop\']QUOTE(jeremywesselman @ May 16 2006, 06:38 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I understand what you are trying to do. You'll need to use a switch statement with includes.
<?php
//use a switch statement to find out which page is in the URL
switch($_GET['Page'])
{
     case 'About':
     {
      include('include/about.php');
     }
     break;
                    
     case 'Services':
     {
          include('include/services.php');
     }
     break;

     default:
     {
          include('include/home.php');
     }
     break;
}
?>

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--]
[/quote]

Okay. Now, I have that. So, in the case of /includes/about.php, I'd make the link "green.php?page=about", correct? If so, I tried that, doesn't seem to work. Otherwise, the default page loads just great.

Edit: Capitilization matters in life. _Thumbs up_

Edit Deux: Still doesn't load, with proper capilitization. Link: "green.php?page=About"

#10 jeremywesselman

jeremywesselman
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts
  • LocationIndependence, KY

Posted 17 May 2006 - 09:12 AM

All this does is check the $_GET['Page'] variable and select which file to show. In your navigation, your links would look like this:

<a href="index.php?Page=green">Green</a>

Then your switch would look like this:

<?php
//use a switch statement to find out which page is in the URL
switch($_GET['Page'])
{
     //if $_GET['Page'] is equat to 'green', display the content for that file.
     case 'green':
     {
      //this is where you include the file you want to display.
      include('green_content.php');
     }
     break;
    
    //whatever you want displayed in the div on index.php goes here.                
    default:
     {
          include('home_content.php');
     }
     break;
}
?>

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users