News: September 21st, 2019, The Tinyportal team is pleased to announce the release of ~~ TinyPortal 1.6.4! GET IT NOW!!!

Login  |  Register
HTML5 Icon HTML5 Icon
TP on Social Media
Welcome, Guest. Please login or register.
Did you miss your activation email?

October 14, 2019, 10:20:42 AM

Login with username, password and session length

Recent

Members
  • Total Members: 3756
  • Latest: Ocean
Stats
  • Total Posts: 189081
  • Total Topics: 20763
  • Online Today: 70
  • Online Ever: 629
  • (November 08, 2018, 01:36:54 PM)
Users Online
Users: 0
Guests: 37
Total: 37

Author Topic: Where do I find this in the code and how can insert it in...  (Read 16287 times)

0 Members and 1 Guest are viewing this topic.

shawnlg

  • Guest
Where do I find this in the code and how can insert it in...
« on: October 16, 2007, 03:40:16 PM »
 *********  28 Views | 0 Comments | Rating: 7 (2 rates) ********

Where can I find this code and how can I add it somewhere else on my page?  Any suggestions?   The answer to the two questions I currently have on the forums will allow the completion of my site.  Unfortunately I am under a deadline on this to get it setup.  Any help would be appreciated. Thanks for your help!

To show you exactly what I want to do look at this page.  I want to put the accumulative rating, in the example above "7" in the user rating box on this page..

http://www.scifiandgod.com/content/index.php?page=9

Thanks for your help!
« Last Edit: October 17, 2007, 03:20:41 PM by shawnlg »

Offline IchBin™

  • Developer
  • *
  • Posts: 16228
    • My Website
Re: Where do I find this in the code and how can insert it in...
« Reply #1 on: October 18, 2007, 09:56:06 AM »
The code you're looking for is in the TPortal.template.php file. Search for this code // ..and for views and ratings , even comments? and you'll find the code below it that creates that line of text.

I think you're looking for the php variable $story['rating_votes'] for your box.

You'll should be able to add that to your article.

shawnlg

  • Guest
Re: Where do I find this in the code and how can insert it in...
« Reply #2 on: October 18, 2007, 10:36:55 AM »
I will give those a try thank you so much for your help!  You have really been a lot of help!

shawnlg

  • Guest
Re: Where do I find this in the code and how can insert it in...
« Reply #3 on: October 18, 2007, 03:45:05 PM »
Please check out this page...  I put your code in betwen two echo lines of code that were closed...  Is this supposed to go into strait html or am I doing something wrong...

http://www.scifiandgod.com/content/index.php?page=9

Offline IchBin™

  • Developer
  • *
  • Posts: 16228
    • My Website
Re: Where do I find this in the code and how can insert it in...
« Reply #4 on: October 18, 2007, 05:01:26 PM »
If you want to call a variable to dynamically fill your box you're article with have to be PHP. Then you put your html into PHP and call the variable. If you don't know how to do PHP, I would suggest reading up on the echo statment at www.php.net. I also have a small tutorial on my www.ichbin.us

shawnlg

  • Guest
Re: Where do I find this in the code and how can insert it in...
« Reply #5 on: October 18, 2007, 05:06:33 PM »
Ok this is how I did it.  I know that the echo command just prints the html command or any text.  I tried to imbed it inbeteen the two commands.  Any suggestions?  I am still learning PHP..

 echo "Name of Show
\n";
echo "Star Trek Next Generation: Encounter At Farpoint
\n";
echo "
\n";
echo "Written By
\n";
echo "D.C. Fontana and Gene Roddenberry
\n";
echo "
\n";
echo "Directed By
\n";
echo "Corey Allen
\n";
echo "
\n";
echo "<table width=\"95%\" border=\"1\" align=\"center\" cellpadding=\"5\" cellspacing=\"0\" bordercolor=\"#666666\">\n";
echo "  <tr bgcolor=\"#333333\"> \n";
echo "    <td width=\"22%\">Show Number</td>\n";
echo "    <td width=\"33%\">Episode
 </td>\n";
