Page 1 of 1

Items not shown in own module admin

Posted: Wed Oct 19, 2005 9:05 am
by platine
Hi,

I've made my 1st own module using the Skeleton. It worked fine, I was able to add, edit, delete and all that. afte not using it for weeks now I figured out that the listing panel in the admin section does not show the items name, nr, geb anymore but the icon links for edit and delete which still do their job. This happened on two different cms-installations.

This ist the function:
function DisplayAdminList($id, &$params, $returnid, $message='')
{
    $db = $this->cms->db;
    global $gCms;
 
    $query = "SELECT * FROM ".cms_db_prefix()."module_pferde ORDER by name";
    $dbresult = $db->Execute($query);
    $rowclass = 'row1';
    $entryarray= array();
    while ($row = $dbresult->FetchRow())
    {
        $onerow = new stdClass();
        $onerow->id = $row['pferd_id'];
        $onerow->name = $this->CreateLink($id, 'adminedit', $returnid, $row['name'], array('p_id'=>$row['pferd_id']));
        $onerow->nr = $row['nr'];
        $onerow->geb = $row['geb'];
        $onerow->rowclass = $rowclass;
        $onerow->editlink = $this->CreateLink($id, 'adminedit', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/edit.gif', $this->Lang('edit'),'','','systemicon'), array('p_id'=>$row['pferd_id']));
        $onerow->deletelink = $this->CreateLink($id, 'admindelete', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/delete.gif', $this->Lang('delete'),'','','systemicon'), array('p_id'=>$row['pferd_id']), $this->Lang('areyousure'));
        array_push($entryarray, $onerow);
        ($rowclass=="row1"?$rowclass="row2":$rowclass="row1");
    }
    $this->smarty->assign_by_ref('items', $entryarray);
    $this->smarty->assign_by_ref('itemcount', count($entryarray));
    $this->smarty->assign('addlink', $this->CreateLink($id, 'adminadd', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/newobject.gif', $this->Lang('add'),'','','systemicon'), array(), '', false, false, '') .' '. $this->CreateLink($id, 'adminadd', $returnid, $this->Lang('add'), array(), '', false, false, 'class="pageoptions"'));
    $this->smarty->assign_by_ref('l_name', $this->Lang('l_name'));
    $this->smarty->assign_by_ref('l_nr', $this->Lang('l_nr'));
    $this->smarty->assign_by_ref('l_geb', $this->Lang('l_geb'));
    $this->smarty->assign_by_ref('title_section', $this->Lang('title_admin_panel'));
    $this->smarty->assign_by_ref('welcome_text', $this->Lang('welcome_text'));
    // Display the populated template
    echo $this->ProcessTemplate('adminlist.tpl');
}

and the template:

{$title_section}

{$welcome_text}


{if $itemcount > 0}

 
   
      {$l_name}
      {$l_nr}
      {$l_geb}
       
       
   
 
 
  {foreach from=$items item=entry}
    rowclass}" onmouseover="this.className='{$entry->rowclass}hover';" onmouseout="this.className='{$entry->rowclass}';">
      {$entry->name}
      {$entry->nr}
      {$entry->geb}
      {$entry->editlink}
      {$entry->deletelink}
   
  {/foreach}
 

{/if}


  {$addlink}


I can't see anything, maybe someone else? Thanks.

Re: Items not shown in own module admin

Posted: Wed Oct 19, 2005 9:27 am
by Ted
it's not something weird like the text is there, but it's a weird color or something, is it?

I really can't see any reason why text wouldn't show, but icons would...

Re: Items not shown in own module admin

Posted: Wed Oct 19, 2005 10:32 am
by platine
Hm, I did just a little modification in the template:
{$l_name}{$l_nr}{$l_geb}  


and now it is fine again. Little thing, but big effect ... :-))

Re: Items not shown in own module admin

Posted: Wed Oct 19, 2005 11:44 am
by Ted
It forced smarty to recompile the template.  Something weird must have happened and it got of out sync.  It does happen sometimes, though, in general, smarty is pretty reliable.