Assigning styles to .php pages??

  • Ortin
  • Graduate
  • Graduate
  • User avatar
  • Posts: 121

Post 3+ Months Ago

Hello again new problem here.
I have this code
Code: [ Select ]
<?php

## Mod Title: Topic Extraction
## Version: 1.5.0

#############
## Edit Below
#############
// Where to take the topics from
// Always a number
$forum = '15';

// How many topics to show
$limit = '20';

// How to show the topics
// full or blank ('')
$show = 'full';

// How to display the date and time if used
// short or long
$date_time = 'short';

// How top display the topic link if usede
// topic or phpbb
$topic_link = 'topic';

// Comments link - how to send them to comments
// topic or reply
$comment = 'topic';

// Path to your forums directory
// Usually ./forum/ or ./phpBB/ or ./forums/
$phpbb_root_path = './phpbb2/';

#############################################
## No Editing unless you know what your doing
#############################################
if ( !defined('IN_PHPBB') )
{
 define('IN_PHPBB', true);
 include($phpbb_root_path . 'extension.inc');
 include($phpbb_root_path . 'common.'.$phpEx);
 include($phpbb_root_path . 'config.'.$phpEx);
}

if ($show == '' || $show == 'full')
{
    // Select the topic information from the correct forum and set it to $grab_topics
    $grab_topics = $db->sql_query("SELECT * FROM `{$table_prefix}topics` WHERE `forum_id` = '{$forum}' ORDER BY `topic_id` DESC LIMIT {$limit}");
}

else if ($show == 'topic')
{
    $grab_topics = $db->sql_query("SELECT * FROM `{$table_prefix}topics` WHERE `forum_id` = '{$forum}' AND `topic_id` = '{$_GET['t']}' ORDER BY `topic_id` DESC");
}
    
