ASP.NET default MVC4 application content pages without layout reference? - razor

I created a mvc4 web app. with razor view engine. There are Layout page and content pages(Home, Contact, About, etc.) you know. But there is no reference to layout from content pages.
Should do not content pages include this:
Layout = "~/Views/Shared/_Layout.cshtml";
In content pages this code is missing.And they works.
How does it do this without layout reference?

It's because partial views are included into a 'non-partial' page, which does have a layout defined.. So they make use of that and just become a part of that page
EDIT
I'm sorry for the late reply, I just checked it out and it appears to be cause of the _ViewStart.cshtml page, this is a page that runs before any view is rendered, read more here:
weblogs.asp.net/gunnarpeipman/archive/2010/10/10/…

thats your masterpage if you want a partial view
#Html.Partial("partialviewname". "controller")
and the partial view doesnt use the masterpage since it is inserted to a place you desire

Related

ASP.NET Webforms - Displaying HTML content from a WYSIWYG editor as is without bootstrap styles from Master Page interfering

In ASP.NET Webforms I have a Master Page where bootstrap css is imported. All of the child pages of the site use this Master Page.
One of the child pages displays HTML content originally created in a WYSIWYG editor. Since this child pages uses the master page and relies on it so the header and footer match everything else the styles override the WYSIWYG content styles.
Is there a way I can make it so a section of the page ignores bootstrap even though it is being imported from the master page but the rest of the page like the header and footer still use it?
Trying to avoid separating this page from using the Master Page.
The only possible method I can think of would be to create a custom css file for this page, and create specific css classes for each element that will override the css imported from the bootstrap via masterpage.

asp.net MVC: different scripts in pages

I have pretty simple landing site (index, faq, about, contact) based on ASP.net MVC. Of course, I use Layout (with head and footer), every View contains just page content. The problem: some pages has unique footer or head.
For example:
Index page has carousel (only this page, other pages has no carousel).
In source HTML (that web-designer sent me) I see scripts links in the head and scripts block in the end. Yes, I know: I can use Razor tag "#section" and declare this non-standard head and footer inside my view.
But! It means my view (page content) includes razor syntax. This is not pure HTML. What if site admin will want to edit index page - he will see Razor tags, he can't use some html editor or online tool (TinyMCE) for edit. He must know Razor. He can't just insert pure html.
Maybe I shouldn't keep page contents in DB? (but this site must support multi-lang). What is the best approac in this case?
Thanks.

Navigation html pages liferay portlet

I'm new in liferay, into my portlet i have html pages with angularJs not jsp.I would ask about how to navigate between these html pages into my portlet..thanks.
I think you are bit confusing about technology.
JSP pages always generate HTML page for your browser.
It means that you create a JSP page containing just HTML nothing changes (this is correct from a developer point of view... thinking to server job this is not true... but think it is true for our purpose).
Client side technology you are going to use is not relevant from a portlet point of view (it can be a problem if your theme uses some not compatible libraries...) but in general whatever library you use (angularjs, backbone etc.).
It means that you can create html or jsp pages containing all the angularjs code you want... and everithing should work fine.
If you want to manage navigation between "pages" in the same portler (e.g. from view.html to details.html) then you have to mind, simplifying, that portlets haven't pages: your portlet will be added in a page of the portal (with its own URL).
So you can rename your html files in jsp files (as I told, nothing changes), then you can tell to portal what is the correct URL to load by JSP code.
For example for making a link to "details.jsp" in your "view.jsp" you can write a code like following:
<a href="<portlet:renderURL>
<portlet:param name="jspPage" value="/path/to/your/details.jsp" />
</portlet:renderURL>">Text</a>
Obviously you can use the <portlet:renderURL>...</portlet:renderURL> code wherever you want... because it will be translated in a string before sending to browser... like in javascript var url = "<portlet:renderURL>....</portlet:renderURL>"
You shouldn't forget to put these lines at the beginning of yout jsp files:
<%# taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<portlet:defineObjects />

Maintaining consistent look across multiple views in Razor and HTML?

I have ASP.Net MVC 5 application with Layout.cshtml and I have included the HTML view page. But I want to keep the consistent look and feel across multiple views in my application. I know I can do this if I have a Razor view page:
#{
Layout = "~/Views/Shared/_Layout.cshtml";
}
If I'm also using the same above code on the HTML View page, it doesn't pick up the Layout as it does in Razor page.
In html page you can't call '_Layout.cshtml' file directly to use layout , you have to add style and html tags manually in new created html file which you have in '_Layout.cshtml'. There is an option to call '_Layout.cshtml' using iframe but it is useful only if you don't want to apply server side logic, which is of less possibility.

Index page in Joomla

I have made a homepage in Joomla 2.5, and I need my front page to be different then the page made in Joomla.
My best solution then, is to make the front page in pure HMTL, and then redirect to the site made in Joomla. Is this possible? or is there an easier way to do it? for example with a plugin or something?
Create a custom html page and create it an article and then assign this article to front page. In this way you can display your custom html page to hope page of joomla.
Further if you want to remove even the headers and footers of the joomla page for home page this can be done in various ways
Make module positions and display the header and footer in it an
then in admin do not publish these modules for home page
We have
variable in template index.php which give us flags weather this is
home page you can use this flag and put a condition like if this is
home page dont display the header and footer.
Hope it will help you.
I can't really understand your question. If you want to load HTML only use custom HTML module rendered in your homepage
What are you trying to achieve? Without knowing more, I have two thoughts.
a. Joomla uses index.php. A lot of the time web servers look for index.html first. So if you create an index.html file and upload it to your root folder, it will display that first and not read your Joomla! site. If that doesn't work, check your web server to see the order that it looks for your start page. That is a setting that can be changed. (Depending on your hosting situation)
or b. You can set different templates for a single Joomla! site. you could set a different template for the homepage compared to the rest of the site. (I just need to know more on what you are trying to accomplish)
Have a great one.