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
-
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.Helpful? Donate. Thanks!
Fast VPS Host for vBulletin:
A2 Hosting & IONOS
- Top
- Translate
- Bottom
Comment
-
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?
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();
Helpful? Donate. Thanks!
Fast VPS Host for vBulletin:
A2 Hosting & 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.Helpful? Donate. Thanks!
Fast VPS Host for vBulletin:
A2 Hosting & 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?Helpful? Donate. Thanks!
Fast VPS Host for vBulletin:
A2 Hosting & 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.Helpful? Donate. Thanks!
Fast VPS Host for vBulletin:
A2 Hosting & IONOS
- Top
- Translate
- Bottom
Comment
-
I would need access to the forum to see what's going on.Helpful? Donate. Thanks!
Fast VPS Host for vBulletin:
A2 Hosting & IONOS
- Top
- Translate
- Bottom
Comment
Users Viewing This Page
Collapse
There is 1 user viewing this forum topic.
- Guest
Latest Posts
Collapse
-
Reply to Archive videos bb codeby BlackhorseFinally I did it, here is the replacement for your review and improvement Glenn, and for any one would need it:
Code:<iframe src="https://archive.org/embed/{param}"
Yesterday, 01:36 AM -
by BlackhorseHello Glenn,
Any help please regarding a working Archive Videos BB codes?
Edited:
I am finding difficulties in implementing...05-16-2024, 08:34 AM -
Get Affordable and Fast VPS for vBulletin -
Reply to Archive videos bb codeby BlackhorseHello Glenn, twiiter and twitch are working like charm, Thank You so much i have psted in their posts.
I am lookng in this post for playing...Yesterday, 12:01 AM
Comment