WarcraftReamls.com
  FAQFAQ    SearchSearch    MemberlistMemberlist    UsergroupsUsergroups   RegisterRegister 
  ProfileProfile    Log in to check your private messagesLog in to check your private messages    Log inLog in 
Some sample guild export code
Goto page Previous  1, 2, 3, 4, 5  Next
 
Post new topic   This topic is locked: you cannot edit posts or make replies.    WarcraftRealms.com Forum Index -> WarcraftRealms Developers
View previous topic :: View next topic  
Author Message
Rollie
Site Admin


Joined: 28 Nov 2004
Posts: 5374
Location: Austin, TX
WR Updates: 480,131
Rollie WR Profile

PostPosted: Sat Feb 05, 2005 6:51 pm    Post subject: Reply with quote

I get the guild info from a guild info request. I need to do further testing on this to be sure as it might not get characters if you do not have the 'Show offline characters' box checked on the guild tab.

If there are some members missing then this might be the case, or it might be due to a still troublesome bug I am trying to track down that causes not all guild members to always update correctly.

I had thought I had put this one behind me, but it may still be around =/
Back to top
View user's profile Send private message Visit poster's website
Oyjord
Guest







PostPosted: Mon Feb 07, 2005 5:38 pm    Post subject: help running cron job? Reply with quote

Hi all,

Great, great thread, I'm looking forward to testing these php files out on my guild's site.

I've never learned how CRONtas/jobs work, however.

Any tips on what command to enter in my CRONtab field? I'm not sure what command to enter to grab the guild data file once a day.

Thanks for any tips,
Oy.
Back to top
Rollie
Site Admin


Joined: 28 Nov 2004
Posts: 5374
Location: Austin, TX
WR Updates: 480,131
Rollie WR Profile

PostPosted: Mon Feb 07, 2005 6:16 pm    Post subject: Reply with quote

It depends on your host and how they have it set up. I would suggest asking on the support forums for your host if available. Or, if you just build it into the main page, it can do the status checks for you and download the file when necessary (as the php script in the first post does).
Back to top
View user's profile Send private message Visit poster's website
Oyjord
Guest







PostPosted: Tue Feb 08, 2005 2:26 pm    Post subject: Reply with quote

Rollie wrote:
It depends on your host and how they have it set up. I would suggest asking on the support forums for your host if available. Or, if you just build it into the main page, it can do the status checks for you and download the file when necessary (as the php script in the first post does).


Thanks, Rollie.

I just cut and paste your script from the first post and edited the top two config entries, and it appears to be working great. Thanks a ton. The "Rank" field shows "Unknown" all the way down, but I'm sure I goofed that up somehow Smile. It's been less than 24 hrs since I installed and first called the .php file, so I'm not sure if it'll update correctly, which is why I was asking about the crontabs function. My ISP has a really nice online crontabs interface, with pull down menus for all kinds of options (times, etc), and the only field I really don't get is the most important one, the "command" field heh.

Regardless, is there a way of my checking (maybe the local status.txt files?) to ensure the data will update come 24 hrs? I'm still not sure how the status.txt files work. Sorry for being such a newb.

Cheers,
Oy.
Back to top
Rollie
Site Admin


Joined: 28 Nov 2004
Posts: 5374
Location: Austin, TX
WR Updates: 480,131
Rollie WR Profile

PostPosted: Tue Feb 08, 2005 3:16 pm    Post subject: Reply with quote

First off, the reason the rank field would show unknown would be due to nobody in your guild having submitted guild data using the Census+ mod. It's real easy to do and I encourage you to do so.

As for the status.txt file, it is just a timestamp of the last time certain files were generated on the server. It is a tiny file so checking the timestamp file is cheap (bandwidth wise) compared to downloading the guild info file every time to access the data. So in an effort to decrease bandwidth usage, I request that info files only be downloaded once per day.

You can either set up a cron job to download once per day, or you can check the last time you downloaded the file with the current status.txt file to see how much time has passed since the files were last generated. If enough time has lapsed (24 hours), then the files can be downloaded again!

That answer your questions?
Back to top
View user's profile Send private message Visit poster's website
Oyjord
Guest







PostPosted: Tue Feb 08, 2005 3:20 pm    Post subject: Reply with quote

Rollie wrote:
First off, the reason the rank field would show unknown would be due to nobody in your guild having submitted guild data using the Census+ mod. It's real easy to do and I encourage you to do so.

