×
Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
Multiple models in one view for J3.3
John Benac
New Member
Posts: 5
8 года 5 мес. назад #1345
от John Benac
John Benac ответил в теме Multiple models in one view for J3.3
have you verified that you use of JModelLegacy will successfully use functions from within the site part of the component? I dont have enough reputation on stack overflow to comment. Please upvote my question and answer!
recently, I did the following to access other functions integrating Jomsocial and kunena:
in controllers/groups.php
public function save() {
$group = JTable::getInstance('Group', 'CTable');
$group->name = $name;
...lots of code defining $group...
$group->store();
//and then my own code!!
$group->hack($group);
}
and then in tables/groups.php
public function hack($group){
$db = JFactory::getDBO();
$sql = "INSERT INTO `z1b6c_kunena_aliases` (`alias`, `type`, `item`, `state`) VALUES
('".JFilterOutput::stringURLSafe($group->name)."', 'catid', '-42', 0);";
$db->setQuery($sql);
try {
$db->execute();
} catch (Exception $e) {
JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');
}
}
I suggest using the error_log() function to output your variables every step of the way so that you know that it is processing correctly. I check my error logs by accessing nano /var/log/httpd/error_log
accessible by behaving as `root` (by typing sudo su)
recently, I did the following to access other functions integrating Jomsocial and kunena:
in controllers/groups.php
public function save() {
$group = JTable::getInstance('Group', 'CTable');
$group->name = $name;
...lots of code defining $group...
$group->store();
//and then my own code!!
$group->hack($group);
}
and then in tables/groups.php
public function hack($group){
$db = JFactory::getDBO();
$sql = "INSERT INTO `z1b6c_kunena_aliases` (`alias`, `type`, `item`, `state`) VALUES
('".JFilterOutput::stringURLSafe($group->name)."', 'catid', '-42', 0);";
$db->setQuery($sql);
try {
$db->execute();
} catch (Exception $e) {
JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');
}
}
I suggest using the error_log() function to output your variables every step of the way so that you know that it is processing correctly. I check my error logs by accessing nano /var/log/httpd/error_log
accessible by behaving as `root` (by typing sudo su)
Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.
Stargazer
New Member
Posts: 3
8 года 5 мес. назад #1347
от Stargazer
Stargazer ответил в теме Multiple models in one view for J3.3
Thanks for the response. I will play around with it some more. Very frustrating so far.
I also don't have enough of a reputation on Stack Overflow to upvote you. FYI.
I also don't have enough of a reputation on Stack Overflow to upvote you. FYI.
Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.
Время создания страницы: 0.054 секунд