Quote:
trabis wrote:
I don't understand your english :(
xoopsLoadlanguage is for loading modules and core language.
You can use:
xoops_loadLanguage('main', 'news'); to load modules/news/language/english/main.php
or
xoops_loadLanguage('user); to load language/english/user.php
In xoops 2.6 you can get language from other folders like themes, Frameworks, etc (thanks to zyspec)
You understand perfectly from what you have written to me.
The problem is that if you use a file created by me in language/italian/homepage.php taken by the function:
xoops_loadLanguage('homepage');
does not work, only if I use the main.php of theme, it works
Quote:
xoops_getmodulehandler() is just a factory for the handlers (that handle the objects). It will return an instance of the handler class. The handler class must call it's parent XoopsObjectPersitableHandler class __construct() providing the parameters such as, the db table it will get data from, and the object class name that it will use to create a new object and populate with the data retrieved.
If you shared the code it would be easier to see the problem.
Begin on class nw_NewsStory:
I have changed
class nw_NewsStory extends [b]XoopsStory[/b]
{
with:
class nw_NewsStory extends [b]XoopsObject[/b]
{
as you said by replacing the class name as the instance nw_stories
The class handler is:
class xnewsnw_NewsStoryHandler extends XoopsPersistableObjectHandler
{
function __construct($db)
{
parent::__construct($db, 'nw_stories', 'nw_NewsStory', "storyid", "title");
$this->className = 'nw_NewsStory';
}
}
This is correct?
The code in homepage.php is:
$nw_storiesHandler =& xoops_getModuleHandler('nw_stories', 'xnews');
$criteria = new CriteriaCompo();
$criteria->setSort("storyid");
$criteria->setOrder("DESC");
$nwrows = $nw_storiesHandler->getCount();
if (isset($_REQUEST['limit'])) {
$criteria->setLimit($_REQUEST['limit']);
$limit = $_REQUEST['limit'];
//$GLOBALS['xoopsTpl']->assign('xnews_limit', $limit);
}
$nw_stories_arr = $nw_storiesHandler->getAll($criteria);
if ($nwrows>0)
{
foreach (array_keys($nw_stories_arr) as $i)
{
$xnews_title = $nw_stories_arr[$i]->getVar("title");
$xnews_description = $nw_stories_arr[$i]->getVar("description");
$xnews_picture = $nw_stories_arr[$i]->getVar("picture");
$GLOBALS['xoopsTpl']->append('last_news', array('title' => $xnews_title,
'description' => $xnews_description,
'picture' => $xnews_picture));
}
}
the variable picture will be taken from the class nw_topics
For file system_homepage.html:
<{$last_news.picture}>
<{$last_news.title}>
<{$last_news.description}>
I hope you understand