PEAR. PHP Extension and Application Repository. Mocsnik Norbert Harmadik Magyarországi PHP Konferencia 2005. március 12., Budapest



Similar documents
Script Handbook for Interactive Scientific Website Building

CS412 Interactive Lab Creating a Simple Web Form

Working with forms in PHP

HTML Tables. IT 3203 Introduction to Web Development

Chapter 22 How to send and access other web sites

Intell-a-Keeper Reporting System Technical Programming Guide. Tracking your Bookings without going Nuts!

JavaScript and Dreamweaver Examples

c. Write a JavaScript statement to print out as an alert box the value of the third Radio button (whether or not selected) in the second form.

Web Programming with PHP 5. The right tool for the right job.

Sample HP OO Web Application

HTML Forms and CONTROLS

2- Forms and JavaScript Course: Developing web- based applica<ons

Motivation retaining redisplaying

Fortigate SSL VPN 4 With PINsafe Installation Notes

Internet Technologies

By : Ashish Modi. CRUD USING PHP (Create, Read, Update and Delete on Database) Create Database and Table using following Sql Syntax.

<script type="text/javascript"> var _gaq = _gaq []; _gaq.push(['_setaccount', 'UA ']); _gaq.push(['_trackpageview']);

Fortigate SSL VPN 3.x With PINsafe Installation Notes

Web Development 1 A4 Project Description Web Architecture

Configuring iplanet 6.0 Web Server For SSL and non-ssl Redirect

Part II of The Pattern to Good ILE. with RPG IV. Scott Klement

About webpage creation

A table is a collection of related data entries and it consists of columns and rows.

PHP Authentication Schemes

Dynamic Web-Enabled Data Collection

Hello World RESTful web service tutorial

Introduction to Web Design Curriculum Sample

Guide to Integrate ADSelfService Plus with Outlook Web App

Multimedia im Netz Online Multimedia Winter semester 2015/16. Tutorial 03 Major Subject

Chapter 2: Interactive Web Applications

Installation and Integration Manual TRANZILA Secure 5

JavaScript Basics & HTML DOM. Sang Shin Java Technology Architect Sun Microsystems, Inc. sang.shin@sun.com

WEB DESIGN LAB PART- A HTML LABORATORY MANUAL FOR 3 RD SEM IS AND CS ( )

Real SQL Programming 1

Direct Post Method (DPM) Developer Guide

Cisco Adaptive Security Appliance (ASA) Web VPN Portal Customization: Solution Brief

WHITEPAPER. Skinning Guide. Let s chat Velaro info@velaro.com by Velaro

Online Multimedia Winter semester 2015/16

HOTEL RESERVATION SYSTEM. Database Management System Project

Introduction to XHTML. 2010, Robert K. Moniot 1

İNTERNET TABANLI PROGRAMLAMA- 13.ders GRIDVIEW, DETAILSVIEW, ACCESSDATASOURCE NESNELERİ İLE BİLGİ GÖRÜNTÜLEME

Novell Identity Manager

Further web design: HTML forms

Caldes CM12: Content Management Software Introduction v1.9

<?php if (Login::isLogged(Login::$_login_front)) { Helper::redirect(Login::$_dashboard_front); }

Client-side Web Engineering From HTML to AJAX

FORM-ORIENTED DATA ENTRY

Server-side scripting with PHP4

Now that we have discussed some PHP background

Secure Application Development with the Zend Framework

Cover Page. Dynamic Server Pages Guide 10g Release 3 ( ) March 2007

Contents. 2 Alfresco API Version 1.0

How to Create a Mobile Responsive Template in ExactTarget

Create Your own Company s Design Theme

PHP Tutorial From beginner to master

JavaScript: Arrays Pearson Education, Inc. All rights reserved.

Implementing Specialized Data Capture Applications with InVision Development Tools (Part 2)

07 Forms. 1 About Forms. 2 The FORM Tag. 1.1 Form Handlers

Web Server Lite. Web Server Software User s Manual

Web Design Basics. Cindy Royal, Ph.D. Associate Professor Texas State University

Web Development and Core Java Lab Manual V th Semester

Configuring IBM WebSphere Application Server 7.0 for Web Authentication with SAS 9.3 Web Applications

An Introduction to Developing ez Publish Extensions

HTML Form Widgets. Review: HTML Forms. Review: CGI Programs

PHP Framework Performance for Web Development Between Codeigniter and CakePHP

How to Display Weather Data on a Web Page

Web application development (part 2) Netzprogrammierung (Algorithmen und Programmierung V)

SQL Injection for newbie

The Basics of Dynamic SAS/IntrNet Applications Roderick A. Rose, Jordan Institute for Families, School of Social Work, UNC-Chapel Hill

Java Server Pages and Java Beans

Accessibility in e-learning. Accessible Content Authoring Practices

