Master page in HTML

后端 未结 5 1578
太阳男子
太阳男子 2021-02-03 22:41

Is there any way to create a similar idea as master/content page in ASP.NET in pure HTML?

I want to create several pages in HTML, but I want that all of them look the sa

5条回答
  •  我在风中等你
    2021-02-03 23:34

    I resolved with a Third party c# form application.

    Header and footer different page insert key to all other page. (###footer###) Replace files contents with form Application.

    footer.html

    this place is footer.

    default.html

    Default page

    bla bla bla ###footer###

    Result default.html

    Default page

    bla bla bla

    this place is footer.

    Source Code below

    List list = new List();
    
    private void sourceBtn_Click(object sender, EventArgs e)
    {
        DialogResult result = openFileDialog1.ShowDialog(this);
        if (result == DialogResult.OK)
        {
            sourceTxt.Text = openFileDialog1.FileName;
        }
    }
    
    private void fileListSelect_Click(object sender, EventArgs e)
    {
        var result = openFileDialog2.ShowDialog(this);
        if (result == DialogResult.OK)
        {
            fileList.Items.AddRange(openFileDialog2.FileNames);
        }
    }
    
    private void addSourceBtn_Click(object sender, EventArgs e)
    {
        list.Add(new sourceKey() { filename = sourceTxt.Text, key = keyTxt.Text });
        sourceTxt.Clear();
        keyTxt.Clear();
        sourceTxt.Focus();
        sourceList.DataSource = null;
        sourceList.DataSource = list;
    }
    
    
    private void ConvertBtn_Click(object sender, EventArgs e)
    {
        foreach (var filename in fileList.Items)
        {
            string text = File.ReadAllText(filename.ToString());
            foreach (var item in sourceList.DataSource as List)
            {
                text = text.Replace(item.key, File.ReadAllText(item.filename));
            }
            File.WriteAllText(filename.ToString(), text);
        }
        infoLabel.Text = "Done";
    }
    

    Source Code Download Link

提交回复
热议问题