Short Echo Tag

Description

This example shows short echo tags. These are tags that start with a <?= instead of the normal <?wc. WebC will automaticly add a wcecho( before rest of the C code. WebC will then close this C block with just a );. This lets you output strings / string variables quickly without having to write wcecho(string);.

WebC Code

<?wc
const char *UserName="Ben";
?>
<!DOCTYPE HTML>
<html>
    <head>
        <title>Short Echo Tag</title>
    </head>
    <body>
        Hello <?=UserName?> welcome to WebC!
    </body>
</html> 

C Code

#include "WCWebAPI.h"

const char *UserName="Ben";

void Page_ShortEchoTag(void)
{
    wcecho("<!DOCTYPE HTML>\n"
        "<html>\n"
        "   <head>\n"
        "       <title>Short Echo Tag</title>\n"
        "   </head>\n"
        "   <body>\n");
        "       Hello ");
    wcecho(UserName);
    wcecho(" welcome to WebC!\n"
        "   </body>\n"
        "</html>\n");
}

Output

<!DOCTYPE HTML>
<html>
   <head>
       <title>Short Echo Tag</title>
   </head>
   <body>
       Hello Ben welcome to WebC!
   </body>
</html>