Announcement

Collapse
No announcement yet.

Random Article Widget

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

  • #16
    ...
    Last edited by kontagio.us; Wed 21st Dec '11, 11:10pm. Reason: unlinked
    vBulletin Rules!

    Comment


    • #17
      Hey this script stopped working properly. The cache only reloads the page as often as I set it in the article properties. So I made it the video of the day. Could you help me update it back to a different video on every load please.
      vBulletin Rules!

      Comment


      • #18
        It looks like something reverted or broke in v413. That's just a quick guess but in v412 it seems to update every page reload and in v413 it caches. I would suggest you petition to reopen http://tracker.vbulletin.com/browse/VBIV-8082.

        By the way... I see you are using three previews. I rewrote the code and I think the code below will be a bit more efficient than creating three widgets. You can change "maxcount" if you want more or fewer records, up to ten maximum with this code.



        Ed



        PHP Code:

        $query 
        vB::$db->query_read("SELECT nodeid, publishdate, setpublish, userid,
        parentnode, permissionsfrom, hidden, contenttypeid FROM " 
        TABLE_PREFIX .  "cms_node
        WHERE setpublish > 0 AND publishdate < " 
        TIMENOW ." AND contenttypeid <>  " .
        vB_Types::instance()->getContentTypeID("vBCms_Section") ." AND hidden = 0 ORDER BY rand() LIMIT 10");
        // We need to verify that this is published and is not a section.
        $output '';
        $count 0;
        $maxcount 3;
        if (
        $query)
        {
            while(
        $record =  vB::$db->fetch_array($query))
            {
          
        vBCMS_Permissions::setPermissionsFrom($record['nodeid'], $record['permissionsfrom'], $record['hidden'],
           
        $record['setpublish'], $record['publishdate']);
          if (
        vBCMS_Permissions::canView($record['nodeid']))
          {
           
        $class vB_Types::instance()->getContentTypeClass($record['contenttypeid']);
           
        $package vB_Types::instance()->getContentTypePackage($record['contenttypeid']);
           
        $article vBCms_Content::create($package$class$record['nodeid']);
           
        $output .= $article->getPreview()->render();
           
        $count++;
          }
          if (
        $count >= $maxcount)
          {
           break;
          }
            }

        Please- I'm not tech support. Don't send your problem reports to me unless I've asked you to.

        Comment


        • #19
          Originally posted by Edwin Brown View Post
          It looks like something reverted or broke in v413. That's just a quick guess but in v412 it seems to update every page reload and in v413 it caches. I would suggest you petition to reopen http://tracker.vbulletin.com/browse/VBIV-8082.
          Okay thanks I did. Do you think they will actually fix it?

          Originally posted by Edwin Brown View Post

          By the way... I see you are using three previews. I rewrote the code and I think the code below will be a bit more efficient than creating three widgets. You can change "maxcount" if you want more or fewer records, up to ten maximum with this code.



          Ed



          PHP Code:

          $query 
          vB::$db->query_read("SELECT nodeid, publishdate, setpublish, userid,
          parentnode, permissionsfrom, hidden, contenttypeid FROM " 
          TABLE_PREFIX .  "cms_node
          WHERE setpublish > 0 AND publishdate < " 
          TIMENOW ." AND contenttypeid <>  " .
          vB_Types::instance()->getContentTypeID("vBCms_Section") ." AND hidden = 0 ORDER BY rand() LIMIT 10");
          // We need to verify that this is published and is not a section.
          $output '';
          $count 0;
          $maxcount 3;
          if (
          $query)
          {
              while(
          $record =  vB::$db->fetch_array($query))
              {
            
          vBCMS_Permissions::setPermissionsFrom($record['nodeid'], $record['permissionsfrom'], $record['hidden'],
             
          $record['setpublish'], $record['publishdate']);
            if (
          vBCMS_Permissions::canView($record['nodeid']))
            {
             
          $class vB_Types::instance()->getContentTypeClass($record['contenttypeid']);
             
          $package vB_Types::instance()->getContentTypePackage($record['contenttypeid']);
             
          $article vBCms_Content::create($package$class$record['nodeid']);
             
          $output .= $article->getPreview()->render();
             
          $count++;
            }
            if (
          $count >= $maxcount)
            {
             break;
            }
              }

          I have no idea what you changed. Do I replace the whole article?
          vBulletin Rules!

          Comment

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