As for the status.txt file, it is just a timestamp of the last time certain files were generated on the server. It is a tiny file so checking the timestamp file is cheap (bandwidth wise) compared to downloading the guild info file every time to access the data. So in an effort to decrease bandwidth usage, I request that info files only be downloaded once per day.

You can either set up a cron job to download once per day, or you can check the last time you downloaded the file with the current status.txt file to see how much time has passed since the files were last generated. If enough time has lapsed (24 hours), then the files can be downloaded again!

That answer your questions?


Aye, Rollie, thanks the help. Now I just need to find what command to enter to set up a cron job to download once per day. My ISP has a really nice GUI Crontabs for morons like me, but I still need to somehow tell it to grab the .csv file and put it somewhere heh. I'll work on that.

Thanks again, great having this guild info on our site now,
Oyjord.
Back to top
Rollie
Site Admin


Joined: 28 Nov 2004
Posts: 5374
Location: Austin, TX
WR Updates: 480,131
Rollie WR Profile

PostPosted: Tue Feb 08, 2005 5:00 pm    Post subject: Reply with quote

Just drop the saving part into a php file, say saveinfo.php:

Code:
        $filename = 'http://www.warcraftrealms.com/exports/guildexport.php?guildid=' . $guild_id;
        $infile = fopen ($filename, "r");
        if (!$infile)
        {
            echo "<p>Unable to open remote file.<br>\n";
            exit;
        }

        $outfilename = $local_directory . "guildroster.csv";
        $outfile = fopen($outfilename, "w");
        if( !$outfile )
        {
            echo "<p>Unable to open save file => " . $outfilename . "<br>\n";
            exit;
        }

        while (!feof ($infile))
        {
            $buffer = fgets($infile, 4096);
            fputs($outfile, $buffer);
        }

        fclose($outfile);
        fclose($infile);


Now, depending on your ISP's setup, you should be able to do something like

lynx -dump /dev/null http://www.yourdomain.com/saveinfo.php > /dev/null

This would invoke the text based browser, Lynx, to process the php script. There may be some issues with having the correct path that you might have to qualify the lynx call, or the location of the saveinfo.php file, but that should do it when you get the paths correct.
Back to top
View user's profile Send private message Visit poster's website
Shade



Joined: 07 Feb 2005
Posts: 6

WR Updates: 0
Shade WR Profile

PostPosted: Fri Feb 11, 2005 5:46 pm    Post subject: Reply with quote

Yo, Rollie can you help me wit sumfin? I'm trying to sort the guild member list by classes into separate tables, yet after the first table is shown all the output is showing is just the table with the header (Username, Level, etc..)
and the other users arent showing.

im trying to just use an if statement like:
Code:
if ($class == 'Rogue') {
echo (" table info with the $name, $level, blah blah ");
}
if ($class == 'Warrior'){
echo (" more table info ");
}


except with your guild roster code it's just doing what i said up top.
Basically i want it to look like:
http://www.freepgs.com/warng/rostertemplate.htm

thanks,
Frozenshade

[/code]
Back to top
View user's profile Send private message
Rollie
Site Admin


Joined: 28 Nov 2004
Posts: 5374
Location: Austin, TX
WR Updates: 480,131
Rollie WR Profile

PostPosted: Fri Feb 11, 2005 7:04 pm    Post subject: Reply with quote

To do what you are trying to do, you would have to be sure to first sort the list by class, then do a check in your output loop to catch when the class changes and output the proper html as needed.

That or build up separate table information as you process the list and then do a string replace on some key value in your template file to insert the proper html as needed.

If I have a chance this weekend, I'll try to give you an example of what to do.
Back to top
View user's profile Send private message Visit poster's website
Nukes
Guest







PostPosted: Tue Feb 22, 2005 8:25 am    Post subject: Nice Posts guys Reply with quote

I'm experience in PHP and I understand what this code is doing. I have one problem. My web hosting company requires the directory to be CHMOD 755. Therefor I cannot write to the directory. Any ideas?
Back to top
Rollie
Site Admin


Joined: 28 Nov 2004
Posts: 5374
Location: Austin, TX
WR Updates: 480,131
Rollie WR Profile

PostPosted: Tue Feb 22, 2005 9:19 am    Post subject: Reply with quote

You could always use a database. Read the status file, write the value to the database. Compare that before reading the guild export. When you do read the export, write the contents to database instead of a file. Then pull from the database for display.
Back to top
View user's profile Send private message Visit poster's website
Nukes
Guest







PostPosted: Wed Feb 23, 2005 3:09 pm    Post subject: Reply with quote

Duh..... I should of thought of that. Thanks bro.
Back to top
Nukes
Guest







