Best way to separate HTML of the Razor code [closed] - html

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
We have some .NET back-end developers and some front-end (HTML & CSS) developers who have the minimum knowledge about ASP.NET MVC and Razor. This makes it hard to let both back-end and front-end developers work on the views directly. Therefore, normally back-end developers create a complex html page (using some frameworks) which then needed to be transferred into razor views. We normally end up doing this by copy and pasting the markup which makes the whole process so slow.
Often after our back-end developers add code to the pages (e.g. foreach loops), front-end developers have to make some changes to fix bugs or change the UI (for some reasons) and then they find it impossible to work on a page which carries .NET code too.
My question is that what is the best way of isolating these two concerns, which are building the html code and adding the razor/c# code.
I was thinking of having a pure HTML view and build the Razor view around it but I am not sure how this can be implemented technically.

You need to separate your concerns further. Seems like your razor view do too much, if there is C# code embedded. All the logic must be done inside of controllers of classes that provide data to controllers. No further processing should happen in views. Ever
The most complex construct in views should be #foreach or #for loops to create tables/lists. Also create url via #Url and ActionLink because that's where these belongs. Anything more complex than this must not be allowed.
And this will make your front-end guys life easier, along with advise to read-up about razor syntax.

Related

When to use AngularJS? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I want to develop a website by my own. I want to make different web applications which need to interact with databases. I read about AngularJS, a JavaScript framework. The thing I do not understand is: When to use AngularJS? Do I first build my website in HTML & CSS and then add functionality to it with AngularJS? How do professional developers start with that?
Thanks.
When you want:
A single page app
A RESTFUL app
Flexibility of the front end and Ultimate separation of both front and back end
And you should stay away from it when:
you have low budget as you will need both front and backend engineers. Most times, backend engineers can bring up your site without worrying too much about various stuffs Javascript has to offer.
If mobile users are you main target developing HTML5 Mobile application. I prefer Backbone instead (Yes backbone)because Angular makes my phone extremely hot and drains battery like hell.
Angular js is a javascript frame work which will run at client side.
It will reduce no. of http calls to the server.
Lot of server side executions can be done at the client side itself.
Page loading is faster.
Mainly used for single page applications.
Used to write modular and re-usable code.
If you want to create some kind of social interaction site which have likes, comments, posts etc in that scenario Angular js is best choice.
You can use Angular js along with lot of server side languages like Php, Asp .net etc.

Correct way of page separation and inclusion in HTML/Bootstrap [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm starting to work with HTML/Bootstrap, trying to have a website with several pages. The way I'm doing it is just to code each page separately, but I see that there are some elements in my page that are just the same (the navbar for instance).
I'm thus asking what is the correct way of separating the pages in this kind of scenario. Is it just to put each part in a separated HTML file, and including it?
I'm using Python Django as a framework and saw that there is a tool called Flask that looks to be dividing the page into sections, is it related or is it a complete different thing?
Bootstrap is a set of CSS (mostly, there are some JS bits too).
How you share code between different pages on your site is entirely independent of Bootstrap.
You would typically solve this problem using a template language. Since you said you are using Django, you can use the built-in template system.
I'm using Python Django as a framework and saw that there is a tool called Flask
Flask is an alternative to Django. It uses a different template system.
Actually you are looking for a template engine in Python and common option is to use Jinja2 and you are looking for template inheritance check this link, Flask is a micro framework which can be used instead of Django, but you you have to move from Flask to Django you can use Jinja as template engine in both.

How can I create standard layout for multiple pages? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Currently, I am working on my first web page using HTML and CSS. I want to use the same layout like background and header etc but I can't find a way. Today I found a couple of website telling about the template. Is this the related to what I want to do.
Thank you for helping a beginner.
Sam
I would recommend you a few things:
Find websites that make you feel as it is what you wanted to build.
Check their source code and try to find the semantics they have maintained.
Once you figured it out, you should try to create similar one.
You should follow HTML5 specifications , as it will help you build solid foundation. while doing this you will also understand best practices.
HTML or designing mostly depends on requirements. so you might not get one rule to follow, just invest time understanding some great works out there and practice alot.
In case you are very concern to layout, search for website layout images and you will get plenty of images having typical elements like header, navigation/menu, body (left/right sub menu + main content), footer.
You can consider templates for learning but it may lead you to trap of copying-pasting.
You can use Microsoft Expression Web application, which handles template. You make one page and save it as template and declare editable parts for sites. Then You can create multiple empty HTML pages. Finally you attach template, then it works.
Or if you can use PHP, you can create different parts of your Web Site, like: header.php, footer.php, banner.php and include them in every page where modifying the body and not writing the same footer, header, banner

how to implement "blog" page in HTML/CSS? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Silly newbie question. I see a lot of HTML templates on Themeforest or other sites, and they usually include a blog page. Doesn't a blog require a CMS, such as Wordpress? If I want to create a blog in HTML/CSS for a single author website that does NOT contain comments, what are my best options? Do people commonly do this, or should I really be using a CMS even though it's such a simple thing?
I plan to use Bootstrap to build a website. The website also needs a blog, although it's not it's main focus. I prefer to avoid a CMS if at all possible (and don't want to build my own CMS). Are there any mainstream solutions?
You should always be able use a text editor to modify files, regardless of their type. That being said, if this template is built for a specific CMS (take Wordpress, for instance) you will need to have some sort of web server and database to develop against.
If this template is simply a bunch of HTML template/boilerplate files, you can develop all the pages you need by hand. Just make copies and rename them according to your IA.
A blog typically implies you have some sort of database and CMS, but not always. You could create static, hard-coded pages and call them your blog.
If you buy a plain html template you can edit it by using various html/css/js editors such as brackets, atom, visual studio code or any other. On one hand, you can write your own CMS in e.g. php, ror, node. Or if you only want to have a blog site, you can buy a wordpress or joomla template and just install it into your CMS.
In static pages , you can only update your blog page by your server's cpanel editor not by dynamically, so if you need this as dynamic then you have make a back end dashboard in any scripting language such as php, jsp, asp or any framework or cms. So, your template only can hold blogs statically, by writing before uploading the page on server, or edit the page from cpannel. Thanx.

How to build the whole web site from css design [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
This is a novice question. I was given a web page design with CSS files and AI (Adobe Illustrator) files. My task is to create the web contents properly. What is the easiest way going about? Can Dreamweaver come handy here? Or do I have to code the html manually? (I am sure there should be a better way). The site is supposed to be up in a .NET environment.
Thank you for the help
CSS needs the HTML for structure and normally the two are written hand in hand. Spend the extra time and write the HTML and CSS manually while slicing up the supplied artwork. It's a rewarding process if you are learning or you challenge yourself to do a really good job of it. You can probably salvage a lot of css from the existing stylesheets (typography styles etc). In this way you can be more confident about the code you are using and ensure that it is legible. The HTML templates can then be integrated into a CMS, .NET framework based system or whatever the next step is.
If you are not up for the task, outsource the job to someone who is passionate about HTML and CSS to supply the complete HTML and CSS templates. There are plenty of us out there ;)