Template Engine like Smarty

Discussion in 'C Programming' started by global@neuroticweb.com, Jun 22, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertising

  2. Erich Pul Guest

    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
     
    Erich Pul, Jun 22, 2006
    #2
    1. Advertising

  3. Guest

    Erich Pul ha escrito:

    > 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, 2006
    #3
  4. Erich Pul Guest

    > 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?
     
    Erich Pul, Jun 22, 2006
    #4
  5. Neurotic Guest

    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.
     
    Neurotic, Jun 22, 2006
    #5
  6. Erich Pul Guest


    > 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
     
    Erich Pul, Jun 22, 2006
    #6
  7. Neurotic Guest

    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.
     
    Neurotic, Jun 22, 2006
    #7
  8. Erich Pul Guest


    > 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
     
    Erich Pul, Jun 22, 2006
    #8
  9. Neurotic Guest

    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 :)
     
    Neurotic, Jun 22, 2006
    #9
  10. Ian Collins Guest

    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.
     
    Ian Collins, Jun 22, 2006
    #10
  11. Neurotic Guest

    Neurotic, Jun 23, 2006
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SmViQnVzaGVsbA==?=

    Is ASP Validator Regex Engine Same As VS2003 Find Regex Engine?

    =?Utf-8?B?SmViQnVzaGVsbA==?=, Oct 22, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    735
    =?Utf-8?B?SmViQnVzaGVsbA==?=
    Oct 22, 2005
  2. Replies:
    1
    Views:
    387
    Sybren Stuvel
    Apr 10, 2006
  3. Mike Kingscott

    Alright smarty-pants, solve this problem:

    Mike Kingscott, Oct 29, 2003, in forum: ASP .Net Web Controls
    Replies:
    8
    Views:
    163
    Mike Kingscott
    Nov 5, 2003
  4. Ruby Baby
    Replies:
    1
    Views:
    138
    Ruby Baby
    Jan 23, 2004
  5. Irving Fried
    Replies:
    2
    Views:
    279
    Irving Fried
    Oct 15, 2006
Loading...

Share This Page