PostPosted: Wed Feb 23, 2005 7:55 pm    Post subject: Reply with quote

Rollie, started a new thread for development of a php script for PHP/Database information. Maybe if you have time you can help me out. I have a good chunk of code written.
Back to top
Xhooght79
Guest







PostPosted: Thu Mar 17, 2005 1:58 pm    Post subject: Cencus Borders Reply with quote

First of all this is great stuff. I love it!

Forgive my ignorance, but I love how the cencus looks. May i use the borders and general layout of the cencus as long as i give cridit on the website?

here is the link to my census

[url=mailto:mharmon827@gmail.com]Here[/url] is my email address
Back to top
Rollie
Site Admin


Joined: 28 Nov 2004
Posts: 5374
Location: Austin, TX
WR Updates: 480,131
Rollie WR Profile

PostPosted: Thu Mar 17, 2005 3:14 pm    Post subject: Reply with quote

You are welcome to use the graphics/layout of the guild display. Also, you don't currently have your Guild Data provided by WarcraftRealms.com link so please add that to your page as well =)
Back to top
View user's profile Send private message Visit poster's website
Xhooght



Joined: 17 Mar 2005
Posts: 2

WR Updates: 0
Xhooght WR Profile

PostPosted: Thu Mar 17, 2005 10:11 pm    Post subject: was having troubles Reply with quote

Ya, i know next to nothing about PHP but i do some programming on the side so i generally know what is happening. I was playing with echo and where to end my table and kept loosing the link on the bottom. Its there now though. Thanks for letting me use the layout.

Here is a sample of my output code, look formilure? I want to have a border of 1px under each cell. How do go about doing this? I have been playing and tinkering, can't seem to get it. (sorry for the messy code)

Code:
 <?php
require ("test.php");

//Printing out the member data
   
   for($i = 1;$i < count($d_file);$i++)
{
    list( $name, $race, $class, $level, $last_seen, $rank ) = explode(",", $d_file[$i]);

    echo '<tr class="content"><td class="content">' . $name . '</td><td class="content">' . $race . '</td><td class="content">' . $class . '</td><td class="content">' . $level . '</td><td class="content">' . $last_seen . '</td><td class="content">' . $rank . '</td></tr>';
}

echo '</table>';
//The first line contains no member data
$member_count = count($d_file) - 1;

echo '<table class="content"><tr><td class="topcontent"><center>Statistics</center><tr><td class="content">';
echo 'Total Members: ';
echo "$member_count";
echo '</center>';
echo "Guild data provided by <a href='http://www.warcraftrealms.com/'>WarcraftRealms.com</a>.";
echo '</td></tr></table>';

?>
[/code]

P.S. do you maintain this website yourself?
Back to top
View user's profile Send private message
Xhooght



Joined: 17 Mar 2005
Posts: 2

WR Updates: 0
Xhooght WR Profile

PostPosted: Mon Apr 11, 2005 9:50 pm    Post subject: Sorting Data Reply with quote

I am haveing some troubles being able to sort my data. I want to make it so you can click on the header and it sorts that field.. for example click on level and it sorts it by level.. I noticed you have it on your site and wonder how you do it.
Back to top
View user's profile Send private message
Rollie
Site Admin


Joined: 28 Nov 2004
Posts: 5374
Location: Austin, TX
WR Updates: 480,131
Rollie WR Profile

PostPosted: Mon Apr 11, 2005 10:24 pm    Post subject: Reply with quote

How are you storing your data? Are you storing everything in a database or just using the export file?
Back to top
View user's profile Send private message Visit poster's website
gideon
Guest







PostPosted: Mon May 16, 2005 2:13 pm    Post subject: im a dummie Reply with quote

oke im a dummie i tried this 2 get on my website but my programming skill nill 2 zero i just dont quite get it
could some one plz explain step by step how 2 do this or maybe send me a email about this

my email paulbloom1980 @ yahoo.com

i would very much apreciate this and i know many others will 2
thnx
Back to top
Rollie
Site Admin


Joined: 28 Nov 2004
Posts: 5374
Location: Austin, TX
WR Updates: 480,131
Rollie WR Profile

PostPosted: Mon May 16, 2005 4:04 pm    Post subject: Reply with quote

Gideon, tell me a little more about your background and what you have available as far as your web host goes and perhaps I can help a little more.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    WarcraftRealms.com Forum Index -> WarcraftRealms Developers All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4, 5  Next
Page 2 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
WarcraftRealms.com  


Powered by phpBB © 2001, 2005 phpBB Group