phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


PHP N-tier: Building Presentation Logic

Tag: n-tier, multi-tier, application architecture, application design, presentation logic   Category: PHP Application
post: 15 Mar 2008 read: 122


PHP N-Tier Strategy Step By Step Tutorial - Part 6: After create business logic, now we try to catch the data. We called this: presentation logic layer. We still use nusoap to do this job.

Just for practice, we will create client same folder/location with server function. Create a file named "client_book.php" within www/test/ntier. Enter following code:


<?
require_once ('lib/nusoap.php');

$client = new soapclient('http://localhost/test/ntier/dataacces.php');

$response = $client->call('books');

if($client->fault)
{
  echo "FAULT: <p>Code: (".$client->faultcode.")</p>";
  echo "String: ".$client->faultstring;
}
else
{
  $r = $response[0];
  $count = count($r);
?>
  <table border="1">
    <tr>
      <th>Id</th>
      <th>Title</th>        
      <th>Author</th>
    </tr>
    <?
    for($i=0;$i<=$count-1;$i++){
	?>
    <tr>
      <td><?=$r[$i]['id']?></td>
      <td><?=$r[$i]['title']?></td>
      <td><?=$r[$i]['author']?></td>
    </tr>
    <?
	}
	?>
  </table>
    <?
}
?>

Now, open your browser and point to http://localhost/test/ntier/client_book.php. You should get like this:

webservice client



| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
CAPTCHA - part 3 : "Are you human or ....?" (Build Your CAPTCHA)

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting