I'm attempting to add a field into the breed creator in the admin panel where you can set a minimum and maximum height for that breed. However, it refuses to work, and the strange thing is that it did before. For a while it was working, and one day it stopped (and the code hadn't even been touched).
if ($game->buttonPressed('addBreed')) {
$_MESSAGES[] = $game->session('player')->addBreed(
$game->post('name'),
$game->post('species'),
$game->post('url'),
$game->post('info'),
$game->post('min_height'),
$game->post('max_height'),
$game->post('cross_one'),
$game->post('cross_two')
);
}
(breeds.php when the button is pressed)
<div class="form-row">
<div class="form-group col-md-6">
<label for="minheight">
' . __MIN_HEIGHT .':
</label>
<i class="' . __ICON_DEFAULT . '"></i>
<input
type="text"
name="min_height"
id="min_height"
class="form-control"
value="' . $breed->minHeight() . '" />
</div>
<div class="form-group col-md-6">
<label for="maxheight">
' . __MAX_HEIGHT .':
</label>
<i class="' . __ICON_DEFAULT . '"></i>
<input
type="text"
name="max_height"
id="max_height"
class="form-control"
value="' . $breed->maxHeight() . '" />
</div>
</div>
(HTML from the form in breeds.php)
public function add($name, $species, $url = null, $info = null, $min_height, $max_height, $cross_one = null, $cross_two = null)
{
echo "Min: {$min_height}, Max: {$max_height}";
//etc. rest of the code is here...
}
(add function in Breed.php)
The minimum and maximum height always return blank, and only those fields (please ignore the weird indentation, TGL makes it weird for some reason). The only way it works now is if min_height and max_height are hard-coded in the add function params, which of course isn't good for this case.
(Design1online was contacted about this btw, but wasn't able to give a working solution)
if ($game->buttonPressed('addBreed')) {
$_MESSAGES[] = $game->session('player')->addBreed(
$game->post('name'),
$game->post('species'),
$game->post('url'),
$game->post('info'),
$game->post('min_height'),
$game->post('max_height'),
$game->post('cross_one'),
$game->post('cross_two')
);
}
(breeds.php when the button is pressed)
<div class="form-row">
<div class="form-group col-md-6">
<label for="minheight">
' . __MIN_HEIGHT .':
</label>
<i class="' . __ICON_DEFAULT . '"></i>
<input
type="text"
name="min_height"
id="min_height"
class="form-control"
value="' . $breed->minHeight() . '" />
</div>
<div class="form-group col-md-6">
<label for="maxheight">
' . __MAX_HEIGHT .':
</label>
<i class="' . __ICON_DEFAULT . '"></i>
<input
type="text"
name="max_height"
id="max_height"
class="form-control"
value="' . $breed->maxHeight() . '" />
</div>
</div>
(HTML from the form in breeds.php)
public function add($name, $species, $url = null, $info = null, $min_height, $max_height, $cross_one = null, $cross_two = null)
{
echo "Min: {$min_height}, Max: {$max_height}";
//etc. rest of the code is here...
}
(add function in Breed.php)
The minimum and maximum height always return blank, and only those fields (please ignore the weird indentation, TGL makes it weird for some reason). The only way it works now is if min_height and max_height are hard-coded in the add function params, which of course isn't good for this case.
(Design1online was contacted about this btw, but wasn't able to give a working solution)