GIDForums  

Go Back   GIDForums > Webmaster Forums > Web Design Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 25-Nov-2003, 18:09
pcxgamer's Avatar
pcxgamer pcxgamer is offline
Senior Member
 
Join Date: Sep 2002
Location: South Carolina, USA
Posts: 1,060
pcxgamer is a jewel in the roughpcxgamer is a jewel in the roughpcxgamer is a jewel in the rough

Help with Page Design


I'm working on my site and I need a little help with the front page. I would like something similar to the front page here; I want to display my news on the center portion of the page and a navigation bar to the right. But I'm not sure how to de that and need a little advice.

Thanks
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.
  #2  
Old 25-Nov-2003, 20:29
pcxgamer's Avatar
pcxgamer pcxgamer is offline
Senior Member
 
Join Date: Sep 2002
Location: South Carolina, USA
Posts: 1,060
pcxgamer is a jewel in the roughpcxgamer is a jewel in the roughpcxgamer is a jewel in the rough
Ok I finally got the site the way that I think I would like it but when I try and pull my news script in I can see the news but above the news I see an error. Here my HTML

HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#000000" topmargin="0" leftmargin="0" text="#FFFFFF"> <img src="logo2.gif"> <table width="100%" height="100%" border="0"> <tr> <td width="13%" align="center" valign="top"> NAV </td> <td width="87%"><?PHP include ("news.php"); ?></td> </tr> </table> </body> </html>

and here the error I getting.


Warning: Cannot send session cache limiter - headers already sent (output started at /home/virtual/site228/fst/var/www/html/index.php:15) in /home/virtual/site228/fst/var/www/html/news.php on line 1

I'm not too good with PHP yet so I'm not to sure about this error.

Thanks for any help.
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.
  #3  
Old 25-Nov-2003, 23:22
pcxgamer's Avatar
pcxgamer pcxgamer is offline
Senior Member
 
Join Date: Sep 2002
Location: South Carolina, USA
Posts: 1,060
pcxgamer is a jewel in the roughpcxgamer is a jewel in the roughpcxgamer is a jewel in the rough
I have found this information.
Quote:
Cause
The PHP function such as headers(), used with start_session(), produces HTML headers. When the PHP fragments are placed in the body of the HTML, this causes errors because the PHP fragments are trying to put HTML headers within the HTML body.
Solution
Put the PHP fragments before the HTML body tag.

What I need to know how can I put this php in my html in the header section?
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.
  #4  
Old 26-Nov-2003, 09:08
BobbyDouglas's Avatar
BobbyDouglas BobbyDouglas is offline
Regular Member
 
Join Date: Aug 2003
Posts: 789
BobbyDouglas has a spectacular aura aboutBobbyDouglas has a spectacular aura about
Maybe there is a problem with your news.php script? Post the code to that, maybe JdS would know
__________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business.
  #5  
Old 26-Nov-2003, 09:21
pcxgamer's Avatar
pcxgamer pcxgamer is offline
Senior Member
 
Join Date: Sep 2002
Location: South Carolina, USA
Posts: 1,060
pcxgamer is a jewel in the roughpcxgamer is a jewel in the roughpcxgamer is a jewel in the rough
Ok here's the php code.

PHP Code:

<?session_start();
include "config/config.php";
include "config/func.php";
include "config/java.php";?><head><title><?=$sitetitle;?></title>
<LINK href="styles/<?=$style;?>/<?=$style;?>.css" type=text/css rel="stylesheet">
</head>
<center>





