vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   vBulletin CMS Widgets - Upcoming Events (https://vborg.vbsupport.ru/showthread.php?t=231365)

Eq4bits 04-24-2012 08:14 PM

1 Attachment(s)
This is the code with the hz line, items you will need to change: which calendar, how many events, and location of the hz line image; the date format used is: m/d/Y if you'd rather dashes just change the '/'s to '-'s; if you'd rather d/m/Y then switch it to that display instead in both locations.
PHP Code:

ob_start(); 
global 
$db,$vbulletin;


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

$query sprintf("    SELECT * FROM ".TABLE_PREFIX."event 
                    WHERE visible = 1 
                    AND calendarid='"
.$calendarid."' 
                                        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('m/d/Y',$event['dateline_from'],false,true,false,true)); 
     } else { 
         
$format sprintf("From %s to %s",vbdate('m/d/Y',$event['dateline_from'],false,true,false,true),vbdate('m.d',$event['dateline_to'],false,true,false,true)); 
     } 
      
     
$output_bits .= sprintf(
        <div class = "cms_widget_post_bit"><img src="images/****/hz-line.png"><br><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(); 

Attached is a hz line image you can feel free to use:

level8 04-25-2012 09:01 AM

Quote:

Originally Posted by Eq4bits (Post 2323179)
This is the code with the hz line, items you will need to change: which calendar, how many events, and location of the hz line image; the date format used is: m/d/Y if you'd rather dashes just change the '/'s to '-'s; if you'd rather d/m/Y then switch it to that display instead in both locations.
Attached is a hz line image you can feel free to use:

thanks for this will get it changed ASAP... wonder if you coudl help with 2 other things, tried to do it myself but just crashes :(


1. How do I add a link/button at the bottom of the widget called somethign like "Add an Event" which simply will link to the http://****.com/calender.php?

2. Add a small icon image next to all events (https://vborg.vbsupport.ru/images/cs.../forum_new.gif ).

Any help is much appreciated :)

ProFifaLeagues 04-25-2012 09:12 AM

Quote:

Originally Posted by level8 (Post 2323309)
thanks for this will get it changed ASAP... wonder if you coudl help with 2 other things, tried to do it myself but just crashes :(


1. How do I add a link/button at the bottom of the widget called somethign like "Add an Event" which simply will link to the http://****.com/calender.php?

2. Add a small icon image next to all events (https://vborg.vbsupport.ru/images/cs.../forum_new.gif ).

Any help is much appreciated :)


Superb Idea that and one i would love to know how to implement too:up:

Eq4bits 04-27-2012 03:13 AM

1 Attachment(s)
here is code for adding a small icon in front of each event listed:

to have it as a clickable link to the listed event use
PHP Code:

ob_start();
global 
$db,$vbulletin;

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

$query sprintf("    SELECT * FROM ".TABLE_PREFIX."event
                    WHERE visible = 1
                    AND calendarid='"
.$calendarid."'
                                        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('m/d/Y',$event['dateline_from'],false,true,false,true));
     } else {
         
$format sprintf("From %s to %s",vbdate('m/d/Y',$event['dateline_from'],false,true,false,true),vbdate('m/d/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"><img src="images/*****/light-color-calendar.gif"
style="border: 0px solid; border: 0px solid; width: 16px; height: 16px;">%s</a></h4>
            <p class="cms_widget_post_content">%s</p><img src="images/*****/hz-line.png" align="top">
         </div>
        '
,$event['eventid'],$event['title'],$format);

}

$output $output_bits;

ob_end_clean(); 

you'll need to put your calendar id # in and the # of events to show, as well as the addy/location of where you have the hz-line.png and the light-color-calendar.gif located in your files. I've attached the hz-line.png and the light-color-calendar.gif (Thanks for the gif level8 ;))


I'm still trying to get a clickable 'button'/image for the bottom for 'add new event' but, so far I've only been able to add that to each and every event listed (which seems a bit redundant to me); I'll continue to play with the code when I can to see if I can get it to display a single 'button'/image after the list of events. No promises ;)

Tri@de 04-27-2012 05:43 AM

There's a way to put an external link (got inside the event) instead of a link to the calendar event?

level8 04-27-2012 06:31 AM

BIG THANKS TO Eq4bits amazing work :)

Tr@de.. I know you can add custom fields to the event and Ive seen people import this on the events list (i.e. webpage link) for external events.. however finding anyone to help with the code has been difficult :(

Eq4bits 04-28-2012 01:09 PM

1 Attachment(s)
This is if you want an external link added (as well as a new calendar icon that is not a link itself... perhaps a bit more 'pleasing to the eye' to some (I also edited out the 'On' preceeding the date because it bugged me ;))

http://pendletonharbor.net/images/PH...st-events2.png

PHP Code:

ob_start(); 
global 
$db,$vbulletin;


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

$query sprintf("    SELECT * FROM ".TABLE_PREFIX."event 
                    WHERE visible = 1 
                    AND calendarid='"
.$calendarid."' 
                                        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("%s",vbdate('m/d/Y',$event['dateline_from'],false,true,false,true)); 
     } else { 
         
$format sprintf("From %s to %s",vbdate('m.d',$event['dateline_from'],false,true,false,true),vbdate('m.d',$event['dateline_to'],false,true,false,true)); 
     } 
      
     
$output_bits .= sprintf(
<div class="cms_widget_post_bit">
<h4 class="cms_widget_post_header">
<table>
<tbody>
<tr>
<td><img src="images/*****/cal.png" align:"center"=""
v-align:"middle"="">&nbsp;&nbsp;</td>
<td><a href="calendar.php?do=getinfo&amp;e=%d">%s</a><br>
<small><small><a href="http://*********">External Link</a></small></small>
<p class="cms_widget_post_content">%s</p>
</td>
</tr>
<tr align="center">
<td colspan="2" style="vertical-align: top;">
<h4 class="cms_widget_post_header"><img alt="line"
src="images/*****/hz-line.png" align="middle"></h4>
</td>
</tr>
</tbody>
</table>
</h4>
</div>
'
,$event['eventid'],$event['title'],$format); }

$output $output_bits

ob_end_clean(); 

Also attaching new calendar image and a 'shorter' hz-line image as the previous one was too wide to display correctly in the widget when on certain size sidebars/columns ;)

mrt12345 04-28-2012 01:28 PM

Thanks , but can you tell me the image path where to upload the new icons. Thanks:up:

mrt12345 04-28-2012 01:37 PM

ok thanks i figured it out, nice job, just fill in all the ********:o

level8 04-29-2012 07:26 AM

if anyone can help all we are working on now is getting the "external link" to be a custom field path... so you will keep the word "External link" however this will link to whatever the web path has been listed in the custom field.... any help appreciated :)


All times are GMT. The time now is 09:12 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01311 seconds
  • Memory Usage 1,809KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete