Page 1 of 1

Can't Create multiple blocks [Solved]

Posted: 12 January 2014, 09:03
by Deluxe Flame
I've gotten my squares to appear, and I wanted to add additional rectangles(square_piece) on another location. Yet I'm getting an error.
Even if I remove all of square, and leave only square_piece I still get the error.
square by itself doesn't give an error message.

Error:

Template Error: set_block: unable to set block square_piece.
Halted.


.tpl:

Code: Select all

<div id="board">

    <!-- BEGIN square -->
        <div id="square_{X}_{Y}" class="square" style="left: {LEFT}px; top: {TOP}px;"></div>
    <!-- END square -->

    <!-- BEGIN square_piece-->
        <div id="square_piece_{SX}_{SY}" class="square_piece" style="left: {SLEFT}px; top: {STOP}px;"></div>
    <!-- END square_piece-->


    <div id="tokens">
    </div>

</div>
.view.php

Code: Select all

        $this->page->begin_block( "backgammontest_backgammontest", "square" );


        $hor_scale = 59;
        $ver_scale = 35;
        for( $x=1; $x<=13; $x++ )
        {
            for( $y=1; $y<=5; $y++ )
            {
                $this->page->insert_block( "square", array(
                    'X' => $x,
                    'Y' => $y,
                    'LEFT' => round( ($x-1)*$hor_scale+9-$x),
                    'TOP' => round( ($y-.94)*$ver_scale )
                ) );
            } 
     
            for( $y=1; $y<=5; $y++ )
            {
                $this->page->insert_block( "square", array(
                    'X' => $x,
                    'Y' => $y,
                    'LEFT' => round( ($x-1)*$hor_scale+9-$x),
                    'TOP' => round( ($y+4.7)*$ver_scale )
                ) );
            }   
        }

        $this->page->begin_block( "backgammontest_backgammontest", "square_piece" );


        $hor_scale = 1;
        $ver_scale = 5;
        for( $x=1; $x<=13; $x++ )
        {
            for( $y=1; $y<=1; $y++ )
            {
                $this->page->insert_block( "square_piece", array(
                    'SX' => $x,
                    'SY' => $y,
                    'SLEFT' => round( ($x-1)*$hor_scale+9-$x),
                    'STOP' => round( ($y-.94)*$ver_scale )
                ) );
            } 
     
            for( $y=1; $y<=1; $y++ )
            {
                $this->page->insert_block( "square_piece", array(
                    'SX' => $x,
                    'SY' => $y,
                    'SLEFT' => round( ($x-1)*$hor_scale+9-$x),
                    'STOP' => round( ($y+4.7)*$ver_scale )
                ) );
            }   
        }


        $hor_scale = 1;
        $ver_scale = 5;
        for( $x=1; $x<=13; $x++ )
        {
            for( $y=1; $y<=1; $y++ )
            {
                $this->page->insert_block( "rectangle", array(
                    'SX' => $x,
                    'SY' => $y,
                    'SLEFT' => round( ($x-1)*$hor_scale+9-$x),
                    'STOP' => round( ($y-.94)*$ver_scale )
                ) );
            } 
     
            for( $y=1; $y<=1; $y++ )
            {
                $this->page->insert_block( "rectangle", array(
                    'SX' => $x,
                    'SY' => $y,
                    'SLEFT' => round( ($x-1)*$hor_scale+9-$x),
                    'STOP' => round( ($y+4.7)*$ver_scale )
                ) );
            }   
        }
.css

Code: Select all

.square {
    width: 32px;
    height: 32px;
    position: absolute;
    background-color: red;
}
.square_piece{
    width: 60px;
    height: 176px;
    position: absolute;
    background-color: yellow;
    opacity:0.4;

}

Re: Can't Create multiple blocks

Posted: 12 January 2014, 20:17
by pikiou
You missed a space after "square_piece" in "<!-- BEGIN square_piece-->" and "<!-- END square_piece-->".

Re: Can't Create multiple blocks

Posted: 12 January 2014, 23:20
by Deluxe Flame
It had no effect =/
Am I not allowed to have more than one blocking?
or do I need to 'end' a block once its begin_block?

Re: Can't Create multiple blocks [Solved]

Posted: 13 January 2014, 00:19
by Deluxe Flame
turns out for whatever reason.
Copy and pasting caused errors, when I went in and manually typed square_space wherever it was needed, it worked.
Does anyone know why?

Re: Can't Create multiple blocks [Solved]

Posted: 13 January 2014, 07:32
by pikiou
Your computer must be haunted, call an exorcist! ^^

Re: Can't Create multiple blocks [Solved]

Posted: 14 January 2014, 23:23
by Deluxe Flame
Image

Re: Can't Create multiple blocks [Solved]

Posted: 15 January 2014, 09:40
by pikiou
You caught me ^^