0
컨트롤러에서 사용하기 :이 두 필드는 함수를 사용하여 업데이트됩니다어떻게 다른 사람의 사이에서이 두 필드를 정의, 줌라에 입력 페이지에서 데이터를 얻을 내가 줌라 XML을 가지고
<field
name="country_code"
type="sql"
default="10"
label="COM_TEAM_COUNTRY_CODE"
query="SELECT country_code, country FROM #__team_country"
key_field="country_code"
value_field="country"
/>
<field name="town"
type="text"
size="120"
class="inputbox span6"
label="COM_TEAM_FIELD_TOWN_LABEL"
description="COM_TEAM_FIELD_TOWN_DESC"
required="true" />
, 함께 나머지 :
<?php
defined('_JEXEC') or die;
class TeamControllerTeam extends JControllerForm
{
function saveAndSetCity()
{
parent::save();
$jinput = JFactory::getApplication()->input;
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Insert columns.
$columns = array('town', 'country_code');
$newCCode = $jinput->get('country_code','','');
// Insert values.
$values = array($db->quote('newTown'), $db->quote($newCCode));
// Prepare the insert query.
$query
->insert($db->quoteName('#__team_city'))
->columns($db->quoteName($columns))
->values(implode(',', $values));
// Set the query using our newly populated query object and execute it.
$db->setQuery($query);
$db->execute();
}
}
부모는 :: 표에 행 저장을 저장하지만 나뿐만 아니라 다른 테이블에서 특정 두 개의 필드를 저장하고 싶은, 내가 발견 한 코드는 잘 작동 적응 값을 얻을 수있는 메소드를 찾지 못해서 저장하고 싶은 실제 값을 얻는 것을 제외하고는 . 내가 만든 코드는 고정 리터럴 또는 공백 만 저장합니다. Jinput에 대한 Joomla 문서 페이지를 읽었지만 사용법을 이해하지 못했습니다.
종류의 regrads는 피터 Durup