[prev in list] [next in list] [prev in thread] [next in thread] 

List:       nextgen-online
Subject:    [Nextgen-online] html tables example
From:       dkeats () uwc ! ac ! za (Derek Keats)
Date:       2004-07-27 10:59:05
Message-ID: s106384b.067 () Services-02 ! uwc ! ac ! za
[Download RAW message or body]

All the modules that I have written use it, you can look in them. It is also \
documented internally, and it follows the same approach you designed.

create an instance
set its properties
show

I am not sure about the methods that Shulam added as I have not used them, but what I \
wrote provides two methods, adding individual cells or adding rows.

Adding individual cells is done as
    /*
    * Create the table for the final layout
    * Note that we are still not generating any output. 
    * Everything is still resident in memory as strings.
    */
    $this->rtTable = $this->newObject('htmltable', 'htmlelements');
    //Begin a new table row
    $this->rtTable->startRow();
    /*
    * Add a cell to the table, make it 75% of the available width and add
    * the contents of the centered layer that we made earlier into it.
    */
    $this->rtTable->addCell($this->center->addToLayer(), "75%");
    /*
    * Add a cell to the table, make it 25% of the available width and add
    * the contents of the right hand column string ($strout) into it.
    */
    $this->rtTable->addCell($strout, "25%", "top", Null, "blog-right");
    //End the table row
    $this->rtTable->endRow();
    
    /* 
    * At last put the content on the page. Note that we use the show
    * method of the table object. Remember, if you create a framework
    * extension, make sure that it has a show method that returns a 
    * string. Extensions should not generally contain any code to actually
    * render output to the browser (i.e. no echo or print statements)
    */
    echo $this->rtTable->show();

Adding a row is just passing an array of all the row elements. If the row is a \
heading use addHEading instead of addRow.

    function showMostRecent()
    {
        //Put it all in a table
        $this->recTable = $this->newObject('htmltable', 'htmlelements');
        $this->recTable->addHeader(array($this->objLanguage->languageText("mod_blog_mostrecentposts")), \
"blog-listname", "colspan=\"2\"");  $this->recTable->active_rows = false;
        $this->recTable->cellpadding = 0;
        $this->recTable->cellspacing = 1;
        $this->recTable->width = "91%";
        
        $ar = $this->objDbBlog->getMostRecent();
        $ret = null; 
        // Create an instance of icon object
        $this->objGetIcon = $this->newObject('geticon', 'htmlelements'); 
        // The add comment icon with link
        $this->objGetIcon->setIcon("bullet");
        $this->objGetIcon->align = "absmiddle";
        foreach ($ar as $line) {
            $title=stripslashes($line['title']);
            $name=$line['firstname'] . " " . $line['surname'];
            $blogId = $line['id'];
            // The location for the link
            $location = $this->uri(array('action' => 'viewcomments',
                    'module' => 'blog',
                    'blogId' => $blogId));
            $icon = "<a href=\"".$location."\">";
            $icon .= $this->objGetIcon->show()."</a>";
            $this->recTable->addRow(array($icon,$title . " <b>"
              .$this->objLanguage->languageText("word_by")."</b> " . $name), \
"blog-listtitle");  } 
        return $this->recTable->show();
    } 


> > > wnitsckie@uwc.ac.za 07/27/04 09:17AM >>>
Hi all 
Derek. Can you show me an example of how to use your html tables object.
The example you gave in the htmltables_class_inc.php comments does not work .
W


_______________________________________________
Nextgen-online mailing list
Nextgen-online@avoir.uwc.ac.za 
http://avoir.uwc.ac.za/mailman/listinfo/nextgen-online


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic