Jump to content

Apply Css to PHP


renegade44

Recommended Posts

I am trying to apply css to individual section of the below code. It is basically recent posts that show up on the front page to my site. I want each recent post to consist of 3 lines, the thread topic bold, the poster name in italic and a color and then on the 3rd line, the date and time of the post in italic. Can anyone help me out?

 

 

//Edit these parameters:

        //MySQL server adress
        $host="p50mysql271.secureserver.net";

        //Username
        $user="";

        //Password
        $pass="";

        //Database
        $db="";

        //Table prefix
        $table="phpbb_";

        //Show last x topics
        $laforums="5";
     


    $link=mysql_connect($host, $user, $pass);
    $db=mysql_select_db($db);
    $query="select * from $table".topics."  WHERE topic_approved = '1' order by topic_last_post_time desc limit 0,$laforums";
    $query2="select config_name,config_value from $table".config." where config_name = 'server_name' limit 0,1";
   $result2=mysql_query($query2);
    $row2 = mysql_fetch_array($result2);
    extract($row2);
    $result=mysql_query($query);
    while ($row=mysql_fetch_array($result)) {
    extract($row);
    $date = date("F j, Y, g:i a", $topic_last_post_time );
   $query3="select forum_name from $table".forums." WHERE forum_id = ".$forum_id."";
   $result3=mysql_query($query3);
   $row2 = mysql_fetch_array($result3);
  echo "<a href='http://".$config_value."/forums/viewforum.php?f=".$forum_id."' target='_blank'>".$row2[forum_name].":</a> <a href='http://".$config_value."/forums/viewtopic.php?f=".$forum_id."&t=".$topic_id."' target='_self'>".$topic_title."</a>,Last Post By: ".$topic_last_poster_name.",Posted On: ".$date."<br><br>\n";
    }

    //-------------------------- END
    ?>

Link to comment
https://forums.phpfreaks.com/topic/163305-apply-css-to-php/
Share on other sites

Well... this is the current line for displaying the results:

echo "<a href='http://".$config_value."/forums/viewforum.php?f=".$forum_id."' target='_blank'>".$row2[forum_name].":</a> <a href='http://".$config_value."/forums/viewtopic.php?f=".$forum_id."&t=".$topic_id."' target='_self'>".$topic_title."</a>,Last Post By: ".$topic_last_poster_name.",Posted On: ".$date."<br><br>\n";

 

What do you have so far?

 

edit: and does your query(ies) return the data you want?  Looking at it, I don't know that it does?

Link to comment
https://forums.phpfreaks.com/topic/163305-apply-css-to-php/#findComment-862428
Share on other sites

Well, from what I can tell, you just need to use these values from your existing script, and apply the CSS as wanted.

echo "<a href='http://".$config_value."/forums/viewforum.php?f=".$forum_id."' target='_blank'>".$row2[forum_name].":</a><br>By: ".$topic_last_poster_name."<br>".$date."<br><br>\n";

Link to comment
https://forums.phpfreaks.com/topic/163305-apply-css-to-php/#findComment-863874
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.