sábado, 19 de maio de 2007

BUILD DYNAMIC CODE ON PHP-GTK

Somethimes when we need to build a great number of php -gtk object can be a hard work if we are programming all the code by hand.
Work with coordinates and object positions can simplify the work and save time on development process.
On ther next code snnipet i will tech you how to generate dynamic button using coordinates process.
Follows the code

The result of code


Hope it´s useful

sexta-feira, 11 de maio de 2007

Splash screens with PHP-GTK

Splash screen is a term used to describe an image that appears while a computer program is loading. Splash screens often don't cover the entire screen, but only a rectangle near the center. The splash screens of operating systems and some applications that expect to be run full-screen usually cover the entire screen [WIKI]
On this article we will learn how to build splash screens using PHP5.2-GTK2

Generally we start build the spalsh thinking on a image, that you must to choose before.
The image used on my class is on the format *.png .

The splash class uses the gtk class - GTKImage to load the image file, and the widget is added to an vbox container, but you can add it to gtkwidow instead.
... follows the class splash


Right nest we will build a new class test to check the result of class splash builded above
Follows the code

The image next was used as splash screen on the code chunk







quinta-feira, 10 de maio de 2007

FREE PHP RESOURCES

PHP Classes is a world wide repository to all PHP programmers may publish their scripts freely.



On this web site you have free classes related to all programming domains, since database hadling, xml parsing , dom, soap and lots of resources more.
This communitary web site was created by Manuel Lemos , a portuguese programmer and the currently site administrator.
I decide to annouce this site, because i also have my classes published there.
Last year one of those classes was rewarded by the award "PHP CLASSES INOVATION AWARD".
All the classes are free to use since you respect the lisence writed by the author on each package.
This is great to study others programmers code , and check how some programming steps are done, when you didn´t get idea how it works.
You can just use it, and save some of your precious time .

Distribuite PHP-GTK applications on Windows or Linux

Software distibution can raise some important questions.
Did your software has something to offer that can be used by a great group of users?
Did you tested it and allowed others to test them?
What is user´s opinion about your software possibilities ?
Did your code is your own creation, and it has nothing that could raise doubts?
This questions and a few more,can be the answer to decide if we can or can´t distribute our application
at this time.
A good practical is to create discussions on forum or discussion lists, by adding some screenshots of the sofware
and ask for users opinion.
You should face all opinions on a constructive way.Experimented users generally have reason when they manifest their opinions about it.
The main subject of this article is to help PHP-GTK developers or programmers to
teach and illuminate them when comes the hour to distribute the applications written with PHP-GTK.
To simplify this task, we will need to compile all php source code to it stand alone, by generating native binaries whitch do not require an interpreter.
All this process is done by using others softwstes knowed as compilers.
Linux users have lucky on this area. The best PHP compilers are available to Linux and Unix platforms.

" Roadsend Compiler is an open source, native compiler for the PHP language. It compiles PHP source code to stand alone, native binaries which do not require an interpreter. Roadsend Compiler can build online web applications with Fast/CGI, offline web applications with an embedded web server (MicroServer), desktop GUI applications with PHP-GTK, and console applications. It is known to build on Linux, Windows (using mingw), and FreeBSD "
[roadsend compiler]

To download this software you will need to register first



PriadoBlender is another compiler avaliable to windows and linux
"
PriadoBlender is a tool to let you distribute your PHP scripts as an executable EXEs. It is similar to the PHPCompiler that was available for a couple of months a year or 2 ago. PriadoBlender isn't a true compiler in the computer science sense of the term. True compilers take the high-level code and turn it into machine/assembly code. Instead, PriadoBlender takes your PHP code and the PHP interpretor itself and blends them into standalone, PHP executable goodness."



Download PriadoBlender

Automatizing HTML widgets on PHP [Using PHP_SELF]

Build all HTML stuff by hand is a pretty hard work.
Coding all this stuff , like buttons, forms, divs and allover html widgets, can be a pleasant work if you find ways to optimize and reduce time of coding.
A simple way to do that is to develop some PHP api that allows to generate all forms and all HTML widgets that you need.
After it is just call the class target and pass to it some parameters like bg colors, alignment, size...
On this article i will not do all the job to you but i will show how html can be embbed , developing a plain code snnipet, where u can study how process is done.
Here´s the result of this code snnipet




sexta-feira, 4 de maio de 2007

Woking with GtkTreeModel and GtkTreeStore

On this article you will learn how to create a PHP-GTK model to place your informations stored on database ,files, or in another data repository systems .

The technique is to use some specific widgts, allowing the system to work right.

I will make all this stuff using OOP on PHP5-GTK2 dev. based, so if you don´t know nothing about classes or object oriented programming, i recomend you to read a few thing about it (there´s enought documentation about it on Internet, use google and search 4 "php oop" , it will show a large list of related web sites).
I personally recommed you this :
http://www.phpfreaks.com/tutorial_cat/19/Object-Oriented-Programming.php

On first snippet i will dev. an basic example by using the widgets ,GtkListStore ,GtkTreeView and GtkRenderText.

Here´s the inheritance diagram used for this aplication





To make work go faster i will build a generic class to create the windows, using the inheritance GtkWindow and GtkVBox used as container




Save this file above as "class_window.inc"

and write the next class and check how the process to build the list was made.









Result of this code:





Example as shown on my book "PHP5-GTK2 - Criação de aplicações com interfáce gráfica"
























PHP-GTK CONTEST


The PHPThrowdown is a competition to see which team or individual can build the best application in 24 hours. Its a test of skill and stamina. Most people expect to see a whole bunch of web applications, but we here in the PHP-GTK community know that the best applications are written with PHP-GTK. To help prove this point to the rest of the world, a few teams are being organized to enter PHP-GTK applications into the contest. If you are interested in joining (or leading) a team, be sure to sign up on the PHP-GTK PHPThrowdown Team organization form.

For more information visit the web site http://www.opsat.net/ptd/interestapp.php

Information gently supplied by php gtk group