vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Calander on non-VB pages (https://vborg.vbsupport.ru/showthread.php?t=64584)

Curll 04-30-2004 08:02 PM

Calander on non-VB pages
 
I'm looking for a hack or a PHP script that can put today's events from the calander on a non-vB page, namely my site's main page. Maybe something cute in a Calander square looking dealy.

Thanks

Pseudomizer 05-01-2004 10:54 PM

Quote:

Originally Posted by Curll
I'm looking for a hack or a PHP script that can put today's events from the calander on a non-vB page, namely my site's main page. Maybe something cute in a Calander square looking dealy.

Thanks

Hi Curl,

please use the following code to get the last 5 events in an array:

PHP Code:

$events $DB_site->query("select * from event order by dateline DESC limit 5");

if (
$DB_site->num_rows($events))
{
        while (
$ev $DB_site->fetch_array($events))
        {

    
$serveroffset date('Z'TIMENOW) / 3600;

    
$fromdate getdate(TIMENOW + (-12 $serveroffset) * 3600);
    
$new_date date('d-m-Y'TIMENOW + (-12 $serveroffset) * 3600 );
 
             echo 
$new_date," ";
//             echo $ev['userid']," ";
//             echo $ev['dateline']," ";
             
echo $ev['title'],"<BR>";
        }


Cheers,

Curll 05-02-2004 02:09 PM

Yay, thanks. That's a good start.

Pseudomizer 05-02-2004 02:52 PM

Quote:

Originally Posted by Curll
Yay, thanks. That's a good start.

Hi Curl,

sorry but i just found one mistake. The dateline will never change in my previous code. Please use the following code:

PHP Code:

$events $DB_site->query("select * from event order by dateline DESC limit 5");

if (
$DB_site->num_rows($events))
{
        while (
$ev $DB_site->fetch_array($events))
        {
             
$new_date vbdate('d.m.Y'$ev['dateline'], falsefalse);
             
$news .= "<B>".$new_date."</B><BR>";
             
$news .= $ev['title']."<BR>";
             
        }



P.Jackson 05-02-2004 03:40 PM

what would be the code to get total threads and how many users online?

Pseudomizer 05-02-2004 04:07 PM

Quote:

Originally Posted by P.Jackson
what would be the code to get total threads and how many users online?

Users online:

PHP Code:

$onlineusers $DB_site->query("
                        ## GET ONLINE USERS ##
                        SELECT user.username, (user.options & 
$_USEROPTIONS[invisible]) AS invisible,
                        user.usergroupid, session.userid, session.lastactivity,
                        IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
                        FROM "
.TABLE_PREFIX."session AS session
                        LEFT JOIN "
.TABLE_PREFIX."user AS user ON (user.userid = session.userid)
                        WHERE session.lastactivity > 
$online[datecut]
                        ORDER BY "
.iif($permissions['genericpermissions'] & CANSEEHIDDEN'invisible ASC, ')."username ASC"); 

Total Threads:

PHP Code:

$totalthreads $DB_site->query("Select count(threadid) from thread where visible = '1' ); 

Cheers,

P.Jackson 05-02-2004 04:29 PM

didnt work :( got parse errors

Pseudomizer 05-02-2004 04:42 PM

Quote:

Originally Posted by P.Jackson
didnt work :( got parse errors

What didn't work ? What kind of errors do you get ? Sorry but without any information i will not be able to help you at all.

Cheers,

Curll 05-02-2004 05:23 PM

Odd, with the new code, no events are showing.

Pseudomizer 05-02-2004 05:26 PM

Quote:

Originally Posted by Curll
Odd, with the new code, no events are showing.

I bet you did not write :tired:

PHP Code:

echo news

Cheers,

Curll 05-02-2004 05:34 PM

echo $news; you mean? :p

Now, anyway I could make those link to the expanded info on the Calander pages? :)

Pseudomizer 05-02-2004 07:23 PM

Quote:

Originally Posted by Curll
echo $news; you mean? :p

Now, anyway I could make those link to the expanded info on the Calander pages? :)

Sure. Link to the calendarid and that's it.

Cheers,

Curll 05-02-2004 07:44 PM

That was a wee bit vague...or very vague.

PHP Code:

echo "<a href=\"calendar.php?$calendarid\">$news</a>"

Obviously isn't going to work.

So, exactly how should I link to the Calendarid?

Pseudomizer 05-02-2004 07:56 PM

Try this one:

PHP Code:

$events $DB_site->query("select * from event order by dateline DESC limit 5"); 

if (
$DB_site->num_rows($events)) 

        while (
$ev $DB_site->fetch_array($events)) 
        { 
             
$news="";
             
$new_date vbdate('Y.m.d'$ev['dateline'], falsefalse); 
             
$news .= "<B>".$new_date."</B><BR>"
             
$news .= $ev['title']."<BR>"

echo 
"<A HREF=\"calendar.php?do=getinfo&e=$ev[eventid]&day=$new_date&c=1\">$news</A>";
              
        } 


Cheers,

Richardg 05-02-2004 08:15 PM

Hey Pseudomizer..maybe you can help me!

I'm trying to add events from an external calendar.

I've inserted rows with the start date in the dateline_from column & the end date in dateline_to column. I've converted my dates & times using the UNIX_TIMSTAMP
I'm not sure what goes in the dateline or UTC columns
I'm running into trouble with timezone offsets (!)...which may be something to do with the dateline & UTC columns...
I am in BST timezone (British Summer Time).
The event I inserted from my external calendar shows up in he vBulletin calendar but it says it was posted for GMT.
What I want to do is to insert events which always show up correctly for my local time (GTM/BST) even if a) the event spans the point at which local time changes from BST to GMT and b) I insert now (BST) an event which will take place when daylight saving ends and we change to GMT.
cheers

Pseudomizer 05-02-2004 08:25 PM

Quote:

Originally Posted by Richardg
Hey Pseudomizer..maybe you can help me!

I'm trying to add events from an external calendar.

I've inserted rows with the start date in the dateline_from column & the end date in dateline_to column. I've converted my dates & times using the UNIX_TIMSTAMP
I'm not sure what goes in the dateline or UTC columns
I'm running into trouble with timezone offsets (!)...which may be something to do with the dateline & UTC columns...
I am in BST timezone (British Summer Time).
The event I inserted from my external calendar shows up in he vBulletin calendar but it says it was posted for GMT.
What I want to do is to insert events which always show up correctly for my local time (GTM/BST) even if a) the event spans the point at which local time changes from BST to GMT and b) I insert now (BST) an event which will take place when daylight saving ends and we change to GMT.
cheers

