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.
Announcement
Collapse
No announcement yet.
This day in History??
Collapse
X
-
ok dude Im completely lost now lmao...Originally posted by glennrocksvb View PostFollow 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.
I attaching to unedited code, can you put your code into it??
PHP Code:ob_start(); global $db,$vbulletin; $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("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();
- Top
- Translate
- Bottom
Comment
-
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.
My Amazon Affiliate Link
Fast vBulletin VPS Host:
This site is hosted by IONOS
- Top
- Translate
- Bottom
Comment
-
Yes it works and it's the unedited version without your changes. I'm not.100% where to add your code Originally posted by glennrocksvb View PostAre 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?
- Top
- Translate
- Bottom
Comment
-
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?
That was after you applied my SQL query change.Originally posted by oldfan View Postwork dude!!
the format sucks lol, is that easy to chnage??
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();
My Amazon Affiliate Link
Fast vBulletin VPS Host:
This site is hosted by IONOS
- Top
- Translate
- Bottom
Comment
-
no go dude got this error..
PHP Code:syntax error, unexpected '<', 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}
- Top
- Translate
- Bottom
Comment
-
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.
My Amazon Affiliate Link
Fast vBulletin VPS Host:
This site is hosted by IONOS
- Top
- Translate
- Bottom
Comment
-
used code visual and got this error
PHP Code:syntax error, unexpected '<', 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}
- Top
- Translate
- Bottom
Comment
-
Do you see which line in the code has squiggly underline in the Visual Studio Code editor?
My Amazon Affiliate Link
Fast vBulletin VPS Host:
This site is hosted by IONOS
- Top
- Translate
- Bottom
Comment
-
Try removing the <?php in the first line of the code. I think vB4 already has its own and doesn't need another one.
My Amazon Affiliate Link
Fast vBulletin VPS Host:
This site is hosted by IONOS
- Top
- Translate
- Bottom
Comment
-
I would need access to the forum to see what's going on.
My Amazon Affiliate Link
Fast vBulletin VPS Host:
This site is hosted by IONOS
- Top
- Translate
- Bottom
Comment
Latest Posts
Collapse
-
Reply to some ideas for new modsin Chit Chatby desmomax
I finally created a mod that allows you to add an icon to each post with options for sharing on other platforms. I honestly thought it was absurd that...
Today, 03:59 AM -
by flohseHi Glenn, what do you think about adding "Like Counts" similar to "Like Counts on Postbit and Profile" (when this mod is in use) in...Yesterday, 11:28 PM
-
Reply to push notification prompt?by desmomaxhy glenn
have you thought about this?Yesterday, 05:44 AM

Comment