Home   -   News   -   Game Tour   -   Screenshots   -   Rules   -   Chat   -   Contact   -   Forum
pt ro hu de es
pl it no nl en
The Land of Destiny Hero welcomes you.
Role playing game or called MMORPG free browser game
Posts

Breadcrumbs to navigate the website Homepage / Forum / Test forum / Code tags



Topic: Code tags Post reply

Page: 1

Member Posted on: 23-06-2008 19:18:45
Posts: 822



Since a new forum called "personal projects" has been launched, a code-tag wasn't a bad idea, to keep all code structured.
if (count($headers) > 0)
{
    foreach ($headers as $cellcontent)
    {
        $colspan = null;
        
        if (count($headers) < $max && $i == count($headers)-1)
        {
            $colspan = " colspan=\"".($max - count($headers)+1)."\"";
        }
        
        $templates->set("th","table['cells']",true);
        $i++;
    }
    $templates->set("row","table['rows']",true);
    
    if (count($headers) > $max)
    {
        $max = count($headers);
    }
}
Some little snippet to test...

If someone knows some fancy colors for the lay-out of the code box, it's more than welcome.
Moderator Posted on: 23-06-2008 19:56:38
Posts: 543



what about the php tag
Developer Posted on: 23-06-2008 20:02:39
Posts: 3379



works fine:

<?
if (count($headers) > 0)
{
    foreach (
$headers as $cellcontent)
    {
        
$colspan null;
        
        if (
count($headers) < $max && $i == count($headers)-1)
        {
            
$colspan " colspan=\"".($max count($headers)+1)."\"";
        }
        
        
$templates->set("th","table['cells']",true);
        
$i++;
    }
    
$templates->set("row","table['rows']",true);
    
    if (
count($headers) > $max)
    {
        
$max count($headers);
    }
}
?>

Member Posted on: 23-06-2008 20:06:45
Posts: 822



But not all code is PHP, and the PHP highlight function needs "<?" or "<?php" to be in front of the code.
Moderator Posted on: 23-06-2008 20:58:46
Posts: 543



maybe you could make a code tag which accepts an language attribute like gamedev.net has.

vb
[source lang=php][/source]
[source lang=csharp][/source]
[source lang=vb][/source]
Developer Posted on: 23-06-2008 21:00:11
Posts: 3379



better spend some time on finishing the game/alpha
Member Posted on: 23-06-2008 21:02:11
Posts: 822



Good idea, id0001, GeShi is an excellent highlighter for that. But like BasTijs said, we'll fully concentrate on the alpha from now on. The code tag is just a "quick fix".
Moderator Posted on: 23-06-2008 21:02:42
Posts: 543



yeah thats right. this isn't some devsite

Page: 1

You have to register or login first before you are able to reply.
LoD is a free online rts game free online MMORPG