dswp.de
http://www.dswp.de/old/

New Maps for the mapcyclevote
http://www.dswp.de/old/nice-maps/new-maps-for-the-mapcyclevote-t2526-110.html
Page 12 of 16

Author:  Pirat [ 02.22.12 ]
Post subject:  Re: New Maps for the mapcyclevote

wurst wrote:
yea.
we have automatic backup btw, db and flies

Hopefully, we won't have to make use of it in my clumsy and unillumined
attempts to merge our databases. ;-}

.

Author:  havoc [ 02.22.12 ]
Post subject:  Re: New Maps for the mapcyclevote

Pirat wrote:
havoc wrote:
just add a table for comments with these columns:

comment id
map id
date/time
user id/name/whatever
comment text
type of comment

with type of comment being one of 3 - a pro, a con, or just comment
[...]
p.s. your primary in the maps table should be the map id

AFAIK, this won't work, as in your table, there is more than one row
for each map (because there can be more than one comment per
map). Therefore, the map id is not unique and thus cannot act
as a primary key.

Would should work, however, is using a composite primary key that
comprises all columns. I'll probably use such a key for all of my
tables except for my main table where the map name/id is the
primary key.



i think you are confused or something m8...
in your table the primary must be the map id, in my table the primary must be the comment id, with map id marking which comment is related to which map.

Author:  havoc [ 02.22.12 ]
Post subject:  Re: New Maps for the mapcyclevote

Pirat wrote:
List data for the maps are stored in other tables, like urtmaptags,
urtmapauthors, urtmaplicenses (a map can be dual-licensed, for
instance), urtmapdownloads, etc.


you are definitely doing something wrong.
you only need 2 tables - one for the maps one for user feedback.
urtmaplicenses? dont know about overengineering but you are overdoing something :)

Author:  Pirat [ 02.22.12 ]
Post subject:  Re: New Maps for the mapcyclevote

havoc wrote:
Pirat wrote:
havoc wrote:
just add a table for comments with these columns:

comment id
map id
date/time
user id/name/whatever
comment text
type of comment

with type of comment being one of 3 - a pro, a con, or just comment
[...]
p.s. your primary in the maps table should be the map id

AFAIK, this won't work [...]

i think you are confused or something m8...

I always am, but your description was simply ambiguous.

havoc wrote:
in your table the primary must be the map id, in my table the primary must be the comment id, with map id marking which comment is related to which map.

Aaaah, okay, so you mean this:

  • table "urtmaps":
    non-list map data (map id, filesize, ...), PK: map id
  • table "urtmapdata":
    each row is a comment with the fields you mentioned, PK: comment id.

Was that your suggestion? If no, please explain in detail.
If yes: hooray, no misunderstandings anymore! :-)

.

Author:  havoc [ 02.22.12 ]
Post subject:  Re: New Maps for the mapcyclevote

ok will try to explain. first of all heres a screenie so we all see what we talking about:

Attachment:
Screenshot-1.png


so given thats the supposed final result, how that translates into db? here goes:

map id - int, pk, a.i. - first we need this, a unique marker for every record (map) in the table
map name - varchar, the name of the map, like "Slumwar"
map file name - varchar, ut4_slumwar.pk3
map image - varchar, a screenie for the map
map modes - varchar, you will keep here a serialized array of the selected modes (see serialize in php docs). think of checkboxes
map size - varchar
file size - varchar, you can get that while uploading
author - varchar, you can make an ajax dropdown google suggestions style for easier data entering. oops - forgot - no ajax.
download - varchar, you can put a textarea and parse every url to a "Site1", "Site2" and such. tho id suggest theres only one download link and it points to a file somewhere on dswp. theres nothing as annoying as dead links.
home - varchar, input type = text
license - text - not sure you really need comments on the license there. better off without them
comments on tdm ffa and such - not sure you need that, it bloats the structure and gives you nothing. better off without them too.
pros, cons and notes - the user comments, will go to the other table

one more thing:
date added - a datetime, autodate for when this map is added

thats pretty much the map table columns
the comments table i pretty much already explained, nothing to add there really

Author:  havoc [ 02.22.12 ]
Post subject:  Re: New Maps for the mapcyclevote

so ye, with both those tables, its kinda everything you need, + some php magic.
the rest is include the necessary phpbb files, and get the user session data, so you can check if they are logged and able to comment etc, and add automagically their name to their comment. and thats it - the map thing is ready.

Author:  wurst [ 02.24.12 ]
Post subject:  Re: New Maps for the mapcyclevote

including phpbb means hooking it in template.

check 1.) ./whoswhere.php
its calling 2.) ./styles/blackbox_blue/template/whoswhere.html
there inside u find some

<!-- PHP --> include("http://www.dswp.de/old/dswp_tools/svarox/whoswhere_session.php"); <!-- ENDPHP -->

thats it, ure hooked.
check other files in template dir, maybe sort by chaned date to see the last trys...
eg. in xlr_stats.html u can see blinky passing GET variables.
its not elegant and its doing double stats.
its however working pretty ok, maybe u have a better way.

ah, ask xtj for anything with phpbb if google dont know the answer...

Author:  havoc [ 02.24.12 ]
Post subject:  Re: New Maps for the mapcyclevote

for a beginning he only needs to check if the user is logged, i.e. include the common includees and see the session stuff.

http://www.phpbb.com/kb/article/phpbb3- ... tegration/

this one is short and to the point.

Code:
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
?>

Your existing page goes here


Code:
<?php
if ($user->data&#91;'user_id'&#93; == ANONYMOUS)
{
   echo 'Please login!';
}

else
{
   echo 'Thanks for logging in, ' . $user->data&#91;'username_clean'&#93;;
}
?>
 

Author:  havoc [ 03.01.12 ]
Post subject:  Re: New Maps for the mapcyclevote

i think pirat left us for good

Author:  Pirat [ 03.03.12 ]
Post subject:  Re: New Maps for the mapcyclevote

havoc wrote:
i think pirat left us for good

Nooooooooooooo! If I would, you would read in the news about it. ;-}

Sorry for my seeming procrastination, but I was (and to some extent, still am) quite
busy with my job and other things.

Will take care of it soon, promised!

Page 12 of 16 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/