UberLerd
Member
- Joined
- Dec 24, 2017
- Messages
- 29
- Solutions
- 1
- Reaction score
- 19
Hi everyone, here's a simple change to houses.php and house.php within Znote AAC v1.6. I wanted to list the house price as the price per SQM as noted in the config.php file, instead of the rent which is loaded from the houses.xml file from your world map.
I've noted what I've commented out and what's been added to make this change.
In houses.php change out the commented code as shown below.
This will change your houses.php from displaying Rent as shown below.
To displaying Price (per SQM) as shown below.
In house.php change out the commented code as shown below.
This will change your house.php from displaying Rent as shown below.
To displaying Price (per SQM) as shown below.
This was a simple change that took me far longer than I'm proud of. I hope it helps anyone who is looking to do the same.
I've noted what I've commented out and what's been added to make this change.
In houses.php change out the commented code as shown below.
PHP:
<table id="housetable">
<tr class="yellow">
<th>Name</th>
<th>Size</th>
<th>Beds</th>
<!-- commented out to change from rent to price per SQM -->
<!--<th>Rent</th>-->
<!-- added to change price from rent loaded fom houses.xml to price per SQM -->
<th>Price</th>
<th>Owner</th>
<th>Town</th>
</tr>
<?php
foreach ($houses as $house) {
if ($house['town_id'] == $townid) {
?>
<tr>
<td><?php echo "<a href='house.php?id=". $house['id'] ."'>". $house['name'] ."</a>"; ?></td>
<td><?php echo $house['size']; ?></td>
<td><?php echo $house['beds']; ?></td>
<!-- commented out to change from rent to price per SQM -->
<!--<td><?php echo $house['rent']; ?></td>-->
<!-- added to change price from rent loaded fom houses.xml to price per SQM -->
<td><?php echo $minbid = $config['houseConfig']['minimumBidSQM'] * $house['size']; ?></td>
<!-- end added code -->
<?php
// Status:
if ($house['owner'] != 0)
echo "<td><a href='characterprofile.php?name=". $house['ownername'] ."' target='_BLANK'>". $house['ownername'] ."</a></td>";
else
echo ($house['highest_bidder'] == 0 ? '<td>None</td>' : '<td><b>Selling</b></td>');
?>
<td><?php
$town_name = &$towns[$house['town_id']];
echo ($town_name ? $town_name : 'Specify town id ' . $house['town_id'] . ' name in config.php first.');
?></td>
</tr>
<?php
}
}
?>
</table>
This will change your houses.php from displaying Rent as shown below.
To displaying Price (per SQM) as shown below.
In house.php change out the commented code as shown below.
PHP:
<h1>House: <?php echo $house['name']; ?></h1>
<ul>
<li><b>Town</b>:
<?php
$town_name = &$config['towns'][$house['town_id']];
echo "<a href='houses.php?id=". $house['town_id'] ."'>". ($town_name ? $town_name : 'Specify town id ' . $house['town_id'] . ' name in config.php first.') ."</a>";
?></li>
<li><b>Size</b>: <?php echo $house['size']; ?></li>
<li><b>Beds</b>: <?php echo $house['beds']; ?></li>
<li><b>Owner</b>: <?php
if ($house['owner'] > 0) echo "<a href='characterprofile.php?name=". $house['ownername'] ."' target='_BLANK'>". $house['ownername'] ."</a>";
else echo "Available for auction.";
?></li>
<!-- commented out to change from rent to price per SQM -->
<!--<li><b>Rent</b>: <?php echo $house['rent']; ?></li>-->
<!-- added to change price from rent loaded fom houses.xml to price per SQM -->
<li><b>Price</b>: <?php echo $minbid = $config['houseConfig']['minimumBidSQM'] * $house['size']; ?></li>
<!-- end added code -->
<?php if ($house['owner'] == 0 && isset($house['points'])): ?>
<li><b>Shop points</b>: <?php echo $house['points']; ?></li>
<?php endif; ?>
</ul>
This will change your house.php from displaying Rent as shown below.
To displaying Price (per SQM) as shown below.
This was a simple change that took me far longer than I'm proud of. I hope it helps anyone who is looking to do the same.