echo "    <td width=\"32%\">Air date</td>\n";
echo "    <td width=\"13%\"><a href=\"http://www.scifiandgod.com/content/index.php?page=7\">SAG \n";
echo "      Rating[/url]</td>\n";
echo "    <td width=\"13%\"><a href=\"http://www.scifiandgod.com/content/index.php?page=8\">User \n";
echo "      Rating[/url]</td>\n";
echo "  </tr>\n";
echo "  <tr> \n";
echo "    <td>#101</td>\n";
echo "    <td>Encounter At Farpoint</td>\n";
echo "    <td>09/28/87
</td>\n";
echo "    <td>N/A</td>\n";
echo "    <td>$story['rating_votes'];
echo "   </td>\n";
echo "  </tr>\n";
echo "</table>\n";
echo "
\n";
echo "Synopsis
\n";
echo "N/A
\n";
echo "
\n";
echo "Critique
\n";
echo "N/A
\n";
echo "
\n";
echo "Key Themes
\n";
echo "N/A
\n";
echo "
\n";
echo "Challenging Topics
\n";
echo "N/A
\n";
echo "
\n";
echo "Intersecting Ideas & Opposing World Views
\n";
echo "N/A
\n";
echo "
\n";
echo "Topical Questions
\n";
echo "N/A\n";

Offline IchBin™

  • Developer
  • *
  • Posts: 16228
    • My Website
Re: Where do I find this in the code and how can insert it in...
« Reply #6 on: October 18, 2007, 07:49:17 PM »
For more consistent code format with SMF this is how I would do it.

Code: [Select]
echo 'Name of Show <br />
Star Trek Next Generation: Encounter At Farpoint<br /><br />
Written By<br />
D.C. Fontana and Gene Roddenberry<br /><br />
Directed By<br />
Corey Allen<br /><br />
<table width="95%" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="#666666">
  <tr bgcolor="#333333">
    <td width="22%">Show Number</td>
    <td width="33%">Episode
    </td>
    <td width="32%">Air date</td>
    <td width="13%"><a href="http://www.scifiandgod.com/content/index.php?page=7">SAG
      Rating</a></td>
    <td width="13%"><a href="http://www.scifiandgod.com/content/index.php?page=8">User
      Rating</a></td>
  </tr>
  <tr>
    <td>#101</td>
    <td>Encounter At Farpoint</td>
    <td>09/28/87</td>
    <td>N/A</td>
    <td>',$story['rating_votes'],'
   </td>
  </tr>
</table>
<br />
Synopsis
<br />
N/A
<br />
echo "Critique
<br />
N/A
<br />
Key Themes
<br />
<br />
Challenging Topics
<br />
N/A
<br />
Intersecting Ideas & Opposing World Views
<br />
N/A
<br />
<br />
Topical Questions
<br />
N/A';

You may need less or more of the break tags so you can change what you need. An echo for each line is really overkill as you can tell. :) See if this works for you.

shawnlg

  • Guest
Re: Where do I find this in the code and how can insert it in...
« Reply #7 on: October 18, 2007, 09:30:00 PM »
Worked great..  The only thing I changed was was rating_votes to rating_average.  It helped me to look at your example; I now think I have an idea of how to do something like this in the future.  Thanks so much for the help!  Solved..
« Last Edit: October 19, 2007, 12:22:33 AM by shawnlg »

shawnlg

  • Guest
Re: Where do I find this in the code and how can insert it in...
« Reply #8 on: October 20, 2007, 09:58:00 PM »
I was wondering if there was a way of taking that rating average for a specific article referenced from another page.

Here is what I am doing.  I am creating an index page for all the episodes for a season.  I would like to be able to reference the article rating average next to the episode.  Please let me know if this makes sense.

Shawn Larson

Offline IchBin™

  • Developer
  • *
  • Posts: 16228
    • My Website
Re: Where do I find this in the code and how can insert it in...
« Reply #9 on: October 20, 2007, 10:07:09 PM »
If what I'm thinking is what you are asking, it would require you to make a SQL call to get that information.