ICT 6012: Web Programming

Installation & Configuration Guide Version 2.2

Stata web services: Toward Stata-based healthcare informatics applications integrated

How to Make a Working Contact Form for your Website in Dreamweaver CS3

Website Planning Checklist

SEEM4540 Open Systems for E-Commerce Lecture 06 Online Payment

PHP Form Handling. Prof. Jim Whitehead CMPS 183 Spring 2006 May 3, 2006

Using Form Tools (admin)

Thursday, February 7, DOM via PHP

Website Login Integration

Mantis Bug Tracker Developers Guide

Tutorial: Using PHP, SOAP and WSDL Technology to access a public web service.

Forms, CGI Objectives. HTML forms. Form example. Form example...

Lab 5 Introduction to Java Scripts

Advanced Web Design. Zac Van Note.

NGASI AppServer Manager SaaS/ASP Hosting Automation for Cloud Computing Administrator and User Guide

Understanding Cross Site Scripting

Yandex.Widgets Quick start

ABSTRACT INTRODUCTION %CODE MACRO DEFINITION

Dynamic Web Pages With The Embedded Web Server. The Rabbit-Geek s AJAX Workbook

Transcription:

PEAR PHP Extension and Application Repository Mocsnik Norbert Harmadik Magyarországi PHP Konferencia 2005. március 12., Budapest

HTML_Template_IT <html> <table border> <!-- BEGIN row --> <tr> <!-- BEGIN cell --> <td> {DATA} </td> <!-- END cell --> </tr> <!-- END row --> </table> </html>

HTML_Template_IT $data = array ( '0' => array('stig', 'Bakken'), '1' => array('martin', 'Jansen'), '2' => array('alexander', 'Merz') ); require_once 'HTML/Template/IT.php'; $tpl = new HTML_Template_IT ('./templates'); $tpl->loadtemplatefile('main.tpl.htm', true, true);

HTML_Template_IT foreach($data as $name) { foreach($name as $cell) { $tpl->setcurrentblock('cell') ; $tpl->setvariable('data', $cell) ; $tpl->parse('cell') ; } } $tpl->show(); // vagy: $st = $tpl->get();

HTML_Template_Flexy <html> <head> <title>{title}</title> </head> <body> <H1>{title}</H1> <form name="form"> <table> <tr> <td> Input Box: <input name="input"> </td>

HTML_Template_Flexy <tr flexy:foreach="numbers,number,string"> <td> <a href="mypage.html?id={number}"> {string} </a> </td> </tr> </table> this is number 2 : {numbers[2]} This is a {anobject.member} {somemethod()} {somemethod():h} <!-- prevent --> </body> </html>

