alin19 (User)
Fresh Boarder
Posts: 11
|
|
Class 'GtkHTML' not found 1 Month, 2 Weeks ago
|
Karma: 0
|
hello guys!
first of all this is a great page with so many examples!
i've started to test the codes that i found here and i'm geting an error, how can i add that class to my code?
if you can help me
this the error i'm geting:
Fatal error: Class 'GtkHTML' not found in C:\Documents and Settings\user\Desktop
\sibex\sibex\sibfeed_31\extra\test.php on line 22
| Code: |
<?php
$window = new GtkWindow();
$window->set_title($argv[0]);
$window->set_size_request(800, 640);
$window->connect_simple('destroy', array('Gtk','main_quit'));
$window->add($vbox = new GtkVBox());
// define toolbar definition
$toolbar_definition = array('Zoom_In', 'Zoom_Out', 'Zoom_100');
setup_toolbar($vbox, $toolbar_definition); // note 1
$hbox = new GtkHBox();
$vbox->pack_start($hbox, 0);
$hbox->pack_start($url_entry = new GtkEntry('http://gtk.php.net/'));
$hbox->pack_start($go_button = new GtkButton('Go'), 0);
$go_button->set_size_request(32, -1);
$scrolled_win = new GtkScrolledWindow();
$scrolled_win->set_policy( Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC);
$vbox->pack_start($scrolled_win);
$gtkhtml = new GtkHTML();
$scrolled_win->add($gtkhtml);
$gtkhtml->connect('url-requested', 'on_url_requested');
$gtkhtml->connect('link-clicked', 'on_link_clicked');
$url_entry->connect('activate', 'on_url_entry_activate', $go_button);
$go_button->connect('clicked', 'on_go_button', $url_entry, $gtkhtml);
$go_button->clicked();
$window->show_all();
Gtk::main();
function on_url_entry_activate($entry, $go_button) {
$go_button->clicked();
}
function on_go_button($button, $url_entry, $gtkhtml) {
$url = $url_entry->get_text();
$html_text = file_get_contents($url);
$gtkhtml->set_base($url);
$gtkhtml->load_from_string($html_text);
}
function on_url_requested($gtkhtml, $url, $stream) {
echo "image url = $url\n";
// load the image
}
function on_link_clicked($gtkhtml, $url) {
global $url_entry, $go_button;
$url_entry->set_text($url);
$go_button->clicked();
}
// setup toolbar
function setup_toolbar($container, $toolbar_definition) {
$toolbar = new GtkToolBar();
foreach($toolbar_definition as $item) {
if ($item=='<hr>') {
$toolbar->insert(new GtkSeparatorToolItem(), -1);
} else {
$stock_image_name = 'Gtk::STOCK_'.strtoupper($item);
if (defined($stock_image_name)) {
$toolbar_item = GtkToolButton::new_from_stock(
constant($stock_image_name));
$toolbar->insert($toolbar_item, -1);
$toolbar_item->connect('clicked',
'on_toolbar_button', $item);
}
}
}
$container->pack_start($toolbar, 0);
}
// process toolbar
function on_toolbar_button($button, $item) {
echo "toolbar clicked: $item\n";
global $gtkhtml;
switch($item) {
case 'Zoom_In': $gtkhtml->zoom_in(); break; // note 2
case 'Zoom_Out': $gtkhtml->zoom_out(); break; // note 3
case 'Zoom_100': $gtkhtml->zoom_reset(); // note 4
}
}
?>
|
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
kksou (Admin)
Admin
Posts: 391
|
|
Re:Class 'GtkHTML' not found 1 Month, 2 Weeks ago
|
Karma: 8
|
Hi,
The error message means that your GtkHTML library is not loaded.
Please take a look at the following post:
It doesn't fit together - GladeXML
Follow the instructions there to set up GtkHTML.
Let me know if you bump into any problems.
Regards,
/kksou
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
alin19 (User)
Fresh Boarder
Posts: 11
|
|
Re:Class 'GtkHTML' not found 1 Month, 2 Weeks ago
|
Karma: 0
|
|
hello, sory but i'm still geting some errors,
C:\Documents and Settings\user\Desktop\php-gtk2_with-gtkhtml\php-gtk2>.\gconfd-2
.exe|.\php gtkhtml_sample1.php
PHP Warning: PHP Startup: mysql: Unable to initialize module
Module compiled with module API=20060613, debug=0, thread-safety=1
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: sockets: Unable to initialize module
Module compiled with module API=20060613, debug=0, thread-safety=1
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Fatal error: Class 'GtkWindow' not found in C:\Documents and Settings\user\
Desktop\php-gtk2_with-gtkhtml\php-gtk2\gtkhtml_sample1.php on line 2
Fatal error: Class 'GtkWindow' not found in C:\Documents and Settings\user\Deskt
op\php-gtk2_with-gtkhtml\php-gtk2\gtkhtml_sample1.php on line 2
i've used what you have sayd here, except this is not a fresh win xp
I've just grabbed hold of another clean PC with a fresh install of winxp and did another round of thorough testing.
1) Download this zip file:
php-gtk2_with-gtkhtml.zip
Note that this is a zip file containing PHP-GTK v2.0.0 with all the required files to run GtkHTML.
2) Unzip the file. You will see a folder php-gtk2 in there. All the files required are in there, including a sample code for GtkHTML.
3) Open a command window and cd to that folder.
4) Type:
.\gconfd-2.exe|.\php gtkhtml_sample1.php
The .\ is there to make sure that it runs the gconfd-2.exe and php in that directory.
I've tested the above on a fresh install of winxp. So it should run on your machine.
If it does not, then I think it must be because it has loaded other dll's located in your other directories which is "incompatible" with this version of php-gtk2. (Remember you told me you have tried many many other dll's before. You could take a look at your PATH environment variable. Those dll's might be located in your windows directory too.]
I would suggest if you could grab hold of a "clean" PC, try the above zip file. It should work
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
alin19 (User)
Fresh Boarder
Posts: 11
|
|
Re:Class 'GtkHTML' not found 1 Month, 2 Weeks ago
|
Karma: 0
|
it seams that i dosn't work, i've downloaded version php-gtk-2.0.0-win32-nts, and required_files_for_gtkhtml
move all files in the required folders, and even add another dll file :libgthread-2.0-0.dll, that that was required, i've copy it from \php-gtk2_with-gtkhtml
and still geting this error: gtkHTML-error gconf error: faild to lunch configuration server: faild to execute helper program(no such file or directory)
aborting
if you say that it works at you, can you upload an arhive of complete folder on: http://rapidshare.com/
10x
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
alin19 (User)
Fresh Boarder
Posts: 11
|
|
Re:Class 'GtkHTML' not found 1 Month, 2 Weeks ago
|
Karma: 0
|
|
solve it :)
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
kksou (Admin)
Admin
Posts: 391
|
|
Re:Class 'GtkHTML' not found 1 Month, 2 Weeks ago
|
Karma: 8
|
|
Hi,
Would you want to share with the rest how you solved the errors that you faced earlier?
In case other people face similar problem, you will be able to help them save some time...
Regards,
/kksou
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
alin19 (User)
Fresh Boarder
Posts: 11
|
|
Re:Class 'GtkHTML' not found 1 Month, 2 Weeks ago
|
Karma: 0
|
|
of course!
well i've used what you have explaind here:
I managed to grab hold of a clean PC to identify all the required files to run GtkHTML.
So I suggest you start from a clean PHP-GTK v2.0.0 again and follow the following steps:
1) Start with a clean copy of the official download of PHP-GTK v2.0.0 (Note: please use v2.0.0, NOT v2.0.1)
2) Edit the php.ini to include the following:
php-gtk.extensions = php_gtk_html2.dll, php_gtk_extra2.dll
3) Download the following zip file (about 2.6MB):
required_files_for_gtkhtml.zip
4) Unzip the file into a temporary folder
5) Copy ALL the files into the respective folders. (don't forget the files in the two folders: /etc and /lib)
6) You are all set! You should be able to run GtkHTML now!
and then i was geting sone dll files mising,
and copy them from
php-gtk2_with-gtkhtml.zip
and to make sure that they run the php file with this comand:
.\gconfd-2.exe|.\php test.php
i was using just: php.exe test.php
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
|