Page 1 of 1

New webdesign...Need advise/help transfering code...

Posted: Thu Dec 13, 2007 9:18 am
by gaogier
Hello.

My current design, http://runehints.com
My new design, http://runehints.com/images/index.php

As you can see, the poll on the current design is on the right hand side, and under the old design. On the new design, the poll is on the left, using 2 different colour schemes. I have put the Poll in a new file, http://runehints.com/poll.php

Code: Select all

<?php
require_once ('mysql_connect.php');//connect to db
	$current_query = "SELECT * FROM poll_current";
	if ($current_result = mysql_query($current_query)) {
	  $current_row = mysql_fetch_array($current_result);
	  $current = $current_row['poll_num'];
	}
	
	if(isset($_POST['submit']) && ctype_digit($_POST['vote'])) {
	  $query = 'UPDATE poll_answers SET votes=votes+1 WHERE choice=' . $_POST['vote'] .' && poll_num='.$current;
	  $result = mysql_query($query);
	  ob_end_clean();
	  setcookie ('vote', 'voted', time()+1209600, '/', 'runehints.com', '0');
	  ob_end_clean();
	  header("Location: http://runehints.com");
	  require_once ('../mysql_connect.php');//connect to db
	}
	
	if (isset($_COOKIE['vote']))  
{   
	$question_query = 'SELECT * FROM poll_questions WHERE poll_num='.$current;
	if($question_result = mysql_query($question_query)) {
		$question_row = mysql_fetch_array($question_result);
		$question = $question_row['question'];

	$num_votes_query = 'SELECT SUM(votes) AS sumvotes
	FROM poll_answers WHERE poll_num='.$current;

	if ($result = mysql_query($num_votes_query)) {
	  $row = mysql_fetch_array($result);
	  $sum = $row['sumvotes'];
	}
	$totals_query = 'SELECT activity, votes FROM poll_answers WHERE poll_num='.$current.' ORDER BY choice ASC';
	if ($result = mysql_query($totals_query)) {
	echo '<font class="small2">'.$question.'<br /><br />';
	echo '<table width="100%" cellpadding="1" cellspacing="0" border="0" style="font-family: Verdana; font-size: 9px; color: #efefef">';
		
	  while($row = mysql_fetch_array($result)) {
	  	$percent = round($row['votes'] * 100 / $sum);
	  	echo '<tr><td width="3"></td><td width="100%" colspan="3">'. $row['activity'];
		echo '</td><td width="3"></td></tr><tr><td width="3"></td><td width="100%"><table width="100%"><tr><td height="9" width="'. $percent .'" background="http://www.runehints.com/images/bar.png"></td><td></td></tr></table></td><td width="3"></td><td width="0" align="right">'. $row['votes'] .'</td><td width="3"></td></tr>';
	  }
	  echo '<table cellpadding="0" cellspacing="0" border="0"><tr><td height="3"></td></tr></table><font style="font-size: 9px"><center><i>Votes:&nbsp;'.$sum.'</i></center></font>'; 
	  
	}else{
	echo '<font class="small2">Sorry no polls are currently active</font>';
	}
}	
	
}else{
	$question_query = 'SELECT * FROM poll_questions WHERE poll_num='.$current;
	if($question_result = mysql_query($question_query)) {
		$question_row = mysql_fetch_array($question_result);
		$question = $question_row['question'];
		
		
		  
		$form_query = 'SELECT * FROM poll_answers WHERE poll_num='.$current;
		if($result = mysql_query($form_query)) {
			echo '<form action='.$_SERVER['PHP_SELF'].' method="post">';
			echo '<font class="small2">'.$question.'<br />';
		  	while($row = mysql_fetch_array($result)) {
		   
				echo '<input type="radio" name="vote" value=' . $row['choice'] . '>'. $row['activity'] . '<br />';
		 	 }
				echo '<center><input name="submit" type="submit" value="Vote!"></form></center>';
			
		}

	}else{
		echo '<font class="small2">Sorry no polls are currently active </font>'; 
	}

}
?>

I just want the latest news artical to show up on the site. With the headlines of the news thats not so new in the box below. Basicly the boxes which have, the following in.

Code: Select all

<p class="date">11.18.07</p>
										<h3><a href="#">Lorem ipsum dolor sit amet</a></h3>
										<p>Maecenas eros metus, posuere at, fermentum ac, suscipit in, metus. Pellentesque sed.</p>

I want it to show, the headline, the date, and then under that in a new line, Nobody has commented on this piece of news yet. Be the first!/comments(12) | Post a comment

There is no code at this time for the index file, due to it changing later today.



The Last 5 Guides added, All guides are added on a time line, when we add a guide it tells us when you added the guide.

I want this where the follow is.
Ipsum dolor sit amet
Maecenas eros metus, posuere at, fermentum ac, suscipit in, metus. Pellentesque sed dolor.

Where this image, http://www.runehints.com/images/images/homepage17.jpg is on the new design, I want some data to go over it. I want total number of articals (guides), How many people are on the website, and how many people are playing the game (if possable) data from runescape.com




There will be more as the day goes on.

Posted: Thu Dec 13, 2007 5:32 pm
by Chalks
There's not a single question mark in your post, so I'm confused... what do you need to know?



edit: Yes there is:

Code: Select all

<?php
//...
//...
//...
?>

Posted: Thu Dec 13, 2007 8:01 pm
by s.dot
There are a lot of points of what you want, but the question is, what have you tried?

Re: New webdesign...Need advise/help transfering code...

Posted: Thu Dec 13, 2007 8:22 pm
by gaogier
gaogier wrote:Hello.

My current design, http://runehints.com
My new design, http://runehints.com/images/index.php

As you can see, the poll on the current design is on the right hand side, and under the old design. On the new design, the poll is on the left, using 2 different colour schemes. I have put the Poll in a new file, http://runehints.com/poll.php

Code: Select all

<?php
require_once ('mysql_connect.php');//connect to db
	$current_query = "SELECT * FROM poll_current";
	if ($current_result = mysql_query($current_query)) {
	  $current_row = mysql_fetch_array($current_result);
	  $current = $current_row['poll_num'];
	}
	
	if(isset($_POST['submit']) && ctype_digit($_POST['vote'])) {
	  $query = 'UPDATE poll_answers SET votes=votes+1 WHERE choice=' . $_POST['vote'] .' && poll_num='.$current;
	  $result = mysql_query($query);
	  ob_end_clean();
	  setcookie ('vote', 'voted', time()+1209600, '/', 'runehints.com', '0');
	  ob_end_clean();
	  header("Location: http://runehints.com");
	  require_once ('../mysql_connect.php');//connect to db
	}
	
	if (isset($_COOKIE['vote']))  
{   
	$question_query = 'SELECT * FROM poll_questions WHERE poll_num='.$current;
	if($question_result = mysql_query($question_query)) {
		$question_row = mysql_fetch_array($question_result);
		$question = $question_row['question'];

	$num_votes_query = 'SELECT SUM(votes) AS sumvotes
	FROM poll_answers WHERE poll_num='.$current;

	if ($result = mysql_query($num_votes_query)) {
	  $row = mysql_fetch_array($result);
	  $sum = $row['sumvotes'];
	}
	$totals_query = 'SELECT activity, votes FROM poll_answers WHERE poll_num='.$current.' ORDER BY choice ASC';
	if ($result = mysql_query($totals_query)) {
	echo '<font class="small2">'.$question.'<br /><br />';
	echo '<table width="100%" cellpadding="1" cellspacing="0" border="0" style="font-family: Verdana; font-size: 9px; color: #efefef">';
		
	  while($row = mysql_fetch_array($result)) {
	  	$percent = round($row['votes'] * 100 / $sum);
	  	echo '<tr><td width="3"></td><td width="100%" colspan="3">'. $row['activity'];
		echo '</td><td width="3"></td></tr><tr><td width="3"></td><td width="100%"><table width="100%"><tr><td height="9" width="'. $percent .'" background="http://www.runehints.com/images/bar.png"></td><td></td></tr></table></td><td width="3"></td><td width="0" align="right">'. $row['votes'] .'</td><td width="3"></td></tr>';
	  }
	  echo '<table cellpadding="0" cellspacing="0" border="0"><tr><td height="3"></td></tr></table><font style="font-size: 9px"><center><i>Votes:&nbsp;'.$sum.'</i></center></font>'; 
	  
	}else{
	echo '<font class="small2">Sorry no polls are currently active</font>';
	}
}	
	
}else{
	$question_query = 'SELECT * FROM poll_questions WHERE poll_num='.$current;
	if($question_result = mysql_query($question_query)) {
		$question_row = mysql_fetch_array($question_result);
		$question = $question_row['question'];
		
		
		  
		$form_query = 'SELECT * FROM poll_answers WHERE poll_num='.$current;
		if($result = mysql_query($form_query)) {
			echo '<form action='.$_SERVER['PHP_SELF'].' method="post">';
			echo '<font class="small2">'.$question.'<br />';
		  	while($row = mysql_fetch_array($result)) {
		   
				echo '<input type="radio" name="vote" value=' . $row['choice'] . '>'. $row['activity'] . '<br />';
		 	 }
				echo '<center><input name="submit" type="submit" value="Vote!"></form></center>';
			
		}

	}else{
		echo '<font class="small2">Sorry no polls are currently active </font>'; 
	}

}
?>

I just want the latest news artical to show up on the site. With the headlines of the news thats not so new in the box below. Basicly the boxes which have, the following in.

Code: Select all

<p class="date">11.18.07</p>
										<h3><a href="#">Lorem ipsum dolor sit amet</a></h3>
										<p>Maecenas eros metus, posuere at, fermentum ac, suscipit in, metus. Pellentesque sed.</p>

I want it to show, the headline, the date, and then under that in a new line, Nobody has commented on this piece of news yet. Be the first!/comments(12) | Post a comment

There is no code at this time for the index file, due to it changing later today.



The Last 5 Guides added, All guides are added on a time line, when we add a guide it tells us when you added the guide.

I want this where the follow is.
Ipsum dolor sit amet
Maecenas eros metus, posuere at, fermentum ac, suscipit in, metus. Pellentesque sed dolor.

Where this image, http://www.runehints.com/images/images/homepage17.jpg is on the new design, I want some data to go over it. I want total number of articals (guides), How many people are on the website, and how many people are playing the game (if possable) data from runescape.com




There will be more as the day goes on.


The Questions nice and clear.


Will that poll script work with that new design, or will i need to recode the whole poll?

How can i make the news show, just 1 topic (thread, from phpbb3 forums) and then 5 or 6 thread titles with the date.

and, how can i make an image hold or show how many people are using the site, how many people are playing a game (data is text on a different site) and total number of guides?