Help define default array values

Hello,

In the following function, I want to define default values for ‘i18n’. I believe it is an array, it shows in another file defined as:

public $i18n = array('title', 'description', 'terms', 'confirm_tokens', 'confirm_subject',
	'payment_tokens', 'payment_subject', 'meta_title', 'meta_keywords', 'meta_description');

So I would need to set default values of i18n to ‘text1’, ‘text 2’, ‘text 3’, … in the function below.

Could you help?

Thanks,
John

[php]
$this->checkLogin();

	if ($this->isAdmin() || $this->isEditor() || $this->isOwner())
	{
		if (isset($_POST['listing_create']))
		{
			$data = array();
			if (isset($_POST['expire']))
			{
				$data['expire'] = pjUtil::formatDate($_POST['expire'], $this->option_arr['o_date_format']);
			}
			$data['last_extend'] = 'free';
			if ($this->isOwner())
			{
				$data['owner_id'] = $this->getUserId();
				$data['status'] = 'E';
				$data['is_featured'] = 'F';
				$data['expire'] = date("Y-m-d", strtotime("-1 day"));
			}
			$data = array_merge($_POST, $data);
			$pjListingModel = pjListingModel::factory();
			if (!$pjListingModel->validates($data))
			{
				pjUtil::redirect($_SERVER['PHP_SELF'] . "?controller=pjAdminListings&action=pjActionCreate&err=1");
			}
			
			if ($pjListingModel->where('t1.listing_refid', $data['listing_refid'])->findCount()->getData() > 0)
			{
				pjUtil::redirect($_SERVER['PHP_SELF'] . "?controller=pjAdminListings&action=pjActionCreate&err=1");
			}
			
			//$data = pjSanitize::clean($data);
			$id = $pjListingModel->reset()->setAttributes($data)->insert()->getInsertId();
			if ($id !== false && (int) $id > 0)
			{
				$err = 'AC03';
				if (isset($_POST['i18n']))
				{
					pjMultiLangModel::factory()->saveMultiLang($_POST['i18n'], $id, 'pjListing');
				}
				$this->notify(2, NULL, array('property_id' => $id, 'listing_refid' => $data['listing_refid']));
			} else {
				$err = 'AC04';
			}
			
			if ($id !== false && (int) $id > 0)
			{
				pjUtil::redirect($_SERVER['PHP_SELF'] . "?controller=pjAdminListings&action=pjActionUpdate&id=" . $id);
			} else {
				pjUtil::redirect($_SERVER['PHP_SELF'] . "?controller=pjAdminListings&action=pjActionCreate&err=1");
			}
		}
		
		if ($this->isOwner())
		{
			$this->set('period_arr', pjPeriodModel::factory()->orderBy('t1.days ASC')->findAll()->getData());
		}

		$type_arr = pjTypeModel::factory()->select('t1.*, t2.content AS name')
			->join('pjMultiLang', "t2.model='pjType' AND t2.foreign_id=t1.id AND t2.field='name' AND t2.locale='".$this->getLocaleId()."'")
			->where('t1.status', 'T')->orderBy('name ASC')->findAll()->getData();
		$this->set('type_arr', pjSanitize::clean($type_arr));

		$user_arr = pjUserModel::factory()->orderBy('t1.name ASC')->findAll()->getData();
		$this->set('user_arr', pjSanitize::clean($user_arr));
			
		$this->appendJs('chosen.jquery.js', PJ_THIRD_PARTY_PATH . 'harvest/chosen/');
		$this->appendCss('chosen.css', PJ_THIRD_PARTY_PATH . 'harvest/chosen/');
			
		$this->appendJs('jquery.tipsy.js', PJ_THIRD_PARTY_PATH . 'tipsy/');
		$this->appendCss('jquery.tipsy.css', PJ_THIRD_PARTY_PATH . 'tipsy/');
			
		$this->appendJs('jquery.validate.min.js', PJ_THIRD_PARTY_PATH . 'validate/');
		$this->appendJs('pjAdminListings.js');
	} else {
		$this->set('status', 2);
	}

[/php]

It looks like it’s an array of SEO terms.

Are you wanting to define values of each of the terms? You would have to structure it differently then.

Sounds like you want to do something like this…

[php]$i18n = array(
“title” => “This is the title Text”,
“description” => “This is my description”,
“terms” => “These are my terms”
);

echo $i18n[‘title’];
echo $i18n[‘description’];
echo $i18n[‘terms’];
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service