By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,804 Members | 1,659 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,804 IT Pros & Developers. It's quick & easy.

Template Engine like Smarty

P: n/a
There is a Template Engine for C like Smarty (http://smarty.php.net/)
to separate the html from the C code?

Thanks,
Carlos.

Jun 22 '06 #1
Share this Question
Share on Google+
10 Replies


P: n/a
gl****@neuroticweb.com wrote:
There is a Template Engine for C like Smarty (http://smarty.php.net/)
to separate the html from the C code?


how do you combine C and HTML? IMHO if you want to use say OOP-like
functionality in HTML or alike, use PHP

greetings,
--
EP

Jun 22 '06 #2

P: n/a

Erich Pul ha escrito:
gl****@neuroticweb.com wrote:
There is a Template Engine for C like Smarty (http://smarty.php.net/)
to separate the html from the C code?


how do you combine C and HTML? IMHO if you want to use say OOP-like
functionality in HTML or alike, use PHP

greetings,
--
EP


I know, i know, but i need it for C, i cannot change the language.

Jun 22 '06 #3

P: n/a
> I know, i know, but i need it for C, i cannot change the language.

well, HOW do you want to employ C with HTML? putout HTML code with C?

Jun 22 '06 #4

P: n/a

Erich Pul ha escrito:
I know, i know, but i need it for C, i cannot change the language.


well, HOW do you want to employ C with HTML? putout HTML code with C?


I want to modify a web server log file analysis program written in C
(the output it's a html). Now the code it's a mess and i want to use
html templates in order to make easier to modify the html output in the
future.

Jun 22 '06 #5

P: n/a
I want to modify a web server log file analysis program written in C
(the output it's a html). Now the code it's a mess and i want to use
html templates in order to make easier to modify the html output in the
future.


ah, ok - thx for the fill-in... maybe it is possible to put the html
and include functions in C that add smarty-style functionality to it.
but AFAIK is smarty for PHP files, right? so if you are able to put out
..php files, you may have a cron or alike run over the files with a php
script and modify them? just a suggest though since i never actually
tried something like this...

hth,
--
erich pul

Jun 22 '06 #6

P: n/a

Erich Pul ha escrito:
I want to modify a web server log file analysis program written in C
(the output it's a html). Now the code it's a mess and i want to use
html templates in order to make easier to modify the html output in the
future.


ah, ok - thx for the fill-in... maybe it is possible to put the html
and include functions in C that add smarty-style functionality to it.
but AFAIK is smarty for PHP files, right? so if you are able to put out
.php files, you may have a cron or alike run over the files with a php
script and modify them? just a suggest though since i never actually
tried something like this...

hth,
--
erich pul


Thanks Erich but i don't want to complicate myself so much. Maybe a C
cgi library has some similar to Template Engine.

Jun 22 '06 #7

P: n/a

Thanks Erich but i don't want to complicate myself so much. Maybe a C
cgi library has some similar to Template Engine.


maybe you can circumvent all the hassle by simply modifying the C code
to include a CSS-stylesheet into the output html. then you can simply
do the spacing etc. with relative or absolute DIVs and SPANs (just to
complicate this further ; )

greetings,
--
E

Jun 22 '06 #8

P: n/a

Erich Pul ha escrito:
Thanks Erich but i don't want to complicate myself so much. Maybe a C
cgi library has some similar to Template Engine.


maybe you can circumvent all the hassle by simply modifying the C code
to include a CSS-stylesheet into the output html. then you can simply
do the spacing etc. with relative or absolute DIVs and SPANs (just to
complicate this further ; )

greetings,
--
E


I'll do it using CSS but i want to have also the option of modify the
html easely. Thanks anyway :)

Jun 22 '06 #9

P: n/a
Neurotic wrote:
Erich Pul ha escrito:

I know, i know, but i need it for C, i cannot change the language.


well, HOW do you want to employ C with HTML? putout HTML code with C?

I want to modify a web server log file analysis program written in C
(the output it's a html). Now the code it's a mess and i want to use
html templates in order to make easier to modify the html output in the
future.

There isn't anything like PHP templates in C. PHP is an interpreted
language and the template fields are filled in at run time, with C you
have to form the document structure at compile time.

You should be able to break the problem down into its component parts
and come up with something like

outputHTML() which calls

outputHead() and outputBody() which calls

outputYourData().

You can break outputYourData() down into a set of functions that mimic
PHP templates.

If this is to be viewed via a browser, make it a CGI application and
place all your formatting in a CSS file.

--
Ian Collins.
Jun 22 '06 #10

P: n/a

gl****@neuroticweb.com ha escrito:
There is a Template Engine for C like Smarty (http://smarty.php.net/)
to separate the html from the C code?

Thanks,
Carlos.

I found this (well, actually i asked in www.barrapunto.com):
http://www.clearsilver.net
http://goog-ctemplate.sourceforge.net/ (only for C++)

But i think i'll modify the program to output a xml file (using xslt
templates after)

Thanks to all :)

Jun 23 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.