Hi Richard,

i have never done such a thing before but i can give you some guidance in which direction you should look to find the error. When you post something or you create a thread in all php files they are using the same function. Please have a closer look into this section:

PHP Code:

    $serveroffset date('Z'TIMENOW) / 3600

    
$fromdate getdate(TIMENOW + (-12 $serveroffset) * 3600); 
    
$new_date date('d-m-Y'TIMENOW + (-12 $serveroffset) * 3600 ); 

In addition i would suggest that you look into the calendar_functions.php in your /includes directory.

Hope this helps.

Cheers,

Curll 05-02-2004 09:36 PM

Hmm, I fooled around with it to get it to work, or at least link correctly (for my site and my settings.)

PHP Code:

echo "<hr><b><a href=\"http://www.xblgamers.com/forums/calendar.php?\">Latest Events</a> . . .</b><b><p>";




$events $DB_site->query("select * from event order by dateline DESC limit 5"); 


if (
$DB_site->num_rows($events)) 

        while (
$ev $DB_site->fetch_array($events)) 
        { 
            
            
$new_date vbdate('m.d.Y'$ev['dateline'], falsefalse); 
            
$link_date vbdate('Y-m-d'$ev['dateline'], falsefalse); 
             
$news .= "<b>".$new_date."</b>"."<BR>"
             
$news .= "</b>".$ev['title']."<BR>"
              
        } 


echo 
"<A HREF=\"/forums/calendar.php?do=getinfo$ev[eventid]&day=$link_date&c=1\">$news</A>"
?> 

But, the array, all 5 items, link to one day, the day of the last item. Sooo, how could we put in a check thingy to get a link to each event?

Pseudomizer 05-02-2004 09:43 PM

Quote:

Originally Posted by Curll
Hmm, I fooled around with it to get it to work, or at least link correctly (for my site and my settings.)

PHP Code:

echo "<hr><b><a href=\"http://www.xblgamers.com/forums/calendar.php?\">Latest Events</a> . . .</b><b><p>";




