Jump to content
Sign in to follow this  
AlmarM

XHTML UDF

Recommended Posts

AlmarM

Hey!

At my new study, we are learning how to make a basic website.

I got a little bored by typing the code over and over again. So I made myself a little XHTML UDF.

Whats more fun then sharing it? ;)

Functions:

_XHTML_Start($sTitle = "Index")

_XHTML_End($sPath)

_XHTML_StartForm($sName, $sMethod = "", $sAction = "")

_XHTML_EndForm()

_XHTML_StartTable($iBorder = 1, $iWidth = "")

_XHTML_AddTrTd($iMode = 0)

_XHTML_EndTable()

_XHTML_AddHeader($sText, $sSize = 1)

_XHTML_AddLabel($sText)

_XHTML_AddInput($sName, $iSize, $iMaxlength, $iPass = 0)

_XHTML_AddButton($sName $sValue, $sType = "button")

_XHTML_AddBr($iNumber = 1)

_XHTML_StartSelect($sName)

_XHTML_AddOption($sText)

_XHTML_EndSelect()

_XHTML_Custom($sCode)

_XHTML_Save($sPath)

_LineFeed($iNumber = 1)

Example

#include "XHTML_UDF.au3"

#Region: Index.html
$PathHTML = "C:/wamp/www/test_autoit/index.html"
_XHTML_Start()
_XHTML_AddHeader("Example!", 1)
_LineFeed()
_XHTML_StartForm("form1", "POST", "get.php")
_LineFeed()
_XHTML_StartTable(0, "40%")
_LineFeed()
_XHTML_AddTrTd(2)
_XHTML_AddLabel("Username: ")
_XHTML_AddTrTd(6)
_XHTML_AddInput("user", 20, 20)
_XHTML_AddTrTd(5)
_XHTML_AddTrTd(2)
_LineFeed()
_XHTML_AddLabel("Password: ")
_XHTML_AddTrTd(6)
_XHTML_AddInput("pass", 20, 20, 1)
_XHTML_AddTrTd(5)
_LineFeed()
_XHTML_AddTrTd(2)
_XHTML_AddLabel("Rating: ")
_XHTML_AddTrTd(6)
_XHTML_StartSelect("rating")
_LineFeed()

For $i = 1 To 9
    _XHTML_AddOption($i)
    _LineFeed()
Next
_XHTML_AddOption("10")
_XHTML_EndSelect()

_LineFeed()
_XHTML_AddTrTd(2)
_XHTML_AddTrTd(6)
_XHTML_AddButton("", "Log in!", "submit")
_XHTML_AddButton("", "Reset!", "reset")
_XHTML_AddTrTd(5)
_LineFeed()
_XHTML_EndTable()
_LineFeed()
_XHTML_EndForm()
_LineFeed()
_XHTML_End($PathHTML)
#EndRegion

#Region: get.php
$PathPHP = "C:/wamp/www/test_autoit/get.php"
_XHTML_Custom("<?php")
_LineFeed(2)
_XHTML_Custom("echo ('Username: ' . $_POST['user'] . '<br/>');")
_LineFeed()
_XHTML_Custom("echo ('Password: ' . $_POST['pass'] . '<br/>');")
_LineFeed()
_XHTML_Custom("echo ('Rating: ' . $_POST['rating'] . '<br/>');")
_LineFeed(2)
_XHTML_Custom("?>")
_XHTML_Save($PathPHP)
#EndRegion

Hope its usefull for someone!

Also, tell me what you think, any tips or improvements. :)

Update:

[18-11-09] ~ _XHTML_StartSelect(), _XHTML_AddOption(), _XHTML_EndSelect()

AlmarM

XHTML_UDF.au3

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×