Hi there,
First, i'm sorry if my question is not in the good section. Don't hesitate to move this post in the correct one. Then, i'm totaly beginner in PHP /Xoops developpment. I try to develop a module for the website of my association. Last, my english is not fluent, so i'm sorry if my explanations are bad :)
So, in order to save in database additionals informations about users, i created a new table. In order to link this table with the 'user' table, i save the uid in a column.
Now, i would to print in the admin part of my module an array with informations about all users, and the first column must be the nickname of the user.
So i created a new object which extends XoopsObject and a handler which extends XoopsPersistableObjectHandler in order to get simply datas from database. But i don't success to retrieve the uname of each user. I don't know if i need to do this in the smarty script or in my object.
I tried to do this in my class :
function __construct()
{
$this->initVar('uid', XOBJ_DTYPE_INT, null, true);
$this->initVar('member_id', XOBJ_DTYPE_INT, null, true);
$this->initVar('member_lastname', XOBJ_DTYPE_TXTBOX);
$this->initVar('member_website_name', XOBJ_DTYPE_TXTBOX);
$handler =& xoops_gethandler('users');
$this->setVar('member_website_name', $handler->getUnameFromId($this->getVar('uid')));
}
but it is not working.
After, i tried this in my php page :
$userhandler =& xoops_gethandler('user');
$GLOBALS['xoopsTpl']->assign('users', $userhandler);
and this in my smarty script :
<{foreach item=member from=$members}>
<tr class="<{cycle values='odd, even'}>">
<td><{$users->getUnameFromId(member.uid)}>td>
tr>
<{/foreach}>
but compilation failed.
Anyone have an idea ?
Thanks in advance :)
Edit : I think it's quite difficult to find a correct way because I need to call a function from Xoops Kernel but all members are feach in the smarty script. May I have to code my own SQL request ?