<?############################### News Comments ################################
if ($_GET[go] == "comments") {

$bg1 = "comment"; //$1 is the class of the first and third and so on, comment <td>
$bg2 = "comments"; //$2 is the class of the second and fourth and so on, comment <td>

//querying the Mysql table for News Item
$query = mysql_query("SELECT * FROM ".$prefix."_news WHERE id = '".$_GET[id]."'");
while ($r = mysql_fetch_array($query)) {
$nid = $r[id];
//Counting number of comments for the news item!
$count = mysql_query("SELECT count(*) FROM ".$prefix."_comments WHERE nid = '".$_GET[id]."'") or exit(mysql_error());
$c = mysql_result($count, 0)?>

<table cellpadding="2" cellspacing="0" class="newstable"><tr>
<td class="subject"><?=$dot;?><b><?=nohtml($r[subject]);?></b><?=$dot;?><a href="mailto:<?=$r[mail];?>"><?=$r[name];?></a> - <?=$r[date];?></td></tr>
<tr><td class="text"><?=code($r[text]);?></td></tr></table>
<?}?><br>

<table cellpadding="1" cellspacing="0" class="newstable"><tr>
<td class="subject">There are <b><?=$c;?></b> Comments on this News Item - <a href="#post">Post a Comment...</td></tr>
<?//querying the Mysql table for comments
$query2 = mysql_query("SELECT * FROM ".$prefix."_comments WHERE nid = '".$_GET[id]."'");
while ($r2 = mysql_fetch_array($query2)){?>
<tr>
<td class="<?//Changing the bg color of 2th, 4th..... <td>
if ( $i++ % 2 == 0 ) {
echo $bg1; 
} else { 
echo $bg2; 
}?>">

<b><?//if mail isnt posted it just prints the name, no link!
if ($r2[mail] == "") { 
echo $r2[name]; 
} else { 
echo "<a href='mailto:".$r2[mail]."'>".$r2[name]."</a>"; 
}?></b>
 - <i><?=$r2[date];?></i><br>
<?=code2($r2[text]);?><br>
--------------------------------------------------------------------------
</td></tr><?}?></table>
<br><br>
<?//Posting form?>
<a name="post">
<table cellpadding="0" cellspacing="0"><tr><form action="news.php?go=add&id=<?=$_GET[id];?>" method="POST"><td>
Name:<bR>
<input type="text" name="name">
<input type="hidden" name="nid" value="<?=$nid;?>"><br>
Mail:<bR>
<input type="text" name="mail"><br>
Text:<br>
<textarea cols="25" rows="5" name="text"></textarea><br>
<input type="submit" value="Post Comment">
</td></form></tr></table>



<?############################### News Comment add ################################
} elseif ($_GET[go] == "add") {
mysql_query("INSERT INTO ".$prefix."_comments (nid,name,mail,text,date) VALUES ('".$_POST[nid]."','".$_POST[name]."','".$_POST[mail]."','".$_POST[text]."','".date("d/m-y H:i")."')");
echo "<script>self.location='news.php?go=comments&id=".$_GET[id]."';</script>";
?>




<?############################### News Admin ################################
} elseif ($_GET[go] == "admin") {?>
<center><br><br>

<?//prints the error message!
if ($_GET[error] == "1") {?>
<b>Wrong Password!
<?}?>

<form action="news.php?go=login" method="POST">
<input type="password" name="pass"> <input type="submit" value="Log in">
</form></center>

<?//checking the submitted password
} elseif ($_GET[go] == "login") {
if ($_POST[pass] == $password) {
$_SESSION['admin'] = "yes";
echo "<script>self.location='news.php';</script>";
} elseif ($_POST[pass] !== $password) {
echo "<script>self.location='news.php?go=admin&error=1';</script>";
}




############################### News Log Out ################################
} elseif ($_GET[go] == "logout") {
session_unregister("admin");
session_destroy();
echo "<script>self.location='news.php';</script>";




############################### News Delete ################################
} elseif ($_GET[go] == "del") {
mysql_query("DELETE FROM ".$prefix."_news WHERE id = '".$_GET[id]."'");
echo "<script>self.location='news.php';</script>";




} elseif ($_GET[go] == "all") {
//Paging shit
$limit3 = $limit2;
if (isset ($_GET['p']) ) {
$p = $_GET['p'];
} else {
$p = "0";
}
$offset = $p * $limit3;
$result = mysql_query("SELECT COUNT(*) AS rows_tot FROM ".$prefix."_news") or die(mysql_error());
$row = mysql_fetch_array($result);
if ($row['rows_tot'] > 0 ) {
$pages_tot = (ceil($row['rows_tot'] / $limit3) - 1);
echo "<b>" . ($p + 1) . "</b> of <B>" . ($pages_tot + 1) . "</b><br><br>";?>

<center>
<table cellpadding="1" cellspacing="0" class="newstable"><tr align='center'>
<td align='left' class="subject">&nbsp;<b>Subject</td><td class="subject"><b>User</td><td class="subject"><b>Date</td><td class="subject"><b>Comments</td></tr>

<?$result = mysql_query("SELECT * FROM ".$prefix."_news ORDER BY id DESC LIMIT ".$offset.", ".$limit3."") or die(mysql_error());
while ($r = mysql_fetch_array($result)) {
//Count comments
$count3 = mysql_query("SELECT count(*) FROM ".$prefix."_comments WHERE nid = '".$r[id]."'") or exit(mysql_error());
$c3 = mysql_result($count3, 0);?>

<tr class="tr"><td>
&nbsp;<b><a href="news.php?go=comments&id=<?=$r[id];?>"><?=noHtml(splitRubrik($r[subject],20));?></a></td>
<td align="center"><a href="mailto:<?=$r[mail];?>"><?=$r[name]; ?></a></td>
<td align="center"><?=$r[date]; ?></td>
<td align="center"><?=$c3;?></td></tr>
<?}?>
</table><br>
<?if($pages_tot > 0) { // Prints the links to all the pages of more then 1
for($i = 0; $i <= $pages_tot; $i++) {
if($i == $p) { echo "<B> " . ($i + 1) . " </b>"; } else { echo "<a href=\"news.php?go=all&page=$i\">" . ($i + 1) . "</a> "; }}
} else { echo "<b> 1 </b>"; }} else { echo "<font color='red'><b>No Posts here yet :(</b></font>"; }?>





<?############################### News Main ################################
} else {
//Check if there are any news in the database
$count2 = mysql_query("SELECT count(*) FROM ".$prefix."_news") or exit(mysql_error());
$c2 = mysql_result($count2, 0);

if ($c2 == "0") {?>
<br><br><b>There isn't any news here yet! sry!</b>
<?if ($_SESSION[admin] == "yes") {?>
<br><a href="javascript:popup('add.php',320,280);">Add News</a>
<?}
} else {
//querying the Mysql table
$query = mysql_query("SELECT * FROM ".$prefix."_news ORDER BY id DESC LIMIT ".$limit."");
while ($r = mysql_fetch_array($query)) {

//Counting number of comments for the news item!
$count = mysql_query("SELECT count(*) FROM ".$prefix."_comments WHERE nid = '".$r[id]."'") or exit(mysql_error());
$c = mysql_result($count, 0);

//Here comes the HTML!?>
<table cellpadding="2" cellspacing="0" class="newstable"><tr>
<td class="subject"><?=$dot;?><b><?=nohtml($r[subject]);?></b><?=$dot;?><a href="mailto:<?=$r[mail];?>"><?=$r[name];?></a> - <?=$r[date];?></td></tr>
<tr><td class="text"><?=code($r[text]);?></td></tr>
<tr><td class="text">
<b><a href="news.php?go=all">All news</a> - <a href="news.php?go=comments&id=<?=$r[id];?>">Comments</b> (<?=$c;?>)</a>
<?if ($_SESSION[admin] == "yes") {?>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:popup('edit.php?id=<?=$r[id];?>',320,180);">Edit</a> / <a href="news.php?go=del&id=<?=$r[id];?>">Delete</a> / <a href="javascript:popup('add.php',320,280);">Add new</a>
<?}?>
</td></tr></table><br>
<?}}}



############################### knubbe's AD & ADMIN ################################
//PLEASE DO NOT REMOVE THIS !?>
<br><br>This site is using News v1.2 by <a href="http://clan-manager.tk" target="_blank">knubbe</a> | 
<?//If already logged in you get a log out link instead!
if ($_SESSION['admin'] !== "yes") {?>
<a href="news.php?go=admin">Admin</a>
<?} else {?>
<a href="news.php?go=logout">Log Out</a>
<?}?>


Thanks for the help.
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.
  #6  
Old 27-Nov-2003, 03:54
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
OK PCX, I didn't look beyond the first line of your news script above.

To fix this quickly and quite simply; you just add ob_start() to the top of your web page; example:

PHP Code:

<?php
ob_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#000000" topmargin="0" leftmargin="0" text="#FFFFFF">
<img src="logo2.gif">
<table width="100%" height="100%" border="0">
  <tr> 
    <td width="13%" align="center" valign="top">
      NAV
    </td>
    <td width="87%"><?PHP include ("news.php"); ?></td>
  </tr>
</table>
</body>
</html>
  #7  
Old 27-Nov-2003, 03:58
pcxgamer's Avatar
pcxgamer pcxgamer is offline
Senior Member
 
Join Date: Sep 2002
Location: South Carolina, USA
Posts: 1,060
pcxgamer is a jewel in the roughpcxgamer is a jewel in the roughpcxgamer is a jewel in the rough
Oh my thank you a million times. Why did that work? Thank you
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.
  #8  