// Grab the information using an array and set it to $echo_topic
while ($echo_topic = $db->sql_fetchrow($grab_topics))
{
    // Select the post information from the correct forum and set it to $grab_posts
    $grab_posts = $db->sql_query("SELECT * FROM `{$table_prefix}posts` WHERE `forum_id` = '{$forum}' AND `topic_id` = '{$echo_topic['topic_id']}' LIMIT 1");
    
    // Grab the information using an array and set it to $echo_post
    while ($echo_post = $db->sql_fetchrow($grab_posts))
    {
        // Now get the post_text using the post_id were looking at and sort it info $grab_posts_text
        $grab_posts_text = $db->sql_query("SELECT * FROM `{$table_prefix}posts_text` WHERE `post_id` = '{$echo_post['post_id']}'");
        
        // Grab the information using an array and set it to $echo_text
        while($echo_text = $db->sql_fetchrow($grab_posts_text))
        {
            // Find the user the posted
            $find_user = $db->sql_query("SELECT * FROM `{$table_prefix}users` WHERE `user_id` = '{$echo_post['poster_id']}'");
            
            // Sort this users info into array for the post
            while ($echo_user = $db->sql_fetchrow($find_user))
            {
                    
                // Get rid of all those annoying characters from bbcode
                $echo_text = preg_replace('/\:[0-9a-z\:]+\]/si', ']', $echo_text);    
                
                // BBCode
                $echo_text = str_replace("[b]","<strong>",$echo_text);
                $echo_text = str_replace("[/b]","</strong>",$echo_text);
                    
                $echo_text = str_replace("[i]","<em>",$echo_text);
                $echo_text = str_replace("[/i]","</em>",$echo_text);
                    
                $echo_text = str_replace("[u]","<u>",$echo_text);
                $echo_text = str_replace("[/u]","</u>",$echo_text);
                    
                $echo_text = preg_replace('/\[quote=(.*)\](.*)\[\/quote\]/Usi','<div style=\"padding: 7px\">$2</div>',$echo_text);
                
                $echo_text = str_replace("[quote]","<strong>Quote</strong><em>",$echo_text);
                $echo_text = str_replace("[/quote]","</em>",$echo_text);
                    
                $echo_text = str_replace("[code]","<strong>Code</strong><em>",$echo_text);
                $echo_text = str_replace("[/code]","</em>",$echo_text);
                    
                $echo_text = preg_replace('/\[list\](.*)\[\/list\]/si',"<div style=\"padding: 7px\">$1</div>",$echo_text);
                $echo_text = preg_replace('/\[list=(.*)\](.*)\[\/list\]/si',"<div style=\"padding: 7px\">$1</div>",$echo_text);
                    
                $echo_text = str_replace("[img]","<img src=\"",$echo_text);
                $echo_text = str_replace("[/img]","\" alt=\"image\" />",$echo_text);
                    
                $echo_text = preg_replace('/\[url\](.*)\[\/url\]/Usi','<a href="$1">$1</a>',$echo_text);
                $echo_text = preg_replace('/\[url=(.*)\](.*)\[\/url\]/Usi','<a href="$1">$2</a>',$echo_text);
                    
                $echo_text = str_replace("\n", "\n<br />\n", $echo_text);
                    
                // Way to display date and time
                // long
                if($date_time == "long")
                {
                    $echo_topic['topic_time'] = strftime("%A %e %B %H:%M",$echo_topic['topic_time']);
                }
                    
                // short
                if ($date_time == "short")
                {
                    $echo_topic['topic_time'] = strftime("%a %e %b %H:%M",$echo_topic['topic_time']);
                }
                    
                // Way to display comment link
                // Go right to the topic
                if ($comment == 'topic')
                {
                    $comment_link = "{$phpbb_root_path}viewtopic.php?t={$echo_topic['topic_id']}";
                }
                
                // Go right to the reply box
                if ($comment == 'reply')
                {
                    $comment_link = "{$phpbb_root_path}posting.php?mode=reply&t={$echo_topic['topic_id']}";
                }
                
                // Topic link types
                // This link goes to the topic display
                if ($topic_link == 'topic')
                {
                    $topic_link = "?show1=topic&t={$echo_topic['topic_id']}";
                }
                
                // This link goes to the actual phpbb topic
                if ($topic_link == 'phpbb')
                {
                    $topic_link = "{$phpbb_root_path}viewtopic.php?t={$echo_topic['topic_id']}";
                }
                
                ##################################
                ## Edit for look and feel of topic
                ##################################
                // Display just the title
                
                if ($show != 'full' && !isset($_GET['show1']))
                {
                    echo "<a href='{$topic_link}'>{$echo_text['post_subject']}</a><br />";
                }
                
                // Display many topics - for news, shoutbox etc
                else if ($show == 'full')
                {
                    echo "
                    <strong>{$echo_text['post_subject']}</strong> by <strong>{$echo_user['username']}</strong> at <strong>{$echo_topic['topic_time']}</strong>
                    <br />
                    <br />
                    {$echo_text['post_text']}
                    <br />
                    <br />
                    <a href=\"{$comment_link}\">Comments {$echo_topic['topic_replies']}</a>
                    <hr size=\"1\">
                    ";
                }
                
                // Display the topic for when used with the one above, click link and go here
                if ($_GET['show1'] == 'topic')
                {
                    echo "
                    <strong>{$echo_text['post_subject']}</strong> by <strong>{$echo_user['username']}</strong> at <strong>{$echo_topic['topic_time']}</strong>
                    <br />
                    <br />
                    {$echo_text['post_text']}
                    <br />
                    <br />
                    <a href=\"{$comment_link}\">Comments {$echo_topic['topic_replies']}</a>
                    <hr size=\"1\">
                    ";
                }
            }
        }
    }    
}
?>
  1. <?php
  2. ## Mod Title: Topic Extraction
  3. ## Version: 1.5.0
  4. #############
  5. ## Edit Below
  6. #############
  7. // Where to take the topics from
  8. // Always a number
  9. $forum = '15';
  10. // How many topics to show
  11. $limit = '20';
  12. // How to show the topics
  13. // full or blank ('')
  14. $show = 'full';
  15. // How to display the date and time if used
  16. // short or long
  17. $date_time = 'short';
  18. // How top display the topic link if usede
  19. // topic or phpbb
  20. $topic_link = 'topic';
  21. // Comments link - how to send them to comments
  22. // topic or reply
  23. $comment = 'topic';
  24. // Path to your forums directory
  25. // Usually ./forum/ or ./phpBB/ or ./forums/
  26. $phpbb_root_path = './phpbb2/';
  27. #############################################
  28. ## No Editing unless you know what your doing
  29. #############################################
  30. if ( !defined('IN_PHPBB') )
  31. {
  32.  define('IN_PHPBB', true);
  33.  include($phpbb_root_path . 'extension.inc');
  34.  include($phpbb_root_path . 'common.'.$phpEx);
  35.  include($phpbb_root_path . 'config.'.$phpEx);
  36. }
  37. if ($show == '' || $show == 'full')
  38. {
  39.     // Select the topic information from the correct forum and set it to $grab_topics
  40.     $grab_topics = $db->sql_query("SELECT * FROM `{$table_prefix}topics` WHERE `forum_id` = '{$forum}' ORDER BY `topic_id` DESC LIMIT {$limit}");
  41. }
  42. else if ($show == 'topic')
  43. {
  44.     $grab_topics = $db->sql_query("SELECT * FROM `{$table_prefix}topics` WHERE `forum_id` = '{$forum}' AND `topic_id` = '{$_GET['t']}' ORDER BY `topic_id` DESC");
  45. }
  46.     
  47. // Grab the information using an array and set it to $echo_topic
  48. while ($echo_topic = $db->sql_fetchrow($grab_topics))
  49. {
  50.     // Select the post information from the correct forum and set it to $grab_posts
  51.     $grab_posts = $db->sql_query("SELECT * FROM `{$table_prefix}posts` WHERE `forum_id` = '{$forum}' AND `topic_id` = '{$echo_topic['topic_id']}' LIMIT 1");
  52.     
  53.     // Grab the information using an array and set it to $echo_post
  54.     while ($echo_post = $db->sql_fetchrow($grab_posts))
  55.     {
  56.         // Now get the post_text using the post_id were looking at and sort it info $grab_posts_text
  57.         $grab_posts_text = $db->sql_query("SELECT * FROM `{$table_prefix}posts_text` WHERE `post_id` = '{$echo_post['post_id']}'");
  58.         
  59.         // Grab the information using an array and set it to $echo_text
  60.         while($echo_text = $db->sql_fetchrow($grab_posts_text))
  61.         {
  62.             // Find the user the posted
  63.             $find_user = $db->sql_query("SELECT * FROM `{$table_prefix}users` WHERE `user_id` = '{$echo_post['poster_id']}'");
  64.             
  65.             // Sort this users info into array for the post
  66.             while ($echo_user = $db->sql_fetchrow($find_user))
  67.             {
  68.                     
  69.                 // Get rid of all those annoying characters from bbcode
  70.                 $echo_text = preg_replace('/\:[0-9a-z\:]+\]/si', ']', $echo_text);    
  71.                 
  72.                 // BBCode
  73.                 $echo_text = str_replace("[b]","<strong>",$echo_text);
  74.                 $echo_text = str_replace("[/b]","</strong>",$echo_text);
  75.                     
  76.                 $echo_text = str_replace("[i]","<em>",$echo_text);
  77.                 $echo_text = str_replace("[/i]","</em>",$echo_text);
  78.                     
  79.                 $echo_text = str_replace("[u]","<u>",$echo_text);
  80.                 $echo_text = str_replace("[/u]","</u>",$echo_text);
  81.                     
  82.                 $echo_text = preg_replace('/\[quote=(.*)\](.*)\[\/quote\]/Usi','<div style=\"padding: 7px\">$2</div>',$echo_text);
  83.                 
  84.                 $echo_text = str_replace("[quote]","<strong>Quote</strong><em>",$echo_text);
  85.                 $echo_text = str_replace("[/quote]","</em>",$echo_text);
  86.                     
  87.                 $echo_text = str_replace("[code]","<strong>Code</strong><em>",$echo_text);
  88.                 $echo_text = str_replace("[/code]","</em>",$echo_text);
  89.                     
  90.                 $echo_text = preg_replace('/\[list\](.*)\[\/list\]/si',"<div style=\"padding: 7px\">$1</div>",$echo_text);
  91.                 $echo_text = preg_replace('/\[list=(.*)\](.*)\[\/list\]/si',"<div style=\"padding: 7px\">$1</div>",$echo_text);
  92.                     
  93.                 $echo_text = str_replace("[img]","<img src=\"",$echo_text);
  94.                 $echo_text = str_replace("[/img]","\" alt=\"image\" />",$echo_text);
  95.                     
  96.                 $echo_text = preg_replace('/\[url\](.*)\[\/url\]/Usi','<a href="$1">$1</a>',$echo_text);
  97.                 $echo_text = preg_replace('/\[url=(.*)\](.*)\[\/url\]/Usi','<a href="$1">$2</a>',$echo_text);
  98.                     
  99.                 $echo_text = str_replace("\n", "\n<br />\n", $echo_text);
  100.                     
  101.                 // Way to display date and time
  102.                 // long
  103.                 if($date_time == "long")
  104.                 {
  105.                     $echo_topic['topic_time'] = strftime("%A %e %B %H:%M",$echo_topic['topic_time']);
  106.                 }
  107.                     
  108.                 // short
  109.                 if ($date_time == "short")
  110.                 {
  111.                     $echo_topic['topic_time'] = strftime("%a %e %b %H:%M",$echo_topic['topic_time']);
  112.                 }
  113.                     
  114.                 // Way to display comment link
  115.                 // Go right to the topic
  116.                 if ($comment == 'topic')
  117.                 {
  118.                     $comment_link = "{$phpbb_root_path}viewtopic.php?t={$echo_topic['topic_id']}";
  119.                 }
  120.                 
  121.                 // Go right to the reply box
  122.                 if ($comment == 'reply')
  123.                 {
  124.                     $comment_link = "{$phpbb_root_path}posting.php?mode=reply&t={$echo_topic['topic_id']}";
  125.                 }
  126.                 
  127.                 // Topic link types
  128.                 // This link goes to the topic display
  129.                 if ($topic_link == 'topic')
  130.                 {
  131.                     $topic_link = "?show1=topic&t={$echo_topic['topic_id']}";
  132.                 }
  133.                 
  134.                 // This link goes to the actual phpbb topic
  135.                 if ($topic_link == 'phpbb')
  136.                 {
  137.                     $topic_link = "{$phpbb_root_path}viewtopic.php?t={$echo_topic['topic_id']}";
  138.                 }
  139.                 
  140.                 ##################################
  141.                 ## Edit for look and feel of topic
  142.                 ##################################
  143.                 // Display just the title
  144.                 
  145.                 if ($show != 'full' && !isset($_GET['show1']))
  146.                 {
  147.                     echo "<a href='{$topic_link}'>{$echo_text['post_subject']}</a><br />";
  148.                 }
  149.                 
  150.                 // Display many topics - for news, shoutbox etc
  151.                 else if ($show == 'full')
  152.                 {
  153.                     echo "
  154.                     <strong>{$echo_text['post_subject']}</strong> by <strong>{$echo_user['username']}</strong> at <strong>{$echo_topic['topic_time']}</strong>
  155.                     <br />
  156.                     <br />
  157.                     {$echo_text['post_text']}
  158.                     <br />
  159.                     <br />
  160.                     <a href=\"{$comment_link}\">Comments {$echo_topic['topic_replies']}</a>
  161.                     <hr size=\"1\">
  162.                     ";
  163.                 }
  164.                 
  165.                 // Display the topic for when used with the one above, click link and go here
  166.                 if ($_GET['show1'] == 'topic')
  167.                 {
  168.                     echo "
  169.                     <strong>{$echo_text['post_subject']}</strong> by <strong>{$echo_user['username']}</strong> at <strong>{$echo_topic['topic_time']}</strong>
  170.                     <br />
  171.                     <br />
  172.                     {$echo_text['post_text']}
  173.                     <br />
  174.                     <br />
  175.                     <a href=\"{$comment_link}\">Comments {$echo_topic['topic_replies']}</a>
  176.                     <hr size=\"1\">
  177.                     ";
  178.                 }
  179.             }
  180.         }
  181.     }    
  182. }
  183. ?>


At the minute it comes up with a white background and black text.
Can someone please inform me to where/how i can change these styles?

I have tried wrapping it with printed html but it doesn't wrk...
Any help would be appreciated.

Many Thanks,
John[/code]
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Posts: 4581
  • Loc: Maryland

Post 3+ Months Ago

What happened whn you wrapped it in HTML? There are not html, head, title, body tags, so that is why you are getting the default colors...
  • Ortin
  • Graduate
  • Graduate
  • User avatar
  • Posts: 121

Post 3+ Months Ago

I wrapped in html tags and it only applied to just outside the body of the php-written text. The text stayed black and the background white.
So if i wrote:
Code: [ Select ]
print("<html>");
print("<head>");
print("<title>News Page</title>>");
print("</head>");
print("<body text=\"#FFFFFF\" bgcolor=\"#FF0000\">");
**PHP**
print(**end tags**)
  1. print("<html>");
  2. print("<head>");
  3. print("<title>News Page</title>>");
  4. print("</head>");
  5. print("<body text=\"#FFFFFF\" bgcolor=\"#FF0000\">");
  6. **PHP**
  7. print(**end tags**)


That would change it? Also do i put the html outside the <?php and ?> or inside it?

Many Thanks,
John

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 89 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.