SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    Sep 2001
    Location
    London, UK
    Posts
    220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I apply a class to this code?

    Below is a hack that Im using on my site to display the latest discussion topics on every page of my site. Now this page is included via SSI into all my pages.

    Now it is using a seperate style sheet from the rest of the site because Im having problems in trying to apply a class to this page. It is currently using Forum.css. Id like it to use the main style sheet, stablewars.css. Now stablewars.css is a class defined called forum, id like to apply this class to this page. I know I can apply the sheet to this page by simply changing the style sheet link file from forum.css to stablewars.css, but how and where do I apply the class forum? Ive had a go a few times and can't get it to work, get errors. Anyone have ideas?


    PHP Code:
    <font color="#CCCCCC"></font> 
    <?php
    define
    ('IN_PHPBB'true);

    //$css ="http://www.stablewars.com/phpBB2/templates/subSilver/subSilver.css"; //path and name to your css_sheet - optional
    $css ="http://www.stablewars.com/forum.css"//path and name to your css_sheet - optional
    $limit "5"// how many topics?

    $phpbb_root_path "../phpBB2/"//path to below files
    include($phpbb_root_path 'extension.inc');
    include(
    $phpbb_root_path 'common.'.$phpEx);

    echo 
    "<link rel=\"stylesheet\" href=\"$css\" type=\"text/css\">"// - optional

    $recent_sql "SELECT topic_id,topic_title,topic_last_post_id,forum_id FROM " TOPICS_TABLE " WHERE forum_id !='14' and forum_id !='12' ORDER BY topic_last_post_id DESC LIMIT $limit";
    $recent $db->sql_query($recent_sql); 


    echo 
    "<table width=\"90%\" align=\"center\"><tr><td colspan=\"2\" align=\"left\"><span class=\"gen\"></span></td></tr>"

    while (
    $line mysql_fetch_array($recent)) { 
    $security=FALSE
    if(
    $forum_auth == && $userdata['user_level'] == ADMIN) { 
    $security=TRUE

    if(
    $forum_auth == && ($userdata['user_level'] == ADMIN) || ($userdata['user_level'] == 2)) { 
    $security=TRUE

    if(
    $forum_auth == 0) { 
    $security=TRUE

    if(
    $security == TRUE


      
    $lastpost_array=$db->sql_query("SELECT post_time FROM " POSTS_TABLE " WHERE post_id =" $line['topic_last_post_id']); 
      
    $lastpost=mysql_fetch_array($lastpost_array); 
      
    $lastpost=$lastpost['post_time']; 
      
    $lastpost=create_date($board_config['default_dateformat'], $lastpost$board_config['board_timezone']); 

    $j stripslashes($line['topic_title']); 
    $k substr($j025) . "..."

    echo 
    "<tr><td align=\"left\"><span class=\"gensmall\">&raquo;&raquo; </span> <a href=\"$phpbb_root_path/viewtopic.php?t=" $line['topic_id'] . "\" class=\"genmed\">" $k "</a></td></tr>"; }}; 

    echo 
    "</table>"
    ?>
    stablewars.com - WWF Fantasy Wrestling, It ain't no E-fed!

  2. #2
    \m/\m/ karinne's Avatar
    Join Date
    Dec 2002
    Location
    Aylmer, QC, Canada
    Posts
    409
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Where are you trying to apply the class?

  3. #3
    SitePoint Addict
    Join Date
    Sep 2001
    Location
    London, UK
    Posts
    220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To this whole file. You see, this file is included via SSI to another page. So id like the results of this code to be displayed using the class forum, which is defined in the style sheet stablewars.css.

    Currently I am applying forum.css to this page and you can see the results here;

    http://www.stablewars.com/htp/index.shtml

    The problem with this is, that it overrides my defaults and thus makes the links in the main page also grey. I just want the links extracted from the forum to be grey, while the links in the main page to remain purple. Example here

    http://www.stablewars.com/statistics/index.shtml

    I have a class defined in stablewars.css which has teh same text properties as forum.css, need to find a way to apply it to this peice of code.
    Last edited by Crippler; Dec 9, 2002 at 18:00.
    stablewars.com - WWF Fantasy Wrestling, It ain't no E-fed!

  4. #4
    SitePoint Addict
    Join Date
    Sep 2001
    Location
    London, UK
    Posts
    220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone?
    stablewars.com - WWF Fantasy Wrestling, It ain't no E-fed!

  5. #5
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Um, I *think* I follow. Maybe not

    Anyway if the class you want to use is called forum, then change this line:

    PHP Code:
    echo "<tr><td align=\"left\"><span class=\"gensmall\">&raquo;&raquo; </span> <a href=\"$phpbb_root_path/viewtopic.php?t=" $line['topic_id'] . "\" class=\"genmed\">" $k "</a></td></tr>"; }}; 
    to

    PHP Code:
    echo "<tr><td align=\"left\"><span class=\"gensmall\">&raquo;&raquo; </span> <a href=\"$phpbb_root_path/viewtopic.php?t=" $line['topic_id'] . "\" class=\"forum\">" $k "</a></td></tr>"; }}; 
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  6. #6
    SitePoint Addict
    Join Date
    Sep 2001
    Location
    London, UK
    Posts
    220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Boy, was my post THAT bad?

    Thanks anyway, I'll have a go tomorrow morning.
    stablewars.com - WWF Fantasy Wrestling, It ain't no E-fed!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •