LeagueCMS
competition management for DragonFly CMS

Problems with blocks

The public support form for mComp, online gaming Competition Management Software
Reply to topicReply to topic Printer Friendly Page
Forum FAQSearchView unanswered posts

Problems with blocks

Post Posted: Wed Sep 10, 2008 7:23 pm

I have a small problem with the blocks of the latest MComp versions: they do not show up to date info. Neither the "latest" nor the "recent" block show any current data but only form the first two events that I have ever entered (though many others have followed since).

Edit: Forgot that the block changes depending on the event you are currently viewing. Is there a way how to make a "static" block that could be used on the front page of a site?

Secondly I am having problems with "latest" block in 1v1 events: Since there are no abbreviation available for players, the block can get incredibly wide, depending on the length of a site members. What do you think about a truncating option after x chars for player names in the block?

Golem
Contributor
Contributor
 

Problems with blocks

Post Posted: Thu Sep 11, 2008 5:57 am

The blocks generally show data from the event being currently viewed using a defined constant to exchange information. Look for these lines in the block :-

Code:
if (defined('MCOMP_CURRENT_GAME'))  { $inc = ' AND f.game='.MCOMP_CURRENT_GAME;   }
if (defined('MCOMP_CURRENT_EVENT')) { $inc = ' AND f.event='.MCOMP_CURRENT_EVENT; }

and remove them. The block will then show all events.

Note: If you're viewing the block from a non-mComp page (like another module such as News etc.) these constants are not defined, so the blocks show all events anyway.

To truncate player names look for this code in the latest results block :-

Code:
        <td valign="top" align="right"  ><a href="'.$linka.'">'.$namea.'</a></td>
        <td valign="top" align="center" >'.$row['hscore'].' : '.$row['ascore'].'</td>
        <td valign="top" align="left"   ><a href="'.$linkb.'">'.$nameb.'</a></td>

In this code $namea and $nameb are the player names. You could truncate them like so :-

Code:
        <td valign="top" align="right"  ><a href="'.$linka.'">'.substr($namea,0,20).'</a></td>
        <td valign="top" align="center" >'.$row['hscore'].' : '.$row['ascore'].'</td>
        <td valign="top" align="left"   ><a href="'.$linkb.'">'.substr($nameb,0,20).'</a></td>

This would truncate the names to 20 characters using the substr() function.

substr() takes 3 parameters, the string to work on, the starting position (0 in this case, which is the first character) and the number of characters to return, so substr($string,0,20) truncates a string to 20 characters, substr($string,0,10) truncates a string to 10 characters, etc.

I wouldn't want to do this by default in mComp, because I'm not to know how wide a user's blocks are.

mark
Site Admin
Site Admin
 
Page 1 of 1



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
You cannot attach files in this forum
You cannot download files in this forum