what do you mean replicating?
essentially what I mean is a simple site builder that that were my members only have to enter basic information to develop their own web pages. The non-web savvy professional will only be able to pick skin, color, pictures at a touch of a button and type in content. No complexities. However, I want a portion of the site to be an ecommerce page that only I the administrator can control. But they will receive commission off of. Like homestead or any other sitebuilder, only simple enough for an imbecile to get it.
Oh boy you're getting into a big one. You can actually do this via includes if you wish to. Now with these sites, are they going to be hosted by you, need their own "files", etc? From what I see, you can do it a few different ways:
1. You can create a database and store all values that are used to create the page everytime it is loaded. Not the best, but easy flexibility if someone decides to change their layout. You can use standard pages, and just insert the database info into the pages. This is definitely not for high traffic sites.
2. You can create the pages dynamically when a user submits the button. The user will be able to choose the pages and replicate it. Then, if you wish, they can put text where they want. This would be best if the site is always going to stay the same. If they want to change their layout, they would have to start all over again and resubmit all information (unless you keep in a database, which if you do you might as well go with solution 1.). For this, I would recommend setting up full pages how they look, with text boxes on where they are allowed to insert information. Each textbox would have to be a rich textbox so the imbecile doesn't screw with code!
anyway you look at this, it is a big project and not flexible for you at all. I would recommend solution 1 with different database servers. 1 server for layout control, another server for information. You can store layout information in session variables, just make sure you do a session check every time a request is made. An example of this would be:
layout database server
templatelayoutnumber - this column would be the layout template number.
layoutposititionnumber - this column would be the position of textboxes on the page. If the number doesn't exist, there is no text in these textboxes.
useridorwebsitename - this column would be for your customer's id or his website name to keep the information database in order.
information database
layoutpositionnumber - relative to the other database column.
layouttext - text within the textbox.
useridorwebsitename - relative to the other database column.
Now when a user views the site, a simple check of session variables will quickly see that they are not set or he is viewing the site for the first time in a certain period of time. A query will hit the layout database server requesting the template layout number that corresponds with the correct useridorwebsitename column. This will reference him to the correct layout. ALso with this query, you will return all the layoutpositionnumbers. These should be stored in an array, then used to pull the information from the information database. Some coding on your template page will tell the layoutpositionnumber where the text is going to be. THen the layout text will be the text within that textbox. These should be spit into literals. Something like this would be:
Dim conn As New SqlConnection( connectionstring )
Dim cmdSelect As SqlCommand
Dim dtrReader As SqlDataReader
Dim bolSession As Boolean = False
''useridorwebsitename session is unneeded if it is done by website name. Only used for userid to prevent multiple queries.
if Session("templatelayoutnumber") is nothing or Session("layoutpositionnumbers") is nothing or Session("useridorwebsitename") is nothing then
cmdSelect = New SqlCommand( "SELECT templatelayoutnumber, layoutpositionnumbers, useridorwebsitename FROM layoutdatabaseserver WHERE useridorwebsitename=@useridorwebsitename", conn )
cmdSelect.Parameters.AddWithValue( "@useridorwebsitename", getthisvaluefromsomewhere )
if dtrReader.HasRows then
while dtrReader.Read()
if bolSession = False then Session("templatelayoutnumber") = dtrReader("templatelayoutnumber")
''Next line might or mightnot be needed.
if bolSession = False then Session("useridorwebsitename") = dtrReader("useridorwebsitename")
if Session("layoutpositionnumbers") is nothing then Session("layoutpositionnumbers") = ""
Session("layoutpositionnumbers") = Session("layoutpositionnumbers") & ","
''Reason for bolSession is so that you're not continuously overwritting the first 2 session objects.
if bolSession = False then bolSession = True
end while
end if
The above code should be an include for every page as it would have to be redone if a session fails. Then after you have this information, do a simple replace command to remove the last index of the comma (replace(lastindexof(","), "")) kind of thing, then "SELECT layouttext FROM informationdatabase WHERE useridorwebsitename=@useridorwebsitename AND layoutpositionnumber IN (" & Session("layoutpositionnumbers") & ")".
Did I give you some relative information?
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.