Announcement

Collapse
No announcement yet.

use php in my forum

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • use php in my forum

    Hello,

    I am new to php, so you will have to talk in lamens-terms. On my site i am running a query on my database. (not my forum database). That randomly selects 5 random objects and displays them on my site. It works fine on my site but i am not sure how to make this work with vbulletin.

    here is the code.

    PHP Code:
    <table width="100%" cellpadding="0" cellspacing="0">
              <tr> 
                <?php
    $result 
    mysql_query"SELECT * FROM `df_tutorials` ORDER BY RAND() LIMIT 5" ) or die( mysql_error() );
    while ( 
    $r mysql_fetch_assoc($result) )
    {
    ?>
                <td width="20%" align="center"> <a href="http://www.designarena.org/tutorial-<?= $r["tID"?>.htm" target="_blank"><img src="/dyn/img/tutorial-<?= $r["tID"?>.jpg" border="0" width="40" height="40" alt="<?= htmlentities$r["title"] ) ?>" /></a></td>
                <?php
    }
    $result mysql_query"SELECT * FROM `df_tutorials`" );
    ?>
            </table>
    If anyone can help me out with this it would be great.

    Thanks,
    Jon

  • #2
    Here's some documentation...I'll be back a bit later to convert it to you...my breakfast is burning.. -_-"

    http://www.vbulletin.com/docs/html/m...e_conditionals
    http://www.vbulletin.com/docs/html/m...n_conditionals
    ManagerJosh, Owner of 4 XenForo Licenses, 1 vBulletin Legacy License, 1 Internet Brands Suite License
    Director, WorldSims.org | Gaming Hosting Administrator, SimGames.net, Urban Online Entertainment

    Comment


    • #3
      Thanks for the reply Josh. I will start reading now...

      Comment


      • #4
        hmmm, i can't seem to work it out.

        Comment


        • #5
          You can't use php in the templates...

          Comment


          • #6
            As Zach said you can't use php code or scripts in just any template. You can only do this in the phpinclude templates. Here are the instructions on using phpinclude:

            http://www.vbulletin.com/docs/html/m...tes_phpinclude

            And here is a tutorial at vbulletin.org for using phpinclude:

            http://www.vbulletin.org/forum/showthread.php?t=71313
            Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
            Change CKEditor Colors to Match Style (for 4.1.4 and above)

            Steve Machol Photography


            Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


            Comment


            • #7
              ok.. well i have managed to do it.

              http://www.designarena.org/forum/ - check the 5 images at the top of the site.

              Comment

              Loading...
              Working...
              X