gnope php gtk gui gnope.org  

Display HTML

 
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners
View previous topic :: View next topic  
Author Message
kees



Joined: 20 Jan 2006
Posts: 7

PostPosted: Fri Jan 20, 2006 7:01 pm    Post subject: Display HTML Reply with quote

Is there any way to display HTML in a GTK-PHP app? If not, are there any plans to embed Gecko or something?

Thanks,

Kees
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Sun Jan 22, 2006 1:29 pm    Post subject: Re: Display HTML Reply with quote

kees wrote:
Is there any way to display HTML in a GTK-PHP app? If not, are there any plans to embed Gecko or something?


Kees, you can use basic markup when using Pango, e.g. in a label.
See http://php-gtk2.de/manual/en/html/gtk/gtk.gtkmessagedialog.constructor.html for an example. Remember that GtkLabel is only for short (single line) text, not for whole pages. When you want to display more text, you should use GtkTextView (which has a similar Model-View concept as GtkTreeView).

Displaying full HTML pages is not possible. For this you would need a php-gtk2 module called "mozembed", but as php-gtk2 is not even beta right now, we are concentrating on the basic things. Extra modules come when php-gtk2 is stable.
Back to top
kees



Joined: 20 Jan 2006
Posts: 7

PostPosted: Sun Jan 22, 2006 2:21 pm    Post subject: Reply with quote

Fair enough. I am trying to write a tool that generates cross tabulations, it would be nice when the resulting tables can be displayed in HTML.

Otherwise, thanks and keep up the good work!

Kees
Back to top
ron_t



Joined: 11 Dec 2005
Posts: 78
Location: Gatineau, Quebec

PostPosted: Sun Jan 22, 2006 2:58 pm    Post subject: Re: Display HTML Reply with quote

cweiske wrote:
kees wrote:
Is there any way to display HTML in a GTK-PHP app? If not, are there any plans to embed Gecko or something?


Remember that GtkLabel is only for short (single line) text, not for whole pages.


I don't want to step on your toes, Christian, but I discovered that multi-line labels are possible using "\n" or "\012" in the label's text string. A lot of other escape sequences are also available for doing such things as typographic quotes, copyright symbols, etc.

Also, even though labels aren't really designed for multi-line text display, if the text is going to be read-only, pango might be enough, depending on how elaborate Kees wants to get.

If anyone is interested, I can post a list of usable escape sequences for PHP-Gtk2.

-Ron T.
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Sun Jan 22, 2006 3:07 pm    Post subject: Re: Display HTML Reply with quote

ron_t wrote:
I don't want to step on your toes, Christian, but I discovered that multi-line labels are possible using "\n" or "\012" in the label's text string

It is possible, but shouldn't be used for longer texts. Because it's not made for that.
Back to top
ron_t



Joined: 11 Dec 2005
Posts: 78
Location: Gatineau, Quebec

PostPosted: Sun Jan 22, 2006 3:09 pm    Post subject: Re: Display HTML Reply with quote

cweiske wrote:
ron_t wrote:
I don't want to step on your toes, Christian, but I discovered that multi-line labels are possible using "\n" or "\012" in the label's text string

It is possible, but shouldn't be used for longer texts. Because it's not made for that.


Is there a memory consumption issue involved? I'm just wondering why this should be avoided.

-Ron T.
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Sun Jan 22, 2006 3:43 pm    Post subject: Re: Display HTML Reply with quote

ron_t wrote:
Is there a memory consumption issue involved? I'm just wondering why this should be avoided.

GtkLabel has not been designed to display large amounts of text. It will scale very bad when you try to do this, and take too much cpu and stuff. Don't ask me for details, I just repeat what I've heard :)
Back to top
kees



Joined: 20 Jan 2006
Posts: 7

PostPosted: Sun Jan 22, 2006 4:04 pm    Post subject: HTML Reply with quote

Hi,

I couldn't get this to run:

$lab = new GtkLabel(null);
$lab->set_markup('<table><tr><td>bla</td><td>bla</td></tr><tr><td>bla</td><td>bla</td></tr></table>');

I suppose it's because of the table? Other stuff (<b>,<i>) indeed works fine. Where can I find the markup that is supported? Can't find anything on the Pango website...

Thanks,

Kees
Back to top
kees



Joined: 20 Jan 2006
Posts: 7

PostPosted: Sun Jan 22, 2006 4:17 pm    Post subject: Reply with quote

Sorry, found it anyway. Tables are not supported...
Back to top
ron_t



Joined: 11 Dec 2005
Posts: 78
Location: Gatineau, Quebec

PostPosted: Sun Jan 22, 2006 5:32 pm    Post subject: Re: Display HTML Reply with quote

cweiske wrote:
ron_t wrote:
Is there a memory consumption issue involved? I'm just wondering why this should be avoided.

GtkLabel has not been designed to display large amounts of text. It will scale very bad when you try to do this, and take too much cpu and stuff. Don't ask me for details, I just repeat what I've heard Smile


Thanks for clearing that up, Kees.

-Ron T.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Templates enhanced by DigiWiki. Hosting by Tradebit.