Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » Htmls / HtamlTag class and table generation
Htmls / HtamlTag class and table generation [message #34936] Sun, 18 December 2011 19:59 Go to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

the Web package may simplify my life with Htmls/HtmlTag while I generate my html output. How to use them Rolling Eyes ? I looked for an example in the forum but unfortunately no result.
I need a very basic example to generate a html page containing a 2x2 table with header and a link in one cell to start to play with.

Thanks a lot,
Luigi
Re: Htmls / HtamlTag class and table generation [message #34940 is a reply to message #34936] Sun, 18 December 2011 21:54 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Luigi,

Something like this?
#include <Web/Web.h>

CONSOLE_APP_MAIN{
	Htmls html;
	html << HtmlTable().Width(200) / (
		HtmlRow() / (
			HtmlTag("th") / "column 1"
			+ HtmlTag("th") / "column 2" 
		) + 
		HtmlRow() / (
			HtmlCell() / HtmlLink("http://ultimatepp.org") / "A1"
			+ HtmlCell() / "A2"
		) +
		HtmlRow() / (
			HtmlCell() / "B1"
			+ HtmlCell() / Htmls("<i>some</i> <b>html</b> blob")
		)
	);
	DUMP(html);
}

It seems messy, but when all the operation are performed in cycles and functions it is not that bad Smile The rule of thumb is that '+' adds tag on the same level and '/' places tag inside.

Best regards,
Honza
Re: Htmls / HtamlTag class and table generation [message #34945 is a reply to message #34940] Mon, 19 December 2011 15:00 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
dolik.rce wrote on Sun, 18 December 2011 21:54


It seems messy, but when all the operation are performed in cycles and functions it is not that bad Smile The rule of thumb is that '+' adds tag on the same level and '/' places tag inside.

Best regards,
Honza


Hi Honza!

Thanks a lot, it is what I was looking for.
It is a bit messy but seems not so complicated and better looking that write "<TD>..." everywhere.
I vote to include the previous code snippet in the reference assembly. It's a pity to let it disappear in the forum.

Best wishes,
Luigi

#include <Core/Core.h>
#include <Web/Web.h>

using namespace Upp;

CONSOLE_APP_MAIN{
	Htmls html;
	html << HtmlTable().Width(200).Border(1) / (
		HtmlRow() / (
			HtmlTag("th") / "column 1"
			+ HtmlTag("th") / "column 2" 
		) + 
		HtmlRow() / (
			HtmlCell() / HtmlLink("http://ultimatepp.org") / "A1"
			+ HtmlCell() / "A2"
		) +
		HtmlRow() / (
			HtmlCell() / "B1"
			+ HtmlCell() / Htmls("<i>some</i> <b>html</b> blob")
		)
	);
	SaveFile("page.html", html);
}

Re: Htmls / HtamlTag class and table generation [message #34952 is a reply to message #34945] Tue, 20 December 2011 10:23 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
FYI: I am afraid that this Htmls stuff becomes deprecated. It is not bad idea, but I guess for real-world web development, you need to have something that html designer understands. That is why we are going to templates...

OTOH, perhaps some nice table generalisation, which would possibly include QTF outputs as well, would be nice.
Re: Htmls / HtamlTag class and table generation [message #34955 is a reply to message #34952] Tue, 20 December 2011 12:28 Go to previous message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
mirek wrote on Tue, 20 December 2011 10:23

FYI: I am afraid that this Htmls stuff becomes deprecated. It is not bad idea, but I guess for real-world web development, you need to have something that html designer understands. That is why we are going to templates...

OTOH, perhaps some nice table generalisation, which would possibly include QTF outputs as well, would be nice.



At moment I need to generate the HTML equivalent of several QTF document already prepared (I used a class made by mdelfede that is rather handy). This document consist of a table that will be included in other pages dressed with CSS. I do not need sofisticated html and Web package seems ok to write a clean generation.

I agree that for real web development a generalized table class able to output/export qtf and html as well (pdf?) would be fantastic.

Luigi
Previous Topic: Need a suggestion about mouse processing inside threads
Next Topic: Deadlock - what LeaveGMutexAll does?
Goto Forum:
  


Current Time: Fri Mar 29 08:32:28 CET 2024

Total time taken to generate the page: 0.01279 seconds