Announcement

Collapse
No announcement yet.

This day in History??

Collapse
X
Collapse
First Prev Next Last
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #46
    Follow the instructions mentioned in post #38. Then instead of using the PHP code posted there, use the code posted in post #40. I corrected the code I posted in post #38 with the code in post #40.
    Helpful? Donate. Thanks!
    Buy me a coffeePayPal QR Code
    Fast VPS Host for vBulletin:
    A2 Hosting & IONOS

    Comment


      #47
      Originally posted by glennrocksvb View Post
      Follow the instructions mentioned in post #38. Then instead of using the PHP code posted there, use the code posted in post #40. I corrected the code I posted in post #38 with the code in post #40.
      ok dude Im completely lost now lmao...
      I attaching to unedited code, can you put your code into it??

      PHP Code:
      ob_start();
      global 
      $db,$vbulletin;


      $mydate =  mktime(000date("m"), date("d")-1date("Y"));
      $show_count =10;

      $query sprintf("    SELECT * FROM ".TABLE_PREFIX."event
                          WHERE visible = 1
                          AND (dateline_from >= '
      $mydate' || (dateline_from >= '$mydate' AND dateline_to <= '$mydate' ) || ('$mydate' BETWEEN dateline_from AND dateline_to))
                          ORDER BY dateline_from ASC LIMIT 
      $show_count");

      $event_get vB::$db->query_read($query);

      $output_bits '';
      while(
      $event vB::$db->fetch_array($event_get)) {

           if(
      $event['dateline_to'] == )
           {
               
      $format sprintf("On %s",vbdate('D M jS Y',$event['dateline_from'],false,true,false,true));
           } else {
               
      $format sprintf("From %s to %s",vbdate('D M jS Y',$event['dateline_from'],false,true,false,true),vbdate('jS M Y',$event['dateline_to'],false,true,false,true));
           }

           
      $output_bits .= sprintf('
              <div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
                  <p class="cms_widget_post_content">%s</p>
               </div>
              '
      ,$event['eventid'],$event['title'],$format);

      }
      $output $output_bits;

      ob_end_clean();​ 

      Comment


        #48
        Are you sure this is the working code? It doesn't have the updated SQL query that I suggested? It has the original query which retrieves events since yesterday. I thought you wanted to show events with the same date as the current date but for different years?
        Last edited by glennrocksvb; 05-02-2023, 02:19 PM.
        Helpful? Donate. Thanks!
        Buy me a coffeePayPal QR Code
        Fast VPS Host for vBulletin:
        A2 Hosting & IONOS

        Comment


          #49
          Originally posted by glennrocksvb View Post
          Are you sure this is the working code? It doesn't have the updated SQL query that I suggested? It has the original query which retrieves events since yesterday. I thought you wanted to show events with the same date as the current date but for different years?
          Yes it works and it's the unedited version without your changes. I'm not.100% where to add your code 😵‍💫

          Comment


            #50
            I suggested 2 code changes. The first one was for the SQL query and the other one for the HTML output.

            I thought my suggested SQL query change worked when you said this?
            Originally posted by oldfan View Post
            work dude!!
            the format sucks lol, is that easy to chnage??Click image for larger version  Name:	dates.png Views:	6 Size:	76.3 KB ID:	26631
            That was after you applied my SQL query change.

            ​Here's the update code with both my suggested code changes:

            Code:
            <?php
            
            ob_start();
            global $db, $vbulletin;
            $show_count = 10;
            $query = sprintf("SELECT * FROM " . TABLE_PREFIX . "event
                WHERE visible = 1
                AND (
                   (MONTH(FROM_UNIXTIME(dateline_from)) = MONTH(NOW()) AND DAY(FROM_UNIXTIME(dateline_from)) = DAY(NOW()))
                   OR
                   (MONTH(FROM_UNIXTIME(dateline_to)) = MONTH(NOW()) AND DAY(FROM_UNIXTIME(dateline_to)) = DAY(NOW()))
                )
                ORDER BY dateline_from ASC LIMIT $show_count");
            $event_get = vB::$db->query_read($query);
            $output_bits = "";
            while ($event = vB::$db->fetch_array($event_get)) {
                if ($event["dateline_to"] == 0) {
                    $format = sprintf(
                        "On %s",
                        vbdate(
                            "D M jS Y",
                            $event["dateline_from"],
                            false,
                            true,
                            false,
                            true
                        )
                    );
                } else {
                    $format = sprintf(
                        "From %s to %s",
                        vbdate(
                            "D M jS Y",
                            $event["dateline_from"],
                            false,
                            true,
                            false,
                            true
                        ),
                        vbdate("jS M Y", $event["dateline_to"], false, true, false, true)
                    );
                }
                $output_bits .= sprintf("
                    <li class='noavatarcontent floatcontainer widget_post_bit'>
                        <div class='widget_post_userinfo'></div>
                        <div class='smallavatartext widget_post_comment_noavatar'>
                            <h5 class='widget_post_header'>
                                <a href='calendar.php?do=getinfo&e=%d' class='title'>%s</a>
                            </h5>
                            <div class='meta'>%s</div>
                        </div>
                    </li>",
                    $event["eventid"],
                    $event["title"],
                    $format
                );
            }
            $output = $output_bits;
            ob_end_clean();
            Helpful? Donate. Thanks!
            Buy me a coffeePayPal QR Code
            Fast VPS Host for vBulletin:
            A2 Hosting & IONOS

            Comment


              #51
              I'll try it in a few days.im at my daughter's in st Louis

              Comment


                #52
                no go dude got this error..

                PHP Code:
                syntax errorunexpected '<'expecting end of file on line 1 in /home/james/public_html/forum/includes/block/html.php(95) : eval()'d code
                #0 /home/james/public_html/forum/includes/class_block.php(130): vB_BlockType_Html->getData()
                #1 /home/james/public_html/forum/includes/class_block.php(1088): vB_Block->getBlockHTML()
                #2 /home/james/public_html/forum/includes/class_block.php(1101): vB_BlockManager->getBlockHTML(4, Array)
                #3 /home/james/public_html/forum/forum.php(649): vB_BlockManager->getSidebarHTML()
                #4 {main}​ 

                Comment


                  #53
                  Make sure you don't have duplicate <?php

                  I added it in the code I posted and you might have it duplicated.

                  If you use code editor like Visual Studio Code and similar tools, it will detect syntax errors like that even without running the code. Line with syntax error will have squiggly lines like it does for typos in MS Word.
                  Helpful? Donate. Thanks!
                  Buy me a coffeePayPal QR Code
                  Fast VPS Host for vBulletin:
                  A2 Hosting & IONOS

                  Comment


                    #54
                    used code visual and got this error

                    PHP Code:
                    syntax errorunexpected '<'expecting end of file on line 1 in /home/james/public_html/forum/includes/block/html.php(95) : eval()'d code
                    #0 /home/james/public_html/forum/includes/class_block.php(130): vB_BlockType_Html->getData()
                    #1 /home/james/public_html/forum/includes/class_block.php(1088): vB_Block->getBlockHTML()
                    #2 /home/james/public_html/forum/includes/class_block.php(1101): vB_BlockManager->getBlockHTML(4, Array)
                    #3 /home/james/public_html/forum/forum.php(649): vB_BlockManager->getSidebarHTML()
                    #4 {main}​ 

                    Comment


                      #55
                      Do you see which line in the code has squiggly underline in the Visual Studio Code editor?
                      Helpful? Donate. Thanks!
                      Buy me a coffeePayPal QR Code
                      Fast VPS Host for vBulletin:
                      A2 Hosting & IONOS

                      Comment


                        #56
                        not sure, see attached..

                        Click image for larger version

Name:	line.png
Views:	28
Size:	280.1 KB
ID:	26688
                        Attached Files

                        Comment


                          #57
                          Try removing the <?php in the first line of the code. I think vB4 already has its own and doesn't need another one.
                          Helpful? Donate. Thanks!
                          Buy me a coffeePayPal QR Code
                          Fast VPS Host for vBulletin:
                          A2 Hosting & IONOS

                          Comment


                            #58
                            No errors with the removal of that code you suggested, but I got this format error and it wiped out my other block.
                            Click image for larger version

Name:	lastest.png
Views:	18
Size:	58.7 KB
ID:	26695

                            Comment


                              #59
                              I would need access to the forum to see what's going on.
                              Helpful? Donate. Thanks!
                              Buy me a coffeePayPal QR Code
                              Fast VPS Host for vBulletin:
                              A2 Hosting & IONOS

                              Comment


                                #60
                                Originally posted by glennrocksvb View Post
                                I would need access to the forum to see what's going on.
                                check your PMS

                                Comment

                                Users Viewing This Page

                                Collapse

                                There is 1 user viewing this forum topic.

                                • Guest Guest

                                Latest Posts

                                Collapse

                                Working...
                                X
                                Searching...Please wait.
                                An unexpected error was returned: 'Your submission could not be processed because you have logged in since the previous page was loaded.

                                Please push the back button and reload the previous window.'
                                An unexpected error was returned: 'Your submission could not be processed because the token has expired.

                                Please push the back button and reload the previous window.'
                                An internal error has occurred and the module cannot be displayed.
                                There are no results that meet this criteria.
                                Search Result for "|||"