Welcome Guest, Not a member yet? Register   Sign In
Questions regarding <dl> in CI.
#1

[eluser]├╝berfuzz[/eluser]
How should I display a <dl>-list in a view-file? I'm very fond of dl-tags and rather new with CI.

I've got a method in a model that fetches rows from a sql-table. With my limited knowledge of CI I take out the result in an array. (Could it be done with result()? I'm used to fall back on arrays etc when I feel unsure.) In the controller calling the get-method I have to tinker with the array.
sql-array from model:
Code:
Array
(
    [0] => Array
        (
            [when] => 2008
            [what] => Lorem ipsum...
        )

    [1] => Array
        (
            [when] => 2008
            [what] => Lorem ipsum...
        )

    [2] => Array
        (
            [when] => 2009
            [what] => Lorem ipsum...
        )

    [3] => Array
        (
            [when] => 2009
            [what] => Lorem ipsum...
        )

    [4] => Array
        (
            [when] => 2009
            [what] => Lorem ipsum...
        )
)

The array altered by the controller:
Code:
Array
(
    [2008] => Array
        (
            [0] => Lorem ipsum...
            [1] => Lorem ipsum...
        )

    [2009] => Array
        (
            [0] => Lorem ipsum...
            [1] => Lorem ipsum...
            [2] => Lorem ipsum...
        )

)
This is to be able to echo out a nice <dl>-tag, like this one:
Code:
<dl class="nice_dl">

        <dt>2008</dt>

        <dd>Lorem ipsum...</dd>
        <dd>Lorem ipsum...</dd>

        <dt>2009</dt>
        <dd>Lorem ipsum...</dd>
        <dd>Lorem ipsum...</dd>
        <dd>Lorem ipsum...</dd>
    </dl>

Could my sql-array be rendered in a better way? How should I muster the output in the view-file. Right now I'm using a foreach-loop.


Messages In This Thread
Questions regarding <dl> in CI. - by El Forum - 09-03-2009, 02:41 PM
Questions regarding <dl> in CI. - by El Forum - 09-03-2009, 04:21 PM
Questions regarding <dl> in CI. - by El Forum - 09-03-2009, 06:44 PM
Questions regarding <dl> in CI. - by El Forum - 09-03-2009, 11:43 PM
Questions regarding <dl> in CI. - by El Forum - 09-04-2009, 01:40 AM
Questions regarding <dl> in CI. - by El Forum - 09-04-2009, 01:46 AM
Questions regarding <dl> in CI. - by El Forum - 09-04-2009, 02:10 AM
Questions regarding <dl> in CI. - by El Forum - 09-04-2009, 02:12 AM
Questions regarding <dl> in CI. - by El Forum - 09-04-2009, 02:19 AM
Questions regarding <dl> in CI. - by El Forum - 09-04-2009, 03:10 AM
Questions regarding <dl> in CI. - by El Forum - 09-04-2009, 05:38 AM
Questions regarding <dl> in CI. - by El Forum - 09-07-2009, 02:30 AM
Questions regarding <dl> in CI. - by El Forum - 09-07-2009, 05:38 AM
Questions regarding <dl> in CI. - by El Forum - 09-07-2009, 05:51 AM
Questions regarding <dl> in CI. - by El Forum - 09-07-2009, 06:24 AM
Questions regarding <dl> in CI. - by El Forum - 09-07-2009, 06:58 AM
Questions regarding <dl> in CI. - by El Forum - 09-07-2009, 08:11 AM
Questions regarding <dl> in CI. - by El Forum - 09-07-2009, 11:05 AM
Questions regarding <dl> in CI. - by El Forum - 09-07-2009, 05:08 PM
Questions regarding <dl> in CI. - by El Forum - 09-08-2009, 12:45 AM
Questions regarding <dl> in CI. - by El Forum - 09-08-2009, 01:04 AM
Questions regarding <dl> in CI. - by El Forum - 09-08-2009, 03:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB