Arnoldus The Multi Language Site in C#

Multi Language Site: Page Text (Part 1.3)



This is the continuation of Part 1.2 (Multi Language Site: Displaying Content)


Contents Class

The contents class (included in the download) defines the following members:


public Contents(int textID, string Application, string Page, string hdr1, string hdr2, string hdr3, string hdr4, string hdr5, string hdr6, string hdr7, string hdr8, string fld1, string fld2, string fld3, string  fld4, string fld5, string fld6, string fld7, string fld8, string fld9, bool IsPublic, string Lang)

and contains the following methods:


static public List<Contents> GetPages()
static public Contents PagesFromReader(SqlDataReader reader)
static public List<Contents> GetContents(string Page)
static public List<Contents> GetWorkingContents(string Page)
static public List<Contents> GetCodeContents(string Page)
static public Contents ContentsFromReader(SqlDataReader reader)
static public void EditContents(int original_textID, string Application, string Page,
       string hdr1, string hdr2, string hdr3, string hdr4,
       string hdr5, string hdr6, string hdr7, string hdr8,
       string fld1, string fld2, string fld3, string fld4,
       string fld5, string fld6, string fld7, string fld8,
       string fld9, bool IsPublic, string strLanguage)
static public void AddPage(string Page, bool IsPublic)

Explanation:

  • GetPages: Returns the list of pages for which content is avalailable in the DataBase.
  • PagesFromReader: Is a helper method, used internaly by GetPages.
  • GetContents: Returns the contents of a page in the current user's language for display. (See also Part 1.4: Session Variables).
  • GetWorkingContents: Returns the contents of a page in the current working language for editing by the administrator. (See also Part 1.4: Session Variables).
  • GetCodeContents: Returns the contents of a page from a code record: is user language independent. (May be expanded to retrieve code in a particular language (e.g. VB or C#).
  • ContentsFromReader: Is a helper method, used internaly by GetContents and GetWorkingContents.
  • EditContents: Saves modified content to the DataBase.
  • AddPage: Inserts empty records in the DataBase for a new content page (e.g. Default2.aspx): one record for each supported language.

Note: the display language of the Contents Administration page and the working language used to handle the contents for a particular language are two seperate items: the Administrator can view the Content Management page in the language most convenient for him/her and edit the contents for any supported language.

The actual maintenance of the page contents is done through the page: Contents.aspx (included in the download). The page contains two DropDownLists (for the selection of the page and the field to edit) a CheckBox (to make the text searchable) and an HTML editor: FCKeditor (may be downloaded from: www.fckeditor.net) which allows to embed HTML code into the content fields.

Tip: the colorcoded code fragments on these pages were obtained in the following manner: 1) Copy the code fragment into MSWord, 2) use: Edit->Select All->Copy, 3) use FCKeditor's function “Paste from Word” knop, unselect the “Ignore Font Face definitions” Checkbox. (Sometimes some manual adjustments are required.)

Continue to: Multi Language Site: Page Text (Part 1.4): Session Variables.