Programming

Folders and Files

Class & Controller

View

Form

Image

PDF

Chart

Database (Single table)

Database (Relational table)

Sort (Drag and Drop)

Image Upload/Display

File Upload/Download

CSV Upload/Download

Database ( How to retrieve data from database) - Filter

Database ( How to retrieve data from database) - Select

Image

How to display image?

First the images should be placed under images folder. Folder structure is shown below.

There are two ways to display an image on the view template

1) Set image name on res_image method.
2) Set image name on template file.

Set image name on res_image method

res_image method accepts three arguments.

1) First argument is directory name where images are located.
2) Second argument is image file name.
3) Third argument is class name.

The third argument is optional.

Following code sample shows how to set image name on res_image method

function image1(Controller $ctl){
$ctl->res_image("images", "image1.jpg");

}

Related template file source code is shown below.

<div class="photo">
<img src="app.php?class=employee&function=image1">
</div>

Set image name on template file

Template file source code is shown below.

<div class="photo">
<img src="app.php?class=employee&function=image2&file=image2.jpg">
</div>

Related class file source code with res_image function is shown below.

function image2(Controller $ctl){
$ctl->res_image("images", $ctl->GET("file"));

}

FOCUS Business Platform