Goto Admincp->vBullietin CMS->Widgets->Create New Widget
Choose PHP Direct Execution as Widget's Type
Place a Title. eg Upcoming Events. Keep it short as this is what will appear as title on your pages.
Click Save
Click Configure on the right of the new created widget.
Remove the default code that appears. Be sure to not leave behind even a single letter.
Copy and Paste the code that you can find below.
Leave the template name as is (vbcms_widget_execphp_page)
Click Save
Goto Admincp->vBullietin CMS->Layout Manager
Click Go on the Default Layout
Add the Widget to your Layout
Click Save
That's all !!
PHP Code
PHP Code:
ob_start();
// %d
$show_count = 5;
$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);
I modified the code to take the link on the event description (in this way you have only to write the link in the description), and also modified the code to select a different calendar. if you want it, just let me know.
I modified the code to take the link on the event description (in this way you have only to write the link in the description), and also modified the code to select a different calendar. if you want it, just let me know.
Be great if we can have it please Tri@de thank you :up:
ob_start();
// %d
$show_count = 5;
$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE calendarid = 5 AND visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$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("Il %s",date('d-m-Y',$event['dateline_from']));
} else {
$format = sprintf("Dal %s al %s",date('d-m-Y',$event['dateline_from']),date('d-m-Y',$event['dateline_to']));
}
$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><h4 class="cms_widget_post_header"><a href="%s" target="_blank">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['event'],$event['title'],$format);
}
$output = $output_bits;
ob_end_clean();
The red number id the calendar id you have to modify as you wish.
As i said before, in the description put only the link (including http:// ) or the link doesen't work properly.
in the link, you find http://firstlink-secondlink i suppose.
i made it to get only a link.
The best for this widget is to make a customfield and using it for urls.
yeah thats what I have done.. just importing the info from the custom field (the website address) and replacing it in the href="%s" target="_blank is proving tricky!!
yeah thats what I have done.. just importing the info from the custom field (the website address) and replacing it in the href="%s" target="_blank is proving tricky!!
you made with custom field?
can you give me the code?