Two mvc3 open-source programs: yqblog personal blog system and yqcms General website construction system

Source: Internet
Author: User
Tags visual studio 2010

Development Environment: Visual Studio 2010 (mvc3 + ef4.0) + sql2005
Running Environment:. NET Framework 4.0 + sql2005

Preview source code download

1. Why are there two sets of programs?
Two versions have been released before yqblog. Now it is version 1.2, and yqcms is version 1.0 released for the first time.
At present, many popular blog programs, in addition to being used as blog websites, will also be transformed into enterprise websites. Although it is actually content management, there are still many program requirements for business-based deviations. The requirements of enterprise sites vary widely. If we want to apply these requirements, it will lead to a growing number of programs. This is obviously inappropriate if you just talk as a blog program, so there is such separation.

Yqblog focuses more on the needs of personal blog systems.
Yqcms pays more attention to the universality of website programs, in order to maximize the adaptability to the needs of more types of websites.

2. Brief description of program architecture

Website --> types --> categories --> articles
Articledetail (SEO Information)
Extend)

The two sets of programs have a major feature in database modeling, that is, they do not create tables based on the differences in business functions. For example, there is no special comment table, comment table, and forum post table, album tables, article tables, etc. Only the ariticle table and the articledetail table (SEO information) are supported ). Yqcms has an extend table (Extended information ). For example, whether you put the data on the hard disk or the Eastern space and time zone, the performance is 0 and 1. The data tables in the database here are just similar data. The data is differentiated by categories, indicating which category it belongs to. categories is equivalent to website navigation on the front-end interface, and categories information is saved in the JS file in JSON format, categories is further differentiated by types, indicating whether it belongs to a forum, album, article, or message board, and then processes and presents data differences, thus forming our entire website.
The types part is hard-coded in the program. It can be understood as the functional modules provided by the program. For example, yqblog provides the article, single page, album, message board, homepage custom area, and all-network custom area functional modules. Based on yqcms, the Forum module is also added. Basically, these are what you can do with the current program.

New function modules should be expanded: If we still need to expand the modules such as mall, Weibo, and Q &. You only need to add a corresponding type and write the corresponding business logic code. If there are no major differences in requirements, basically the programs in articles and categories are generic. We only need to focus on the interface layer.

In general, the current program architecture ensures the scalability of functional modules and the versatility of program code.
For users, you can make the website simple. For example, if I only make a notebook, it is good to create only one document type category and it can be complicated, this depends entirely on the number of classification modules you have created in the background and your foreground presentation layer view.

3. multilingual and template Switching

MVC provides a good solution in these two aspects.
After getting the source code, you will find that there is no text except comments. Yes, we have concentrated all the text descriptions in the resource project ..

The three files are English, Chinese, and traditional. They are classified by program modules in different folders. If you need to expand other languages, Add corresponding language files. Basically, it is a simple copy and paste operation.

Template Switching
In MVC, template switching is actually a real-time change to the view engine path. Implementation is simple:

Viewengines. engines. clear (); viewengines. engines. add (New blogviewengine (Theme); // <summary> // custom view path /// </Summary> public class blogviewengine: razorviewengine {public blogviewengine (string key) {string Path = string. isnullorwhitespace (key) | key = "default "? "~ /Views ":"~ /Themes/"+ key; viewlocationformats = new [] {path +"/{1}/{0 }. cshtml ", path +"/{1}/{0 }. vbhtml ", path +"/shared/{0 }. cshtml ", path +"/shared/{0 }. vbhtml "}; partialviewlocationformats = viewlocationformats ;}}

The razor view engine of MVC is more intuitive, easy, and handy than other popular program templates. The razor syntax is also very simple. Just a little bit, you can easily control template customization. If you do not know background programming, it is equivalent to an HTML page. You can use it as an HTML page. If you understand background programming, you can also write C # programs in it, which is very flexible.

Open hosts. Template switching is not just about changing the CSS display style, but about changing the view path of the entire presentation layer. That is to say, you can switch between multiple completely different views, it seems that they are completely different websites.

Currently, two templates are provided in three languages, which is equivalent to 2*3 = 6 different style websites. In the future, I expanded to 6 different languages and 10 template styles. Then I have 60 different websites :)

Yqblog default template and multi-language settings

Yqcms default template and multi-language settings

Different templates can be set for different languages of yqcms, which allows your website to display completely different performance styles during different language switching.

Multi-language website content is independent: Apart from the differences in different language interfaces, this setting can make your website content in different languages completely independent. You can set or change it as needed.

How to operate data in different languages?Switch to a different language to operate the data in the current language. Very convenient.

4. Static
Static settings in the background:


Enable static URL?: The front-end article page can be switched between dynamic and static URLs in real time. When not enabled, the dynamic URL is displayed.
For example:
Http://www.yqhome.net/archive/671
Http://www.yqhome.net/static/2012/09/671.html
They are the same page, the former is a dynamic path, and the latter is a static path that has been generated as an HTML page.

Here you may have a problem, the relationship between static and multi-language templates. As mentioned above, suppose you have 6 different languages and 10 template styles. That is equivalent to 60 different websites. When static is used, is it also a page that generates 60 versions of HTML pages?

Here, the page is generated based on the default template you set, the default language, and the selected multilingual items. 6 static pages in 6 different languages and 10 template styles are generated.

That is to say, an article page will generate a static page of different languages based on your "Default template" for the number of "selected multilingual items, the static pages of other languages except the default language are added to the language keyword path.. For example:
Http://www.yqhome.net/static/en-us/2012/09/671.html
Http://www.yqhome.net/static/zh-tw/2012/09/671.html

When you switch to another non-default template, the page is displayed as a dynamic URL.

If you change the default template or language halfway, you must enable static URLs. Then you need to generate the previous static page again.

Generate an article HTML page?: If yes is enabled for static URL, yes is required here.

Static directory (available {year} {month} {day} indicates the current year, month, and day ):
The format is agreed, and you can customize the path name and level.

Batch page generation:

5. Extended Fields

Yqcms has added the extended field feature, combining many solutions, and finally adopts the simplest and most direct reserved field method. The principle is very simple. A new extend table has 10 fields to cope with possible differentiated requirements. The focus of this part of processing is mainly on the interface processing of background functions, so that it will be "very useful" for users ".

At the "website --> types --> categories --> articles" structure level
An extension is an extension of the articles part, but the extension settings can be defined on types or categories respectively. Here, an overwrite and inheritance relationship will be followed. That is to say, you can define the extended fields required by the document type as a whole, or define the extended fields under a specific category below. The rule is that lower-level employees do not inherit from each other sometimes, but use their own definitions.

6. Submit to yqhome.net
If your website is online, you can submit your website information to yqhome.net through the background homepage function. Sharing also improves the site click rate.
Shard data is imported into the database. Here we will generate a "case" document record and append a reply under the "Case Show" post on the forum.

Eg http://www.yqhome.net/forum/thread/664#f_1

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.