I am working on a PHP program that I took over from another person. This is part of a code in the program that makes the field editable:
<td class='none'>
<?php
if($repair[0]['description'] == "")
{
echo "<input class='width' id='description' value=\"" . $repair[0]['description'] . "\">";
}
else
{
?>
<div id='descriptionDiv'>
<a href="javascript:changeDiv('descriptionDiv', 'descriptionDiv2')" title='klik om te wijzigen' class='edit'><?php echo $repair[0]['description']; ?></a>
</div>
<div id='descriptionDiv2' style='display=none'>
<input class='width' id='description' value="<?php echo $repair[0]['description']; ?>">
</div>
<?php
}
?>
</td>
To understand this much better, look at the image:
The blue fields are editable.
There is a file with *.tpl extension and I have a view.php file with the following code:
<?php
public function renderShowInspectionDocument()
{
setLastPage();
$dochtml = '';
//Verwijder alles totdat je een '/' tegenkomt (begin rechts). Hiermee verwijder je eventueel de 'index.php' in de url.
$url = str_replace(end(explode('/', $_SERVER['SOMETHING'])), '', $_SERVER['SOMETHING']);
//Template
$template = file_get_contents('templates/inspectionDetails.tpl');
if(isset($this->data['SJB']))
{
$SJB = $this->data['SJB'];
$dochtml .= '<tr>';
$dochtml .= '<td class="label">Inspecton:</td>';
$dochtml .= '<td><div style="width:420px; font-weight:normal; border-left:1px solid black; border-bottom:1px solid black; padding:5px;">'. nl2br($SJB['inspection_requirement']) .'</div></td>';
$dochtml .= '</tr>';
$dochtml .= '<tr>';
$dochtml .= '<td class="label">Inspection-Tools:</td>';
$dochtml .= '<td><div style="width:420px; font-weight:normal; border-left:1px solid black; border-bottom:1px solid black; padding:5px;">'. nl2br($SJB['inspection_resources']) .'</div></td>';
$dochtml .= '</tr>';
if(isset($SJB['extra_document']) && !empty($SJB['extra_document']))
{
$dochtml .= '<tr>';
$dochtml .= '<td class="label">Extra document:</td>';
$dochtml .= '<td><a target="_blank" href="'. $url .'uploads/SJB/'. urlencode($SJB['extra_document']) .'">'. $SJB['extra_document'] .'</a></td>';
$dochtml .= '</tr>';
}
$dochtml .= '<tr><td> </td></tr>';
}
?>
and the .tpl has:
<div class="navigation" id="navigationDiv">
</div>
<style type="text/css">
table td {
border: none;
}
</style>
<table class="clean">
{data}
<tr style="display:{display};">
<td class="label">Special:</td>
<td>{notices}</td>
</tr>
</table>
{back}
I want to be able to make those fields also editable but I need help with that maybe someone can help?
FOR SOME REASON THE IMAGES ARE NOT LOADING!!