TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 790
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online

Where do I find this in the code and how can insert it in...

Started by shawnlg, October 16, 2007, 10:40:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


IchBin

Can you post the code you have now so I can try to incorporate what you're doing into this?

shawnlg

#22
Here is the html code I am using however it will probably need to be in php.

<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<TABLE borderColor=#666666 cellSpacing=0 cellPadding=5 width="95%" border=1>
<TBODY>
<TR bgColor=#333333>
<TD width="14%">Show Number</TD>
<TD width="45%">Episode </TD>
<TD width="17%">Air date</TD>
<TD width="12%"><A href="http://www.scifiandgod.com/content/index.php?page=7">SAG Rating</A></TD>
<TD width="12%"><A href="http://www.scifiandgod.com/content/index.php?page=8">User Rating</A></TD></TR>
<TR>
<TD height=36>#101</SPAN> </TD>
<TD>Encounter At <SPAN class=SpellE>Farpoint</SPAN></SPAN></SPAN> </TD>
<TD>09/28/87</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#102</SPAN> </TD>
<TD>The Naked Now</SPAN></SPAN> </TD>
<TD>10/05/87</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#103</SPAN> </TD>
<TD>Code of Honor</SPAN></SPAN> </TD>
<TD>10/12/87</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#104</SPAN> </TD>
<TD>The Last Outpost</SPAN></SPAN> </TD>
<TD>10/19/87</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#105</SPAN> </TD>
<TD>Where No One Has Gone Before</SPAN></SPAN> </TD>
<TD>10/26/87</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#106</SPAN> </TD>
<TD>Lonely Among Us</SPAN></SPAN> </TD>
<TD>11/02/87</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#107</SPAN> </TD>
<TD>Justice</SPAN></SPAN> </TD>
<TD>11/09/87</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#108</SPAN> </TD>
<TD>The Battle</SPAN></SPAN> </TD>
<TD>11/16/87</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#109</SPAN> </TD>
<TD>Hide and Q</SPAN></SPAN> </TD>
<TD>11/23/87</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#110</SPAN> </TD>
<TD>Haven</SPAN></SPAN> </TD>
<TD>11/30/87</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#111</SPAN> </TD>
<TD>The Big Goodbye</SPAN></SPAN> </TD>
<TD>01/11/88</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#112</SPAN> </TD>
<TD><SPAN class=SpellE>Datalore</SPAN></SPAN></SPAN> </TD>
<TD>01/18/88</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#113</SPAN> </TD>
<TD>Angel One</SPAN></SPAN> </TD>
<TD>01/25/88</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#114</SPAN> </TD>
<TD>11001001</SPAN></SPAN> </TD>
<TD>02/01/88</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#115</SPAN> </TD>
<TD>Too Short a Season</SPAN></SPAN> </TD>
<TD>02/08/88</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#116</SPAN> </TD>
<TD>When the Bough Breaks</SPAN></SPAN> </TD>
<TD>02/15/88</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#117</SPAN> </TD>
<TD>Home Soil</SPAN></SPAN> </TD>
<TD>02/22/88</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#118</SPAN> </TD>
<TD>Coming of Age</SPAN></SPAN> </TD>
<TD>03/14/88</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#119</SPAN> </TD>
<TD>Heart of Glory</SPAN></SPAN> </TD>
<TD>03/21/88</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#120</SPAN> </TD>
<TD>The Arsenal of Freedom</SPAN></SPAN> </TD>
<TD>04/11/88</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#121</SPAN> </TD>
<TD>Symbiosis</SPAN></SPAN> </TD>
<TD>04/18/88</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#122</SPAN> </TD>
<TD>Skin of Evil</SPAN></SPAN> </TD>
<TD>04/25/88</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#123</SPAN> </TD>
<TD>We'll Always Have Paris</SPAN></SPAN> </TD>
<TD>05/02/88</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#124</SPAN> </TD>
<TD>Conspiracy</SPAN></SPAN> </TD>
<TD>05/09/88</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR>
<TR>
<TD>#125</SPAN> </TD>
<TD>The Neutral Zone</SPAN> </TD>
<TD>03/16/88</SPAN> </TD>
<TD>N/A</TD>
<TD>N/A</TD></TR></TBODY></TABLE>

IchBin

Yikes... don't forget to use the code tags when posting code. :) I'm trying to think of a more permanent solution to your show listing/rating. Ideally, I'd like to make a code snippet that you could use that would automatically create a list for you based on the category. You catch my drift? This way, you don't have to make an article and hand write the code to create your table of shows with ratings etc.


shawnlg