DB_DataObject $options = &PEAR::getStaticProperty ('DB_DataObject', 'options'); $options = array( 'database' => 'mysql://user:password@localhost/database', 'schema_location' => '/home/peartest/dataobjects', 'class_location' => '/home/peartest/dataobjects', 'require_prefix' 'class_prefix' => 'DataObjects/', => 'DataObjects_',

DB_DataObject class DataObjects_Cat extends DB_DataObject { ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */ var $ table = 'cat'; var $id; var $nev; [..] ###END_AUTOCODE }?>

DB_DataObject + Validate function validateemail() { return Validate::email($this->email, true); } function validatehomepage() { return Validate::uri($this- >homepage, true); }

DB_DataObject <?php $person = DB_DataObject::factory ('person'); $person->get(12); echo $person->name; print_r($person);?>

DB_DataObject <?php $person = DB_DataObject::factory ('person'); $person->eyecolor = 'red'; $person->has_glasses = 1; $number_of_rows = $person->find(); while ($person->fetch()) { echo $person->name. '<BR>'; }?>

DB_DataObject <?php $person = DB_DataObject::factory ('person'); $person->get(12); $person->name = 'fred'; $person->update();?>

DB_DataObject <?php $person = DB_DataObject::factory ('person'); $person->get(12); $original = $person; // clone or copy $person->name = 'fred'; $person->update($original);?>

DB_DataObject <?php $person = DB_DataObject::factory ('person'); $person->removed = 1; $person->whereadd('age > 21'); $person->update();?>

DB_DataObject dbname.links.ini [person] eyecolor = colors:name picture = attachments:id

DB_DataObject <?php $person = new DataObjects_Person; $person->find(); while ($person->fetch()) { $person->getlinks(); echo "{$person->name} has {$person->eyecolor} eyes (RGB: {$person->_eyecolor->rgb})"; }?>

HTTP_Upload <html><body> <form action="send.php" method="post" enctype="multipart/form-data"> Send these files:<br> <input type="hidden" name="max_file_size" value="100000"> <input name="userfile" type="file"><br> <input type="submit" value="send file"> </form> </body></html>

HTTP_Upload <?php require 'HTTP/Upload.php'; $upload = new HTTP_Upload('hu'); $file = $upload->getfiles('userfile'); if (PEAR::isError($file)) { die ($file->getmessage()); }

HTTP_Upload if ($file->isvalid()) { $file->setname('uniq'); $dest_dir = './uploads/'; $dest_name = $file->moveto($dest_dir); if (PEAR::isError($dest_name)) { die ($dest_name->getmessage()); } $real = $file->getprop('real'); echo "{$real->$dest_name} in {$dest_dir}"; } elseif ($file->ismissing()) { echo "No file selected"; } elseif ($file->iserror()) { echo $file->errormsg(); }

Image_Transform <?php require_once 'Image/Transform.php'; $image = Image_Transform::factory('GD'); $image->load('./uploads/full/test.jpg'); $image->scale(250); $image->addtext( array('text' => '(c) your name')); $image->save('./uploads/thumbs/test.jpg'); $image->free();?>

Mail_Mime $text = 'Text version of email'; $html = '<html><body>html version</body></html>'; $file = '/home/peartest/example.php'; $img = '/home/peartest/test.png'; $hdrs = array( 'From' => 'you@yourdomain.com', 'Subject' => 'Test mime message' );

Mail_Mime require_once 'Mail/mime.php'; $mime = new Mail_mime; $mime->settxtbody($text); $mime->sethtmlbody($html); $mime->addattachment($file, 'text/plain'); $mime->addattachment($img); $body = $mime->get(); $hdrs = $mime->headers($hdrs);

Mail require_once 'Mail.php'; $mail =& Mail::factory('mail'); $mail->send('example@example.com', $hdrs, $body);

Mail_Queue $db_options['type'] = 'db'; $db_options['dsn'] = 'mysql://user:password@host/database'; $db_options['mail_table'] = 'mail_queue'; $mail_options['driver'] = 'smtp'; $mail_options['host'] = 'your_server_smtp.com'; $mail_options['port'] = 25; $mail_options['auth'] = false; $mail_options['username'] = ''; $mail_options['password'] = '';

Mail_Queue require_once 'base.php'; require_once 'Mail/Queue.php'; $mail_queue =& new Mail_Queue( $db_options, $mail_options); $from = 'Chief <user@server.com>'; $to = "admin <user2@server.com>"; [.. Mail_MIME $hdrs, $body..] $mail_queue->put( $from, $to, $hdrs, $body );

Mail_Queue require_once 'base.php'; require_once 'Mail/Queue.php'; $max = 50; $mail_queue =& new Mail_Queue( $db_options, $mail_options); $mail_queue->sendmailsinqueue( $max);

Auth require_once 'Auth/Auth.php'; function loginfunction() { echo '<form method="post" action="index.php">'; echo '<input type="text" name="username">'; echo '<input type="password" name="password">'; echo '<input type="submit">'; echo '</form>'; }

Auth $dsn = "mysql://user:password@localhost/db"; $a = new Auth( "DB", $dsn, "loginfunction"); $a->start(); if ($a->getauth()) { /** * site output */ }

Auth_PrefManager require_once 'Auth/PrefManager.php'; $options = array( 'table' => 'user_prefs'); $prefs = new Auth_PrefManager( $dsn, $options); $prefs->setdefaultvalue( 'fullname', 'New User'); $prefs->setvalue( 'john', 'fullname', 'Jon Wood');

Auth_PrefManager require_once 'Auth/PrefManager.php'; $jonname = $prefs->getpref('john', 'fullname'); $billname = $prefs->getpref('bill', ''); echo "John neve $jonname"; echo "Bill neve $billname";

Log require_once 'Log.php'; $console = &Log::factory('console', '', 'TEST'); $console->log('logging to the console.'); $file = &Log::factory('file', 'out.log', 'TEST'); $file->log('logging to out.log.');

Log Log_composite Log_mcal Log_console Log_null Log_display Log_sql Log_error_log Log_sqlite Log_file Log_syslog Log_mail Log_win

Ajánlott csomagok Benchmark HTML_QuickForm Cache_Lite DBDO_FormBuilder Config PEAR_ErrorStack Calendar, Date Services_Google HTML_Form DB_Pager HTML_TreeMenu

PEAR-re épülő projektek Keretrendszerek The Seagull Project http://seagull.phpkitchen.com/

Támogatás Kézikönyv, magyar nyelven is http://pear.php.net/manual/hu/ Felhasználói lista: pear-general@lists.php.net Fejlesztői listák: pear-dev, pear-doc, pear-qa, pear-core@lists.php.net EFNet, #PEAR csatorna http://pear.php.net/support.php

Linkek http://pear.php.net http://www.phpkitchen.com (tutorials) http://norbert.mocsnik.hu norbert@mocsnik.hu Kérdések?