Back to Top

Learn About AppML

Updated 26 December 2022

Today we are going to learn about AppML which stands for Application Modeling Language. With the help of AppML we can bring data to a html page without write any extra code like Javascript, Jquery etc. By download Appml or by using cdn (content delivery network) you can develop a html page. If you are a OpenCart extension developer then you can also use Appml easily to bring lots of data to your html data.

Controller –

<?php
class ControllerAccountAppml extends Controller {

	public function index() {
		
		$this->document->addScript('http://www.w3schools.com/appml/2.0.2/appml.js');
		
		$data['header'] = $this->load->controller('common/header');

		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/account.tpl')) {
			$this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/module/appml.tpl',$data));
		} else {
			$this->response->setOutput($this->load->view('default/template/module/appml.tpl',$data));
		}
	}

	public function appml(){

		$this->load->model('account/appml');
        
        $customer_details = $this->model_account_appml->appml();

		$this->response->addHeader('Content-Type: application/json');
		$this->response->setOutput(json_encode($customer_details));
	}
}

Model –

<?php
class ModelAccountAppml extends Model {

	public function appml(){

		$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "customer`");

		return $query;
	}

}
?>

View –

<?php echo $header; ?>
<div class="table-responsive">
  <table class="table table-bordered table-hover" appml-data="index.php?route=account/appml/appml">
    <thead>
       <tr>
         <td>Customer_id</td>
         <td>First Name</td>
         <td>Last Name</td>
         <td>Email Id</td>
       </tr>
    </thead>
    <tbody appml-repeat="rows">
        <td>{{customer_id}}</td>
        <td>{{firstname}}</td>
        <td>{{lastname}}</td>
        <td>{{email}}</td>
    </tbody>
  </table>
</div>

Result –

Searching for an experienced
Opencart Company ?
Find out More

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home