views:

34

answers:

1

Hello Everyone!!! I've got kinda MLM site to make, Like be a member buy purchasing any product of company and create other members under you, in your downline and for that you get commission in product they buy. This is the concept. But, that company is providing a website as its Product.

Now, That product is a Website, Where From 100 ready-made website templates, User who becomes member of the company will select a template and can modify content from the HTML editor(WYSIWYG Editor). All default pages like home, services, about, contact will be there under templates. And websites going to be hosted/placed under subfolders of the server and Member's Domain will be pointed to that folder associated to him.

I'm creating a website in asp.net 2.0 for that company who provides services like this, who offers this product to its members. I'm creating the control panel and for that I need your help in editing HTML page content in HTML Editor (wysiwyg editor). Not whole HTML page content should appear in the Editor but, only content area can be modified you know. This website will be hosted in the ROOT folder of the server while websites for members will be in subfolders.

Right now, I'm using the logic like placing TXT files under member's website's folder. like for "services.htm" page, there's "services.txt" file which is the main content file. I can edit TXT file very well from the Editor. But, somehow I'm not being able to INCLUDE or INSERT that TXT file inside HTML page where I want to show the content placed in that text file.

Can anyone guide me the better way to do this stuff??? Please help me out guyz. Dunn tell me about iFrames please.

+1  A: 

Sounds like you should take a look at the Server Side Includes (SSI) Tutorial which allow you to insert text/html files in your page.

EDIT I tested the following files with the Visual Studio Casini(built in) web server to demonstrate how server side includes work:

default.aspx(Note the <!--#include virtual="FileToInclude.txt" --> line)

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ServerSideInclude._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Server Side Include</title>
</head>
<body>
    <form id="form1" runat="server">
    <div style="border:solid 1 px blue;">
       This is the main page...
       <!--#include virtual="FileToInclude.txt" -->
    </div>
    </form>
</body>
</html>

FileToInclude.txt

<div style="border:solid 1px green;margin:10px;">
    This text is from an included file...
</div>

default.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ServerSideInclude
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}

All these files are in the web site root directory. You will need to all paths to the file to include if they are in different directories(as noted in the tutorial linked to above)

NOTE: This works with .aspx files as shown here. Other file extensions with the Casini web server may not work. If you were using IIS you could configure file extensions to be processed through ssi.dll. Since Casini isn't configurable(as far as I know) not all file extensions may be processed for server side includes.

DaveB
I've tried that <!--include virtual() --> thing on a HTML page in my Visual Studio 2005 project. but, when I actually preview that HTML file. with this script. Its not working, its not showing text file content in it.
idleMind
@idleMind - See my sample code added.
DaveB