$events $DB_site->query("select * from event order by dateline DESC limit 5"); 


if (
$DB_site->num_rows($events)) 

        while (
$ev $DB_site->fetch_array($events)) 
        { 
            
            
$new_date vbdate('m.d.Y'$ev['dateline'], falsefalse); 
            
$link_date vbdate('Y-m-d'$ev['dateline'], falsefalse); 
             
$news .= "<b>".$new_date."</b>"."<BR>"
             
$news .= "</b>".$ev['title']."<BR>"
              
        } 


echo 
"<A HREF=\"/forums/calendar.php?do=getinfo$ev[eventid]&day=$link_date&c=1\">$news</A>"
?> 

But, the array, all 5 items, link to one day, the day of the last item. Sooo, how could we put in a check thingy to get a link to each event?

This is very easy to answer. If you look at my original post you will see that i did put the echo with the link IN THE if and while loop. You placed it outside. Just have a look at my original code.

Cheers,

Curll 05-02-2004 09:45 PM

Yeah...but....looking is hard :'(

Pseudomizer 05-02-2004 09:48 PM

Quote:

Originally Posted by Curll
Yeah...but....looking is hard :'(

Sorry, i did not get this. Does it work now ? Or is something else wrong now ?

Cheers,

Curll 05-02-2004 09:49 PM

Well, I had to add a $news = " "; before the other two 'cause it kept counting and adding to the $news.

And it works dandy now. Thanks!

Pseudomizer 05-02-2004 10:07 PM

Quote:

Originally Posted by Curll
Well, I had to add a $news = " "; before the other two 'cause it kept counting and adding to the $news.

And it works dandy now. Thanks!

This was also in my script because i knew it would do that. But i am glad that you realized that.

I am happy that i could help you.

Cheers,

Richardg 05-03-2004 12:02 AM

Quote:

Originally Posted by Pseudomizer
Hi Richard,

i have never done such a thing before but i can give you some guidance in which direction you should look to find the error. When you post something or you create a thread in all php files they are using the same function. Please have a closer look into this section:

PHP Code:

    $serveroffset date('Z'TIMENOW) / 3600

    
$fromdate getdate(TIMENOW + (-12 $serveroffset) * 3600); 
    
$new_date date('d-m-Y'TIMENOW + (-12 $serveroffset) * 3600 ); 

In addition i would suggest that you look into the calendar_functions.php in your /includes directory.

Hope this helps.

Cheers,

Thanks - The calndar functions must hold the clue .. that will keep me quiet for a while! (sorry to interrupt the thread)

cheers

ryancooper 06-23-2004 01:06 PM

OK I am a dolt when it comes to this stuff. Can someone post a php file that will show the next 5 events?

Pseudomizer 06-23-2004 01:10 PM

Read post 18 and 21 and you are set.

Cheers,

ryancooper 06-23-2004 01:34 PM

1 Attachment(s)
Quote:

Originally Posted by Pseudomizer
Read post 18 and 21 and you are set.

Cheers,

OK I am trying but this is what i get:
http://talkdisney.com/forums/test.php

here is the file i did.

The Coldwood 08-08-2004 01:29 PM

Pseudomizer, you are the man!

Pseudomizer 08-08-2004 03:05 PM

Quote:

Originally Posted by teamrocketman
Pseudomizer, you are the man!

Where ever i can help.

Cheers,

upnorth 08-30-2004 03:29 PM

any idea on how to get this working on a non-vB page?

Pseudomizer 08-30-2004 03:42 PM

Quote:

Originally Posted by upnorth
any idea on how to get this working on a non-vB page?

Sorry, but why do you ask this question? Did you read the subject of this thread? I would assume no. We are only talking about non-vB pages and how to implement such queries in there.

So please rephrase your question. Thanks.

Cheers,

upnorth 08-30-2004 05:04 PM

Sorry My bad. Got so excited when I read the posts I didn't read the subject close enough. I'll give it a try and see if I can get it to work.

Sorry for that :nervous:

upnorth 08-30-2004 05:23 PM

k hopefully I haven't overlooked anything so please be patient with me as this is all new to me.

I tried your code and it works fine. How hard would it be to only show todays events and the next 3 or 4 days. Make sense?

WildEye 01-15-2005 09:16 PM

Quote:

Originally Posted by Pseudomizer
This is very easy to answer. If you look at my original post you will see that i did put the echo with the link IN THE if and while loop. You placed it outside. Just have a look at my original code.

Cheers,

I've been trying to get this to work now, as posted in #18, but i'm getting an error message:

Fatal error: Call to a member function on a non-object in /home/n4f/html/calendarexport.php on line 3

What am i doing wrong? Not very familiar with what to do... Shouldn't my databasename be somewhere? or... Any help appreciated.

PHP Code:

echo "<hr><b><a href=\"http://www.mysite.com/forum/calendar.php?\">Latest Events</a> . . .</b><b><p>";
$events $DB_site->query("select * from event order by dateline DESC limit 5");
if (
$DB_site->num_rows($events))
{
        while (
$ev $DB_site->fetch_array($events))
        {
            
$new_date vbdate('m.d.Y'$ev['dateline'], falsefalse);
            
$link_date vbdate('Y-m-d'$ev['dateline'], falsefalse);
             
$news .= "<b>".$new_date."</b>"."<BR>";
             
$news .= "</b>".$ev['title']."<BR>";
        }
}
echo 
"<A HREF=\"/forum/calendar.php?do=getinfo$ev[eventid]&day=$link_date&c=1\">$news</A>"


Pseudomizer 01-15-2005 09:41 PM

Quote:

Originally Posted by WildEye
I've been trying to get this to work now, as posted in #18, but i'm getting an error message:

Fatal error: Call to a member function on a non-object in /home/n4f/html/calendarexport.php on line 3

What am i doing wrong? Not very familiar with what to do... Shouldn't my databasename be somewhere? or... Any help appreciated.

PHP Code:

echo "<hr><b><a href=\"http://www.mysite.com/forum/calendar.php?\">Latest Events</a> . . .</b><b><p>";
$events $DB_site->query("select * from event order by dateline DESC limit 5");
if (
$DB_site->num_rows($events))
{
        while (
$ev $DB_site->fetch_array($events))
        {
            
$new_date vbdate('m.d.Y'$ev['dateline'], falsefalse);
            
$link_date vbdate('Y-m-d'$ev['dateline'], falsefalse);
             
$news .= "<b>".$new_date."</b>"."<BR>";
             
$news .= "</b>".$ev['title']."<BR>";
        }
}
echo 
"<A HREF=\"/forum/calendar.php?do=getinfo$ev[eventid]&day=$link_date&c=1\">$news</A>"


Hi,

the DBsite command is using the SQL PHP class from VBulletin. If you have included the global.php you should not have the problems you have. Keep in mind that you have to change the directory to include the global.php if you are not in your forum home directory.

Cheers,

smdani 01-25-2005 05:41 AM

I used the information on this post and it worked like a charm for me!
THANKS A LOT.

On showing users online code:
Quote:

WHERE session.lastactivity > $online[datecut]
I cant found $online variable.
Which file must I include in order to work?

And, how can I show the total numer of users online?

Here another question:
Maybe this is not the correct thread, but I think you can help me because it is a very similar problem.
I would like to show TODAY BIRTHDAY's on a non-vb page.
What I dontknow how to do is to compare today date DATE(now), with users.birthday_search and find thos users whose celebrate their birthday.
Any help?

Thanks in advance.

Quote:

Originally Posted by Pseudomizer
Users online:

PHP Code:

$onlineusers $DB_site->query("
                        ## GET ONLINE USERS ##
                        SELECT user.username, (user.options & 
$_USEROPTIONS[invisible]) AS invisible,
                        user.usergroupid, session.userid, session.lastactivity,
                        IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
                        FROM "
.TABLE_PREFIX."session AS session
                        LEFT JOIN "
.TABLE_PREFIX."user AS user ON (user.userid = session.userid)
                        WHERE session.lastactivity > 
$online[datecut]
                        ORDER BY "
.iif($permissions['genericpermissions'] & CANSEEHIDDEN'invisible ASC, ')."username ASC"); 

Total Threads:

PHP Code:

$totalthreads $DB_site->query("Select count(threadid) from thread where visible = '1' ); 

Cheers,



All times are GMT. The time now is 06:39 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.01846 seconds
  • Memory Usage 1,917KB
  • 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
  • (15)bbcode_php_printable
  • (18)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (35)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete