No announcement yet.

Polls and Messages as part of other web pages

  • Filter
  • Time
  • Show
Clear All
new posts

  • Polls and Messages as part of other web pages

    I've seen other sites do this, but...

    how easy would it be for me to, for example, take a particular poll from one of my forums, and post the results, in the same style as vBulletin, to one of my own pages, in a little box?

    likewise to post things like newest threads etc...

  • #2
    I've tossed together a few php functions for things somewhat like this, one to show the last X threads as a news type of deal like newspro (and one to import newspro into the database), one to find the last X active topics and display a link, etc.

    here is a link to a few of my php scripts (Newspro import, vbulletin for news, and a comments script I tossed together)

    and I'll just toss the functions to display the last X active topics in this thread:

    PHP Code:
    // Top 5 active topics
    function top5topics() {
    mysql_connect($servername,$dbusername,$dbpassword) or die("Unable to connect to
    mysql_select_db("$dbname") or die("Unable to access the News");
    $sqlquery "SELECT * FROM thread WHERE visible !=0 ORDER by lastpost DESC LIMIT 5";
    $result mysql_query($sqlquery);
    $number mysql_num_rows($result);
    $thehtml "<table width=292 border=1 cellspacing=0 cellpadding=1 bordercolor=#114477 align=center height=100><tr><td height=20 background=images/top5_titlebar.gif>&nbsp;&nbsp;Top 5 topics today:</td></tr><tr><td align=left valign=top>";
    $i 0;
        if (
    $number 1) { $thehtml .= "There are no active topics at this time."; }
        else { while (
    $number $i) {
    $titlelong mysql_result($result,$i,"title");
    $title shorten($titlelong,45);
    $theid mysql_result($result,$i,"threadid");
    $numcheck mysql_result($result,$i,"replycount");
    $numie = ($numcheck+1);
    $thehtml .= "<a href=$theid>$title</a> ($numie)<br>";
    $i++; }}
    $thehtml .= "</td></tr></table>";


    [ DirgoTronix.Net ] [ DirgoTronix.Net Forums ]
    Just a local Lakewood, CO community of high schoolers, college kids, and random passers-by.


    • #3
      Cool , thanks!

      Anyone any ideas about the Poll thing? That was the main thing I wanted... just something to grab the results of a poll from a particular thread (i'd specify this manually) and display it graphically...

      Alternatively, maybe someone could point me at a really good PHP coding tutorial on the net and/or a good book on the subject? I'm not 100% sure what PHP is used for yet, my knowledge so far is that it's used for server-side HTML generation, and it can also access SQL databases? I might be completely wrong there of course...

      Learning PHP is on my "to-do" list for the next months... just seem not to have any spare time lately!


      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.