Announcement

Collapse
No announcement yet.

This day in History??

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

    This day in History??

    im adding a bunch of tour dates to my calendar and like them to be displayed in a sidebar block.
    Not upcoming dates, put just the day like this day in history?

    #2
    im adding a bunch of tour dates to my calendar and like them to be displayed in a sidebar block.
    Not upcoming dates, put just the day like this day in history?


    ob_start();
    global $db,$vbulletin;

    function get_string_between($string, $start, $end){
    $chunk = explode($start, $string, 2);
    if(count($chunk)==1) return "1";
    $chunk = explode($end, $chunk[1], 2);
    if(count($chunk)==1) return "";
    return $chunk[0];
    }

    $mydate = mktime(0, 0, 0, date("m"), date("d")-1, date("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'] == 0 )
    {
    $format = sprintf("On %s",vbdate('D M jS Y',$event['dateline_from'],false,true,false,true));
    } else {
    $format = sprintf("%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));
    }


    $gfx = get_string_between($event['event'], "[IMG]", "[/IMG]");

    if($gfx == "1"){
    $output_bits .= sprintf('<div class = "cms_widget_post_bit"><a href="calendar.php?do=getinfo&e=%d">
    <h4 class="cms_widget_post_header"><b>%s</b></a></h4>
    <p class="cms_widget_post_content"><b>%s</b></p>
    <BR/>
    <center><img src="http://metallifukinca.com/forum/images/misc/hz-line.png" alt="Upcoming Event" ;"></center>
    </div>
    <BR/>',$event['eventid'],$event['title'],$format);
    }
    else
    {
    $output_bits .= sprintf('<div class = "cms_widget_post_bit"><a href="calendar.php?do=getinfo&e=%d">
    <img src="%s" width="25" height="25" alt="Upcoming Event" HSPACE="7" VSPACE="3" align="left"/>
    <h4 class="cms_widget_post_header"><b>%s</b></a></h4>
    <p class="cms_widget_post_content"><b>%s</b></p>
    <BR/>
    <center><img src="http://metallifukinca.com/forum/images/misc/hz-line.png" alt="Upcoming Event" ;"></center>
    </div>
    <BR/>',$event['eventid'],$gfx,$event['title'],$format);
    }
    }
    $output = $output_bits;

    ob_end_clean();
    is there a way for this code to only pull for upcoming this days in history?​

    Comment


      #3
      anyway to get this to show IE: april 15, 2023, april 15, 2022, april 15, 2021 on so on?

      Comment


        #4
        Bumper

        Comment


          #5
          Try using this SQL query:

          PHP Code:
          $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");​ 
          The above query checks if the event From or To date's month and day are the same as the current month and day.
          Helpful? Donate. Thanks!
          Buy me a coffeePayPal QR Code
          Fast VPS Host for vBulletin:
          A2 Hosting & IONOS

          Comment


            #6
            thanks, but I got server error 500.
            I had to turn block off, to correct it


            syntax error, unexpected '&', expecting end of file on line 25 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


              #7
              Did the error not come up before this change? Just trying to see if the error is caused by this change or not to localize where the error is coming from.
              Helpful? Donate. Thanks!
              Buy me a coffeePayPal QR Code
              Fast VPS Host for vBulletin:
              A2 Hosting & IONOS

              Comment


                #8
                pretty sure im adding it to right place

                syntax error, unexpected '&', expecting end of file on line 25 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/includes/class_bootstrap.php(564) : eval()'d code(212): vB_BlockManager->getSidebarHTML()
                #4 /home/james/public_html/forum/includes/class_bootstrap.php(564): eval()
                #5 /home/james/public_html/forum/includes/class_core.php(4391): vB_Bootstrap->process_templates()
                #6 /home/james/public_html/forum/includes/class_core.php(4349): vB_Template->__construct('vsa_onlinecount...')
                #7 /home/james/public_html/forum/global.php(29) : eval()'d code(66): vB_Template::create('vsa_onlinecount...')
                #8 /home/james/public_html/forum/global.php(29): eval()
                #9 /home/james/public_html/forum/calendar.php(122): require_once('/home/james/pub...')
                #10 {main}​

                Comment


                  #9
                  this is what i added

                  ob_start();
                  global $db,$vbulletin;

                  function get_string_between($string, $start, $end){
                  $chunk = explode($start, $string, 2);
                  if(count($chunk)==1) return "1";
                  $chunk = explode($end, $chunk[1], 2);
                  if(count($chunk)==1) return "";
                  return $chunk[0];
                  }

                  $mydate = mktime(0, 0, 0, date("m"), date("d")-1, date("Y"));
                  $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("%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));
                  }


                  $gfx = get_string_between($event['event'], "[IMG]", "[/IMG]");

                  if($gfx == "1"){
                  $output_bits .= sprintf('<div class = "cms_widget_post_bit"><a href="calendar.php?do=getinfo&e=%d">
                  <h4 class="cms_widget_post_header"><b>%s</b></a></h4>
                  <p class="cms_widget_post_content"><b>%s</b></p>
                  <BR/>
                  <center><img src="http://metallifukinca.com/forum/images/misc/hz-line.png" alt="Upcoming Event" ;"></center>
                  </div>
                  <BR/>',$event['eventid'],$event['title'],$format);
                  }
                  else
                  {
                  $output_bits .= sprintf('<div class = "cms_widget_post_bit"><a href="calendar.php?do=getinfo&e=%d">
                  <img src="%s" width="25" height="25" alt="Upcoming Event" HSPACE="7" VSPACE="3" align="left"/>
                  <h4 class="cms_widget_post_header"><b>%s</b></a></h4>
                  <p class="cms_widget_post_content"><b>%s</b></p>
                  <BR/>
                  <center><img src="http://metallifukinca.com/forum/images/misc/hz-line.png" alt="Upcoming Event" ;"></center>
                  </div>
                  <BR/>',$event['eventid'],$gfx,$event['title'],$format);
                  }
                  }
                  $output = $output_bits;

                  ob_end_clean();​

                  Comment


                    #10
                    Originally posted by glennrocksvb View Post
                    Did the error not come up before this change? Just trying to see if the error is caused by this change or not to localize where the error is coming from.
                    after I added code

                    Comment


                      #11
                      What code editor are you using? There seems to be invisible characters found in the added code. When I copied your code and pasted and saved it in Visual Studio Code editor, I see this:

                      ​​Click image for larger version

Name:	image.png
Views:	43
Size:	153.0 KB
ID:	26602

                      When I removed those invisible characters, the syntax error in line 28 went away.​
                      Helpful? Donate. Thanks!
                      Buy me a coffeePayPal QR Code
                      Fast VPS Host for vBulletin:
                      A2 Hosting & IONOS

                      Comment


                        #12
                        Btw, you can use the [PHP] or [CODE] BBCode tags instead of [QUOTE] when posting code to preserve the indentation and make the code readable.
                        Helpful? Donate. Thanks!
                        Buy me a coffeePayPal QR Code
                        Fast VPS Host for vBulletin:
                        A2 Hosting & IONOS

                        Comment


                          #13
                          Originally posted by glennrocksvb View Post
                          What code editor are you using? There seems to be invisible characters found in the added code. When I copied your code and pasted and saved it in Visual Studio Code editor, I see this:

                          ​​Click image for larger version

Name:	image.png
Views:	43
Size:	153.0 KB
ID:	26602

                          When I removed those invisible characters, the syntax error in line 28 went away.​
                          i just open it up on notepad lol
                          ill download your editor and see if that works

                          Comment


                            #14
                            i used the editor and got this error

                            This page isn’t working


                            metallifukinca.com is currently unable to handle this request.

                            HTTP ERROR 500​
                            and this is the code i imputted

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

                            function 
                            get_string_between($string$start$end){
                                
                            $chunk explode($start$string2);
                                if(
                            count($chunk)==1) return "1";
                                
                            $chunk explode($end$chunk[1], 2);
                                if(
                            count($chunk)==1) return "";
                                return 
                            $chunk[0];
                            }

                            $mydate =  mktime(000date("m"), date("d")-1date("Y"));
                            $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'] == )
                                 {
                                     
                            $format sprintf("On %s",vbdate('D M jS Y',$event['dateline_from'],false,true,false,true));
                                 } else {
                                     
                            $format sprintf("%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));
                                 }


                            $gfx get_string_between($event['event'], "[IMG]""[/IMG]");

                            if(
                            $gfx == "1"){
                            $output_bits .= sprintf('<div class = "cms_widget_post_bit"><a href="calendar.php?do=getinfo&e=%d">
                            <h4 class="cms_widget_post_header"><b>%s</b></a></h4>
                            <p class="cms_widget_post_content"><b>%s</b></p>
                            <BR/>
                            <center><img src="http://test.com/images/misc/hz-line.png" alt="Upcoming Event" ;"></center>
                            </div>
                            <BR/>'
                            ,$event['eventid'],$event['title'],$format);
                            }
                            else
                            {
                            $output_bits .= sprintf('<div class = "cms_widget_post_bit"><a href="calendar.php?do=getinfo&e=%d">
                            <img src="%s" width="25" height="25" alt="Upcoming Event" HSPACE="7" VSPACE="3" align="left"/>
                            <h4 class="cms_widget_post_header"><b>%s</b></a></h4>
                            <p class="cms_widget_post_content"><b>%s</b></p>
                            <BR/>
                            <center><img src="http://test.com/images/misc/hz-line.png" alt="Upcoming Event" ;"></center>
                            </div>
                            <BR/>'
                            ,$event['eventid'],$gfx,$event['title'],$format);
                            }
                            }
                            $output $output_bits;

                            ob_end_clean();​ 

                            Comment


                              #15
                              What's the detailed error stack trace in the server error logs?
                              Helpful? Donate. Thanks!
                              Buy me a coffeePayPal QR Code
                              Fast VPS Host for vBulletin:
                              A2 Hosting & IONOS

                              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 "|||"