Art AboutFAQWrite for usContact InfoRSS Feed
Search A/R/T:

php|architect's Author Guide → Writing For php|architect

Writing For php|architect

Click to rate:    
55 votes / avg. rating 0.89%

Before deciding whether you want to write for us, you will probably want to know what kind of articles we're looking for.

We think of php|architect as the name behind the knowledge tools that PHP developers everywhere want to use. Note the complete absence of hyperbolae from the previous sentence—we're not being modest, but we prefer our work to do the hyping for us, and we apply the very same approach to the kind of content that we like to publish.

If you're thinking about an article (either for our magazine or for publication on A/R/T) or a book you'd like to write and you're wondering whether we will be interested in publishing it, ask yourself a simple question: will PHP developers be interested in it?

If the answer is yes, we want to hear from you. Don't think that, because an article covers an “easy” topic, we are not interested in it—most likely, if we think that the idea needs some work, we'll help you refine it into something that we think will ultimately result in a better product.

If you're thinking about writing for us, take a look at our writing opportunities page to see where your idea might fit best.

 Tags:  , , ,
 Add tag(s) (comma separated):
[Tags beta] — [Add New][Help]  

Tags Help

Tags are keywords associated with a web page that help classifying information. You can find a good explanation here.

To add one or more tags to this page, simply enter them below (separate them with a comma) and hit enter or click on the "Go" button.

New Comment
This form allows you to type in a new comment. Keep in mind the following:
  • The system accepts input in plain text format. Newlines will be converted to the HTML equivalent, and the system will try to catch most URLs and make them clickable.
  • Your e-mail address will never be displayed. We will use it only to notify you when new comments are posted to this page.
  • As a rule, we do not delete comments unless they are offensive, racist, spam or otherwise inappropriate.
  • Bold fields are required
Your Name:
Your e-mail:
Type this number:
Subject:
Comment:
Comments   New Comment
Re: Writing For php|architect (#607)
By ahamed udhuman zaheed on 2007-10-26 05:31:11



<b>Developing Desktop Applications in PHP for Beginners.</b>

Outline:<br/>

1. Introduction.<br/>
2. What is PHP-GTK?<br/>
3. Where to get?<br/>
4. How to test the Installation?<br/>
5. Steps for executing a sample code.<br/>
6. Some Interesting Websites on PHP-GTK.<br/>

<b>Introduction:</b>
We have been creating web-applications using PHP since it came into existence, Now we come to know that we can also develop Desktop or Stand alone Applications with PHP-GTK.Desktop Applications are one which does not need either Web Server like IIS,Apache,PWS etc. or web browsers for their execution. One of the reasons why Java is so popular is because it can be used to build applications, web pages, applets and beans that can run on several platforms including Windows, Linux and Solaris. Java runs a virtual machine called JVM, and code is compiled into an intermediate format known as Java byte code, which is platform independent. When that particular piece of code is executed within the JVM, the JVM optimizes the code for the particular platform on which it is running as it is being compiled.<br/><br/>

Microsoft's latest technology, .NET follows the same principles. Code is compiled into Microsoft Intermediate Language (MSIL) and is then executed within the .NET framework as an application domain. Microsoft is hoping to standardize C# and MSIL so that .NET code can run cross platform.<br/><br/>

So what has all of this got to do with PHP-GTK? Well, both Java and .NET can be used to build windowed applications and web pages. Thanks to PHP-GTK, we can now build cross platform windowed applications with PHP as well.<br/><br/>

<b>What is PHP-GTK? </b>
GTK is an acronym for the GIMP Toolkit and GIMP is an acronym for GNU Image Manipulation Program, and is a fully featured graphics editing program that runs on Linux. It has many (if not all) of the features of popular Windows programs such as Photoshop and Paint shop. It's the graphics editor of choice for most Linux users.

GTK is actually part of a set of libraries that was written in C called GTK . GTK was built up over time and is now a main part of Gnome, which is a Linux GUI desktop environment. GTK is based on an object-oriented nature and also includes two other libraries: <br/>
1. GLib: A library of tools that can be used to assist developers when creating applications with GTK . <br/>

2. GDK: Similar to GDI for Win32, GDK standard for GIMP drawing kit and wraps a set of lower level drawing functions into classes that make developing applications with GTK easier. If you're thinking along the lines of MFC for C then you're making a fair comparison: MFC wraps several controls and hides the calls to the underlying Windows API's from the developer. GDK does the same thing for GTK .<br/><br/>


<b>Where to get?</b>
We can download binary as well as source code version of PHP-GTK from <a> http://gtk.php.net/download.php </a>.Now the latest version is PHP-GTK2 .As a beginner, it would be a difficult process to download and install in this manner. Where we need to set up another php.ini file for PHP-GTK.Instead there is another way of installing it. We can get PHP-GTK2 in an executable form as we get WAMP.EXE (Windows Apache Mysql PHP).All we have to do is just download just download the files from <a> http://www.gnope.org/download.php</a> ,unzip them and double click on the icon GnopeSetup-1.5.1.exe . It will run through a step by step process where it will set up PHP-GTK automatically.<br/><br/>


<b>How to test the installation?</b>
Once the installation is done we would eager to know about what is special in it? When we install PHP we would run phpinfo () from root directory .For this let us run a sample script which displays Hello world (as usual) .we can use Dreamweaver for editing the code. Another important point to be kept in mind is to save the file with extension .phpw it can be saved anywhere on your Disk space.

<b>Here is the sample code,Put them within php tag as usual.</b><br/><br/>


<code>
if (!class_exists('gtk')) {
die("Please load the php-gtk2 module in your php.ini
");
}
$wnd = new GtkWindow();
$wnd->set_title('Hello world');
$wnd->connect_simple('destroy', array('gtk', 'main_quit'));
$lblHello = new GtkLabel("hello world");
$wnd->add($lblHello);
$wnd->show_all();
Gtk::main();

</code>


I have saved this sample file by name hello.phpw at c: est\. <br/>Weshould run this sample code from command line interface CLI nothing butCommand Prompt.There may be a question rising in your mind asking, why we should run through<br/> command prompt than by just by double clicking it as it is a stand alone application. It is possible, for that we need to have some PHP compiler which converts our PHP-GTK code to EXE file .Now let us try running it from console or Command Prompt.<br/><br/>


<b>Steps for Executing a sample code:</b><br/>
1. Start -> Run -> cmd (for xp sp2 and later version) or command (for windows 98).<br/><br/>

2. Now you could see a black window which is Command Prompt. Key in the following commands as shown below.
<pre>
z:>c:
c:> cd test
c: est>php hello.phpw
</pre>

Once we finish this line and hit the Enter key, we shall get the following as output.<br/>



Yes, this is what the expected output is. This shows the successful installation of
PHP-GTK2 .An output without a web-browser.<br/><br/>




<b>Some interesting Websites on PHP-GTK:</b><br/>
1. http://www.kksou.com/php-gtk2/<br/>
2. http://phpgtk.activeventure.com/gtk/gtk.gtkbox.html describes about all base classes).<br/>
3. http://gtk.php.net/download.php <br/>
4. http://www.gnope.org/download.php<br/>


<b>Conclusion:</b><br/>
Please leave for comments/feedbacks on this article, So that I can present better in future.Thank You.

[Reply to this]