SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot Conspiracy's Avatar
    Join Date
    May 2002
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Showing a Banner According to users post count

    I'm pretty much a mega beginner when it comes down to php. I run a phpbb board and I'm trying to get some users to view a banner I'm gonna add, but only the users that have more than 100 posts... Now, I tried my best to come up with something, but it doesn't seem to work... Can anyone help me out? I have no idea hwta I could be doing wrong... and I must point out I'm a real beginner.... here's the code I added:

    <!-- BEGIN switch_user_logged_in -->
    <table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
    <tr><td>
    <?php
    $user_posts = @mysql_query('SELECT user_posts FROM phpbb_users');
    $user_posts = $_REQUEST['user_posts'];
    if ($user_posts >= '100') {
    echo '<div class=""><img src="..templates/supernatural/images/comp200709.gif" width="561" height="100" border="0" alt=""></div>';
    }
    ?>
    </td></tr></table>
    <!-- END switch_user_logged_in -->

  2. #2
    SitePoint Evangelist hexburner's Avatar
    Join Date
    Jan 2007
    Location
    Belgium
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you got off from the wrong foot, and I know you should read some PHP and MySQL tutorials before trying to do things you don't know how to.

    You should remove the PHP-part from your tpl-file, because that won't work properly. Put a tpl-field, named Advertisement in your template like this:
    Code HTML4Strict:
     <!-- BEGIN switch_user_logged_in -->
    <table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
        <tr><td>{ADVERTISEMENT}</td></tr>
    </table>
    <!-- END switch_user_logged_in -->

    Then you'll have to add some PHP-code to various files, after where $userdata is set:
    PHP Code:
    $advertisement $userdata['posts']>100 '<div class=""><img src="..templates/supernatural/images/comp200709.gif" width="561" height="100" border="0" alt=""></div>' '';

    $template->assign_vars(
        array( 
    'ADVERTISEMENT' => $advertisement)
    ); 
    FOR SALE: 1 set of morals, never used, will sell cheap

  3. #3
    SitePoint Zealot Conspiracy's Avatar
    Join Date
    May 2002
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey, hexburner!!! Thank you so much, I'll make it work somehow!!!


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
  •