That would be awesome!  Thanks..  I am excited about this site.  Since getting started I am going to pull my other sites from phpnuke soon too.  Thanks!

IchBin

One more question: How are you planning to input your SAG rating? Is this something you were going to manually put in?

Reason I ask, is that the fields for air date and SAG are going to have to be grabbed from somewhere. I have an idea on how we can do this using the intro field for articles, but if you are already using the intro then we might not be able to...

I already have a working list of the articles in the category with the user rating. Episode number is automatically put in, as long as it counts normally you shouldn't see no problem. So what I was thinking is to put the SAG rating, and the air date for the episode into the intro box when you create the article. I can then grab that info and have it automatically put in your list.

So far, seems a bit easier than I thought.

shawnlg

I am not using that other field that is a great idea.  Sounds good lets go for it.

Thanks again for the help!

IchBin

#27
Ok, well here's a rough draft. One thing you have to do if you want your SAG and Air date to be in the list is to add it for each episodes article in this format. Put it in the intro box for the article and don't put anything else in the intro box.
Quote10-23-07|80
Notice the separation with the pipe character. The date will be separated from your SAG rating, which in this case would be 80. :) So put what ever you need for a SAG rating, put it after the pipe.

Change $category to which ever category of articles you need to call for episodes. All your articles/episodes must be in a category for this to work. You can also change the counter for the show number ($episode_num).

If you put this code into an article all you have to do is make small adjustments to make it different for any other shows you choose to do this with. Now, I'll cross my fingers and hope it works for you. :D

global $db_prefix, $scripturl;

// Change the category number to your category ID
$category = 1;

// Change this number to indicate which number the episode count starts
$episode_num = 100;

$query = db_query(
    "SELECT id, subject, intro, rating
     FROM {$db_prefix}tp_articles
     WHERE category = $category
     AND off = 0
     AND approved = 1
     ORDER BY id", __FILE__, __LINE__);
echo '<div style="overflow: auto; width: 100%;">';

echo '<table cellspacing="0" cellpadding="5px" border="1">
<tr>
<th width="14%">Show Number</th>
<th width="45%">Episode </th>
<th width="17%">Air date</th>
<th width="12%"><a href="' .$scripturl. '?page=7">SAG Rating</a></th>
<th width="12%"><a href="' .$scripturl. '?page=8">User Rating</a></th>
</tr>';
while ($row = mysql_fetch_assoc($query)){
$rate = array();
$rate = explode(",", $row['rating']);
$rating_votes = count($rate);

if($row['rating'] == '')
$rating_votes = 0;

$total = 0;
foreach($rate as $mm => $mval)
$total = $total+$mval;

if($rating_votes > 0 && $total > 0)
$rating_average = floor($total/$rating_votes);
else
$rating_average=0;

$sag = array();
if (!empty($row['intro'])){
$sag = explode("|", $row['intro']);
}
else{
$air_date = '';
$sag_rating = '';
}

foreach ($sag as $key => $value){
$air_date = $sag[0];
$sag_rating = $sag[1];
}
  echo '<tr>
  <td width="14%">',$episode_num, '</td>
  <td width="14%"><a href="' . $scripturl . '?page=' . $row['id'] . '">' . $row['subject'] . '</a></td>
  <td width="14%">',$air_date, '</td>
  <td width="14%">',$sag_rating, '</td>
  <td width="14%">',$rating_average, '</td>
  </tr>';
  $episode_num++;
}
echo '</table>';
echo '</div>';



shawnlg

This is too much for my brain tonight.  I will take a look in the morning..  Thanks for your help!

shawnlg

Nice job.  I really like how you laid it out..  I don't think I gave you enough information though..  The episode numbers aren't mine but the numbers the shows give out.. 

Because of this the episode number, in the way it was written wont work for a couple different reasons..  One you would need a way to move up or down the articles in order to make the article numbers match the right show.  Second I can almost guarantee that there is going to be some weird show out there that they make their episode numbers go by the thousands or something..  The idea was awesome though and it should work for some other purpose..

Working off your idea to fill the opther unused box here is what I came up with.  Re arrange the order so that you would have the beginning of the table in one box and the end of the table in the other.  In the latter portion of the table put in those formulas that will have to be put in manually like the episode numbers, the sag ratings and the airdate.  The tables cells do not necessarily need to be put in the order that they were placed.

You can see the working model here..
http://www.scifiandgod.com/content/index.php?cat=6

Thanks again for your hard work this is turning out awesome.

Shawn Larson

This website is proudly hosted on Crocweb Cloud Website Hosting.