web development India freelance website designer
What is now PageGen 4 worked by almost the same mechanism. Inserts the basic HTML frame with the navbar, subnavbar or
memnavbar for the appropriate directory. Anyway, I'm sure you're getting bored of all this old news. Lets build something.

Well, first of all I will take you through building your own PageGen application. It's quite simple. You first need to identify different areas
in your HTML page that you might want to change. Here is an example:
If this was my HTML page, then I would identify 3 sections. The first would be from the opening tag to the closing tag.
This would be my header. The body section would be my content, and the section would be my footer. Of course my
content would probably be split up into more sections, but I am sure you can identify these yourselves.

Now that you have these sections, you need to identify where different bits of HTML will depend on which directory the page is in. E.g. If
a page is in the root dir, it will need a different reference to an image location then a page in a sub dir.

I will use the demo page (above) and base the PageGen program around that. The first place where something will differ from page to
page is the tag. So, I will copy from the first <html> tag to the end of the meta tag and paste this in a text box called txtHeader.<br>That is the only large amount of text that I will be using at one time, so I don't need to copy and more.<br><br>OK. Lets put down some code. Open up VB and make a new Standard EXE Project. Add three text boxes (txtHeader, txtTitle and<br>txtReturn), a command button (cmdMake) and a combo box (cboDir). Make sure that txtHeader's and txtReturn's MultiLine property is<br>set to True and that you paste in the header text talked about above into txtHeader with another line at the top (<!--Start Header-->).<br>Also put a space and then press Ctrl+Enter in the text property of txtReturn as Chr(13) does not act as a very good carriage return<br>character. Add a common dialog control to the form (comDlg). Copy and paste this code into the cmdMake_Click procedure:<br><br>Private Sub cmdMake_Click()<br>Dim strBuffer As String<br>Dim strPath As String<br>Dim intFile As String<br><br>'// Build the HTML file<br>strBuffer = txtHeader & txtReturn<br>strBuffer = strBuffer & "<title>" & txtTitle & "" & txtReturn
strBuffer = strBuffer & "" & txtReturn
strBuffer = strBuffer & "" & txtReturn
strBuffer = strBuffer & "" & txtReturn
strBuffer = strBuffer & bgImage(cboDir.Text)
strBuffer = strBuffer & "" & txtReturn
strBuffer = strBuffer & "" & txtReturn
strBuffer = strBuffer & "" & txtReturn
strBuffer = strBuffer & "" & txtReturn
strBuffer = strBuffer & ""

'// Set up the common dialog
intFile = FreeFile
comDlg.Action = 2
strPath = comDlg.filename
If strPath = "" Then Exit Sub

'// Open/Create the HTML file and write to it
Open strPath For Append As #intFile
Write #intFile, strBuffer
Close #intFile
End Sub

We now need to build the bgImage function found in the above code. This function takes one parameter, strDir, which is the directory
(root sub etc) from which to create to file to. It looks like this:

Private Function bgImage(strDir As String) As String
Select Case strDir
Case "Root Dir"
bgImage = ""
Case "Sub Dir"
bgImage = ""
Case Else
bgImage = ""
End Select
End Function

That's basically all the code you need. Just add this little bit to the form's Load procedure:

Private Sub Form_Load()
With cboDir
.AddItem "Root Dir"
.AddItem "Sub Dir"
End With
End Sub

That's it! You have now created your own version of PageGen. See the source code download below if you get stuck.

NOTE: Please don't remove the tags from the program, they will be needed in a future part of this series.

Well, thanks for reading. Hopefully now you will be able to adapt the basic program above and make building your web site easier! Just
add more directories to the combo box and the select case statement, and check for other variables within your HTML page. Have fun!
Build a Web-Page

1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700

Freelance ASP PHP web development | Web developer India Web development India| Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design