Basic knowledge

Extended HTML

Alinous-Core extends HTML.
But there are no custom tags for Alinous-Core.

Only attributes and input macro are added to HTML.

Alinous attributes

Alinous attributes are attributes whose name starts with "alns:".

Example of Alinous-Core HTML

Following code is the example.

 <HTML>
<HEAD>
<HEAD>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <TITLE>Input data into database</TITLE>
</HEAD>
<BODY>

  <H3>Select DB Form(/select/index.html)</H3><BR>

  <TABLE>
     <TR>
       <TD width="200" bgcolor="#AAAAAA">NAME</TD>
       <TD width="200" bgcolor="#AAAAAA">E-MAIL</TD>
       <TD width="300" bgcolor="#AAAAAA">COMMENT</TD>
     </TR>

     <TR alns:iterate="@RECORDS" alns:variable="oneRecord">
       <TD width="200" bgcolor="{$BGCOL[$COL % 2]}">{$oneRecord.NAME}</TD>
       <TD width="200" bgcolor="{$BGCOL[$COL % 2]}">{$oneRecord.EMAIL}</TD>
       <TD width="300" bgcolor="{$BGCOL[$COL++ % 2]}">{$oneRecord.COMMENT}</TD>
    </TR>
  </TABLE>

  <BUTTON alns:back="true">Back</BUTTON>

</BODY>
</HTML>

By watching this example, we can learn following features.

  • Attributes whose name starts with "alns:" is Alinous Attribute
  • We can write macros surrounded with "{" and "}". Those are replaced into the value of variables on runtime.
  • We can use one statement in the macro. ex. bgcolor="{$BGCOL[$COL++ % 2]}"

Alinous attributes

Alinous attributes references.

alns:back

Automatically generates <FORM> tag with submit button to go back to the last page.

<BUTTON alns:back="true">Back</BUTTON>

Information.

Where this attribute is available
<BUTTON>

alns:form

We use this attribute when we show validation failure message with the "alns:msg" attribute. See also alns:msg.

Information.

Where this attribute is available
<SPAN>
Use this attribute with
alns:msg, alns:validate

alns:if

If the condition is satisfied, the tag appears. Otherwise, the tag ignored.
ex.

<SPAN alns:if="{BOOL($TEST1 != null)}">
	If $TEST1 is not null, this message will appear.
</SPAN>

Information.

Where this attribute is available
<SPAN>,<DIV>

alns:ignoreblank

If the value of the form input is null, the input will be igonored.
On normal case, the value of the blank form input is "". The "" means the string whose length is 0.

<input type="text" name="mail" alns:ignoreBlank="true">

Information.

Where this attribute is available
<INPUT>

alns:inner

We specify the default page of the inner container.

<TD alns:tagid="contents" alns:inner="default.html" valign="top">
</TD>

Information.

Where this attribute is available
<TD>
Use this attribute with
alns:tagid

alns:iterate

We use this attribute to iterate same pattern for times how many the array's length is.

<TR alns:iterate="@RECORDS" alns:variable="oneRecord">
	<TD width="200">
		{$oneRecord.NAME}
	</TD>
	<TD width="200">
		{$oneRecord.EMAIL}
	</TD>
	<TD width="300">
		{$oneRecord.COMMENT}
	</TD>
</TR>

Information.

Where this attribute is available
<TR>,<TD>,<SPAN>,<DIV>,<OPTION>
Use this attribute with
alns:variable

alns:msg

We use this with the "alns:validate" attribute.
The "alns:form" specifies form's name, and the "alns:validate" specifies the failure reason of validation. When we use custom validator, the "alns:validate" is returned string value of "validate()" or "validateArray()" function.

<SPAN alns:msg="name" alns:form="searchForm" alns:validate="notNull">
	<FONT color="#FF0000">input your NAME</FONT><BR>
</SPAN>

It is equivalent with following.
The "testForm" is form's name, and "testInput" is input's name. When you use this way, please replece them into suitable name for your project.

<SPAN alns:if="{BOOL($ VALIDATE.testForm.testInput.notNull == ture)}">
	Error Message
</SPAN>

Information.

Where this attribute is available
<SPAN>
Use this attribute with
alns:form,alns:validate

alns:regexp

Specifying regular expression to much. Use this attribute with "alns:validate='regex'".

Information.

Where this attribute is available
<INPUT>,<SELECT>,<TEXTAREA>
Use this attribute with
alns:validate

alns:tagid

We can name the <TD> tag with "alns:tagid";

<TD alns:tagid="contents" alns:inner="default.html" valign="top">

Information.

Where this attribute is available
<TD>
Use this attribute with
alns:inner

alns:target

The "alns:target" specifies the target part where the reference address of the page specified with the <A> tag.If we want to specify own part, input "this" into this attribute's valus.

<A href="/sample/" alns:tagId="targetTdName">

<A href="/sample/" alns:tagId="this">

Information.

Where this attribute is available
<A>

alns:validate

We can use validator by using alns:validate attribute.

ex.

<INPUT type="text" name="name" value="" alns:validate="notNull">

<SPAN alns:msg="name" alns:form="searchForm" alns:validate="notNull">
	<FONT color="#FF0000">input your NAME</FONT><BR>
</SPAN>

By using alns:msg, alns:form and alns:validate attributes with <SPAN> tag, we can show error message.

Available value is :-

notnull
Checking if the value is not null.
int
Checking if the value is integer formatted string.
regex
Checking if the value matches regular expression specified with alns:regexp.
custom
Checking with custom logic.

Information.

Where this attribute is available
<INPUT>,<SELECT>,<TEXTAREA>
Use this attribute with
alns:regexp(optional)

custom validator

If you specofied validator name as "custom", the callback function function will be called after posting the form.

<input type="text" name="name" value="" alns:validate="custom">

On this case,

function validate($formName, $inputName, $value, $IN, $SESSION)
{
	if($value == ""){
		return "custom";
	}
	return 0;
}

will be called. If the value is wrong, please return a string value. If the value is correct, return 0.


And we sometimes use array form-input variable, which ends with "[]", then validateArray function will be called instead of validate().

<input type="radio" name="rtest[]" value="A" alns:validate="custom">A<BR>

Then

function validateArray($formName, $inputName, @value, $IN, $SESSION)
{
	if(Array.size(@value) == 0){
		return "custom";
	}
	return 0;
}

will be called.

alns:variable

When we use "alns:iterate", we can specify the name of the temporary variable.

<TR alns:iterate="@RECORDS" alns:variable="oneRecord">
	<TD width="200">
		{$oneRecord.NAME}
	</TD>
	<TD width="200">
		{$oneRecord.EMAIL}
	</TD>
	<TD width="300">
		{$oneRecord.COMMENT}
	</TD>
</TR>

Information.

Where this attribute is available
<TR>,<TD>,<SPAN>,<DIV>,<OPTION>
Use this attribute with
alns:iterate

Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes
Last-modified: 2007-07-08 (Sun) 03:53:26 (1159d)