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++ Core » HtmlTable class example request
Re: HtmlTable class example request [message #46107 is a reply to message #46104] Tue, 08 March 2016 12:06 Go to previous messageGo to previous message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
dolik.rce wrote on Tue, 08 March 2016 06:26
In my experience, only reasonable way to write html without way too much hardcoded stuff is to use templates. You could reuse templates from Skylark, it shouldn't be too complicated to use without the rest of the framework. You only might need to supply some configuration.


Hi Honza,

it looks interesting.
Here is tutorial Skylark02 modified as you suggest:
#include <Skylark/Skylark.h>

using namespace Upp;

struct MyApp : SkylarkApp {
	MyApp() {
		ValueArray va;
		va.Add(1);
		va.Add("Hello");
		ValueMap m;
		m.Add("key1", "first value");
		m.Add("key2", "second value");
		
		Renderer rr;
		rr("MyValue", "some value");
		rr("MyRawValue", Raw("<b>raw <u>html</u></b>"));
		rr("MyRawValue2", "<b>another raw <u>html</u></b>");
		rr("MyArray", va);
		rr("MyMap", m);
		String htmlTable = rr.RenderString("Skylark02/index");
		SaveFile("out.html", htmlTable);
	}
};

CONSOLE_APP_MAIN
{

	MyApp().Run();	
}


It worked, i.e. the html file has been saved, BUT it run a server too that continue to listen. Is there a way to take advantage of Witz template, Renderer class but without running a server?
It would be great for HTML and maybe for QTF report too.

Instead this variant
#include <Skylark/Skylark.h>

using namespace Upp;

CONSOLE_APP_MAIN
{
		ValueArray va;
		va.Add(1);
		va.Add("Hello");
		ValueMap m;
		m.Add("key1", "first value");
		m.Add("key2", "second value");
		
		Renderer rr;
		rr("MyValue", "some value");
		rr("MyRawValue", Raw("<b>raw <u>html</u></b>"));
		rr("MyRawValue2", "<b>another raw <u>html</u></b>");
		rr("MyArray", va);
		rr("MyMap", m);
		String htmlTable = rr.RenderString("Skylark02/index");
		SaveFile("out.html", htmlTable);	
}


just crashes.

edit: it seems RenderString() is not able to continue because I break out something important not inheriting from skylark Sad

Thanks,
Luigi

[Updated on: Tue, 08 March 2016 18:16]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IntStr function returns an empty string
Next Topic: conversion from String to wchar_t
Goto Forum:
  


Current Time: Fri May 10 22:56:31 CEST 2024

Total time taken to generate the page: 0.01961 seconds