Welcome to Geeklog Saturday, May 25 2019 @ 10:56 am EDT

Geeklog Forums

Show titles of Drafts Block


Status: offline

limiter

Forum User
Newbie
Registered: 24/05/05
Posts: 1
I am making a DVD/Movie review site (yes yes I know there are too many already, but I don't care) and I made a little block that shows DVD and Movie reviews I am working on (aka listed as draft) but not news drafts.

So the block says "Upcoming Reviews" and lists all the titles of current drafts of reviews. I thought someone else might find this helpful, and it may have been done before- if so sorry 'bout that. I am not the greatest PHP coder, so be kind.

PHP Formatted Code

/**
* Show upcoming reviews PHP Block function
*/

function phpblock_showupcomingreviews() {
        $dbserver = 'yourdatabaseserver';
        $usr = 'yourusername';
        $pass = 'yourpassword';
        $db = 'yourdatabase';
       
        mysql_connect($dbserver,$usr,$pass);
        mysql_select_db($db);
       
        $drafts_query_sql = "SELECT * FROM gl_stories WHERE draft_flag = 1 AND (tid = 'moviereview' OR tid = 'dvdreviews') ORDER BY date"; //you can include more topics by adding 'OR tid ='topicname'
        $drafts_query = mysql_query($drafts_query_sql);
        $drafts_rows = mysql_num_rows($drafts_query);
        if ($drafts_rows != 0) { $retval = $retval . "<ul>"; }
        $d = 0;
        while ($d < $drafts_rows) {
                $drafts_title = mysql_result($drafts_query,$d,'title');
                $retval =  $retval . "<li>" . $drafts_title . "</li>";
                $d++;
        }
        if ($drafts_rows != 0) { $retval = $retval . "</ul>"; }
        return $retval;
}

 

All times are EDT. The time is now 10:56 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content