View Full Version : Core Field modification options?
directtech
07-25-2010, 03:46 AM
Using the kinabalu template, I have the address items set to show in one row. However, I'd like to change it to show in two rows like this:
Address
City, State ZIP
Where can I make this change in the code?
Also, I want to change the detail listing so it doesn't display the email address, but instead just gives a text link like "Click to Email". I can do this in the default template, but don't see it in the kinabalu template. Thanks.
dknight
07-26-2010, 07:31 PM
You can make the changes wrt to the address here:
/components/com_mtree/templates/kinabalu/sub_listingDetails#.tpl.php
where # is the listing details style you are using.
Re: E-mail
You can override the output by editing the field type class at MT's back-end:
Mosets Tree > Custom Fields > Manage field types > E-mail (core)
under PHP Class Code field.
directtech
07-27-2010, 05:13 AM
I see the email field management area... but I don't know what to put in the PHP field to replace the visible email address with just the word "Email". Please give a little more direction for that one.
Regarding the address display, I was already in that file, but don't see what to modify to move the address display into two lines. Also, need to remove the , comma that displays in between the state and the zip. Don't see anywhere in this file to modify that either.
These kinabalu template files are a lot different from the m2 template files. More direction would be much appreciated. Thanks.
dknight
07-28-2010, 10:03 PM
Re: E-mail
Use these codes for E-mail's PHP Class Code:
class mFieldType_coreemail extends mFieldType_email {
var $name = 'email';
function getOutput() {
$email = $this->getValue();
$html = '';
if(!empty($email)) {
$html .= '<script type="text/javascript"><!--' . "\n" . 'document.write(\'<a hr\'+\'ef="mai\'+\'lto\'+\':\'+\'';
for($i=0;$i<strlen($email);$i++) {
$html .= '%'.dechex(ord(substr($email,$i,1)));
}
$html .= '">';
$html .= 'Click to E-mail';
$html .= '<\/a>\');' . "\n" . '//--></script>';
}
return $html;
}
}
dknight
07-28-2010, 10:13 PM
Re: Address
Open up the listing details template file. Depending on the details style you are using, they maybe one of these:
/components/com_mtree/templates/kinabalu/sub_listingDetails.tpl.php
/components/com_mtree/templates/kinabalu/sub_listingDetailsStyle2.tpl.php
/components/com_mtree/templates/kinabalu/sub_listingDetailsStyle3.tpl.php
/components/com_mtree/templates/kinabalu/sub_listingDetailsStyle4.tpl.php
/components/com_mtree/templates/kinabalu/sub_listingDetailsStyle5.tpl.php
/components/com_mtree/templates/kinabalu/sub_listingDetailsStyle6.tpl.php
/components/com_mtree/templates/kinabalu/sub_listingDetailsStyle7.tpl.php
near line 31 - 44
Replace these codes:
if( $this->config->getTemParam('displayAddressInOneRow','1') ) {
$this->fields->resetPointer();
$address_parts = array();
$address_displayed = false;
while( $this->fields->hasNext() ) {
$field = $this->fields->getField();
$output = $field->getOutput(1);
if(in_array($field->getId(),array(4,5,6,7,8)) && !empty($output)) {
$address_parts[] = $output;
}
$this->fields->next();
}
if( count($address_parts) > 0 ) { $address = implode(', ',$address_parts); }
}
with the following codes:
if( $this->config->getTemParam('displayAddressInOneRow','1') ) {
$this->fields->resetPointer();
$address_parts = array();
$address_displayed = false;
while( $this->fields->hasNext() ) {
$field = $this->fields->getField();
$output = $field->getOutput(1);
if(in_array($field->getId(),array(4,5,6,7,8)) && !empty($output)) {
if($field->getId() == 4) {
$address .= $output . '<br />';
} elseif(in_array($field->getId(),array(5,8))) {
$address .= ' '.$output;
} else {
$address .= ', '.$output;
}
}
$this->fields->next();
}
}
vBulletin® v3.8.6, Copyright ©2000-2023, Jelsoft Enterprises Ltd.