Announcement

Collapse
No announcement yet.

PHP and Static HTML

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

  • PHP and Static HTML

    Amongst the modules you can use in Site Builder are PHP and Static HTML.

    Looking through the documentation, I find a few examples for PHP, like getting it to say "Hello World". Well. I'd like something more useful. Can someone point me to some pre-canned PHP code to use for someone who's not an expert?

    Likewise, Static HTML. The manual has the same example here, "Hello World". Again, practical tips for cool stuff to put here?

  • #2
    If I were you I would probably start with something like https://www.w3schools.com

    You can learn almost anything there.

    Comment


    • #3
      All of vBulletin is PHP and HTML. You would have to be more specific on what you're really trying to do with these modules. You can do advertising, pull information out of a database, build a shopping cart, video game arcades... All is possible depending on how much work you want to dedicate to whatever you want to do.
      Translations provided by Google.

      Wayne Luke
      The Rabid Badger - a vBulletin Cloud demonstration site.
      vBulletin 5 API - Full / Mobile
      Vote for your favorite feature requests and the bugs you want to see fixed.

      Comment


      • #4
        I'd like something easy but I have no clue how to use php other then quick edits. Something useful would be a module with total attachments and total downloads. There was a widget for this on vb4 but again I have no idea how to convert it.

        Code:
        global $vbulletin, $db;
        
        $astats = $vbulletin->db->query_first("
        SELECT COUNT(*) AS count, SUM(filesize) AS totalsize, SUM(counter) AS downloads
        FROM " . TABLE_PREFIX . "attachment AS a
        INNER JOIN " . TABLE_PREFIX . "filedata AS fd ON (a.filedataid = fd.filedataid);
        ");
        
        
        $fstats =$vbulletin->db->query_first("
        SELECT COUNT(*) AS count, SUM(filesize) AS totalsize
        FROM " . TABLE_PREFIX . "filedata AS fd
        ");
        
        if ($astats['count'])
        {
        $astats['average'] = vb_number_format(($astats['totalsize'] / $astats['count']), 1, true);
        }
        else
        {
        $astats['average'] = '0.00';
        }
        
        $stats='
        <table width="100%" align="center">
        <tr>
        <td class="" align="left">
        <div class="smallfont"> <b>Total Attachments: </b> ' . vb_number_format($fstats['count']).'<br />
        
        <b>Total Downloads: </b>'. vb_number_format($astats['downloads']).'
        </div>
        </td>
        </tr>
        </table>';
        //SideBar = End forum Status
        //echo $stats;
        
        return $stats;

        Comment


        • #5
          I have a very old blog on pulling MySQL information out of the database here: https://forum.vbulletin.com/blogs/wa...mysql-database

          I guess it would depend on whether there are queries or API calls that exist now that pull the information you want. I wouldn't consider this example very secure and I haven't really worked with the database assertor. The object was to not require additional files with queries defined. Maybe I'll try to update it one day.
          Translations provided by Google.

          Wayne Luke
          The Rabid Badger - a vBulletin Cloud demonstration site.
          vBulletin 5 API - Full / Mobile
          Vote for your favorite feature requests and the bugs you want to see fixed.

          Comment


          • #6
            Thank you for the responses. I actually haven't got a clue what I want other than that it should be cool, so I guess it's not too good a start.🧐

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...
            X