Old 27-Nov-2003, 05:19
pcxgamer's Avatar
pcxgamer pcxgamer is offline
Senior Member
 
Join Date: Sep 2002
Location: South Carolina, USA
Posts: 1,060
pcxgamer is a jewel in the roughpcxgamer is a jewel in the roughpcxgamer is a jewel in the rough
Ok now that I have that done. Thanks J, I need to know my page uses tables you can see the script above. What I would like to do is be able to click on the link in the side bar and it open on the same table that the news script is on. I hope this is understandable if not I'll try to explain it better. Thanks for any help.
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.
  #9  
Old 04-Dec-2003, 05:50
mop mop is offline
New Member
 
Join Date: Nov 2003
Posts: 14
mop is an unknown quantity at this point
C:\Documents and Settings\Brian\My Documents\bbfdd.html well that is what im getting andthe only suggestion niow is why is the tiltle tag inside the heading? That becomes part of the heading then. So take it out
  #10  
Old 04-Dec-2003, 05:54
mop mop is offline
New Member
 
Join Date: Nov 2003
Posts: 14
mop is an unknown quantity at this point
Quote:
Originally posted by pcxgamer
Ok now that I have that done. Thanks J, I need to know my page uses tables you can see the script above. What I would like to do is be able to click on the link in the side bar and it open on the same table that the news script is on. I hope this is understandable if not I'll try to explain it better. Thanks for any help.
what do u want? to make a link toanother page its the same the tag link tag only specify what document u want to be inserted instead of url. Open it on the same table? Just code it so its the same. What is the NAV in that code it sticks out? Not to mention there is no nav bar. the
 
 

Recent GIDBlogFlickr uploads of IA pictures by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
simple form from generated page zuzupus Web Design Forum 0 17-Sep-2003 09:27
[script] E-mail webmaster error page BobbyDouglas PHP Code Library 0 19-Aug-2003 20:10
Using browser extensions to enhance web design jrobbio Web Design Forum 0 27-Jul-2003 17:38
Search Engine Positioning 101 and 201 "How To" Tips... 000 Search Engine Optimization Forum 0 29-May-2003 10:34
The resurrection for the "designers adrenalin kick" Michael Christe Web Design Forum 0 19-Jan-2003 04:36

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 23:40.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.