Joomla TPlancer组件添加新字段和显示

时间:2010-10-21 02:37:26

标签: php mysql joomla

我在我的网站上安装了Joomla的TPLancer组件,我正在尝试向Freelancer和买方的个人资料页面添加更多信息。我不是PHP或mySQL的天才,但通常可以通过我的方式诈唬。 当前显示在配置文件页面上的信息只是从数据库中提取的数据。我在数据库中添加了一个新的“网站”行,并在数据库中输入了一些数据,但我似乎无法显示它。我以为它就像echo $ row->网站;因为echo $ row->类别; echo $ row-> company;他们都在同一张桌子里 发生的事情显然远远超过我的头脑。下面我粘贴了tplancer.php文件中的一部分代码,其中包含了我想要定位的功能。
下面是tplancer.html.php文件中的一些代码,它显示页面上的实际HTML。 我希望有人可以提供帮助,我希望我听起来不会太愚蠢!干杯

function showLancerInfo($option) { global $mainframe; $user =& JFactory::getUser(); $db =& JFactory::getDBO(); $lancer_id = JRequest::getVar('id', 0, 'get', 'int');

$is_lancer = isLancer($user->id);
$is_buyer = isBuyer($user->id);
$query = "select id FROM #__glance_lancer where userid =".$lancer_id;   
$db->setQuery( $query );
$id = $db->loadResult();
if(!$id)
{
    echo "Freelancer not found!";
    return;
}
$query = "select username FROM #__users where id =".$lancer_id; 
$db->setQuery( $query );
$username = $db->loadResult();
$row =& JTable::getInstance('lancer','Table');  
$row->load($id);
$query = "select * FROM #__glance_projects where chosen =".$lancer_id." ORDER BY id desc LIMIT 10";
$db->setQuery( $query );
$projects = $db->loadObjectList();
$query = "select * FROM #__glance_bids where userid=".$lancer_id." order by id desc LIMIT 10 ";
$db->setQuery( $query );
$bids = $db->loadObjectList();

HTML_front_glance::showLancerInfo($option,$row,$projects,$bids,$username);

$is_lancer = isLancer($user->id); $is_buyer = isBuyer($user->id); $query = "select id FROM #__glance_lancer where userid =".$lancer_id; $db->setQuery( $query ); $id = $db->loadResult(); if(!$id) { echo "Freelancer not found!"; return; } $query = "select username FROM #__users where id =".$lancer_id; $db->setQuery( $query ); $username = $db->loadResult(); $row =& JTable::getInstance('lancer','Table'); $row->load($id); $query = "select * FROM #__glance_projects where chosen =".$lancer_id." ORDER BY id desc LIMIT 10"; $db->setQuery( $query ); $projects = $db->loadObjectList(); $query = "select * FROM #__glance_bids where userid=".$lancer_id." order by id desc LIMIT 10 "; $db->setQuery( $query ); $bids = $db->loadObjectList(); HTML_front_glance::showLancerInfo($option,$row,$projects,$bids,$username);

}

function showLancerInfo($option,$row,$projects,$bids,$username) { global $mainframe, $option; $user =& JFactory::getUser();


1 个答案:

答案 0 :(得分:1)

尝试在名为“tables”的组件中查找文件夹。找到正确的文件,它应该被称为“lancer”,在那里定义你想要的表的表变量并添加你想要显示的新变量 - 例如

...
var $website = null;
...

然后,您可以使用$ row->网站。

你在模型函数中寻找的线索是这一行:

$row =& JTable::getInstance('lancer','Table');

我希望能解决你的问题!祝你好运!