how to add view template in asp.net core - templates

i want to add some view template for asp.net core mvc 3.1.1, i copied Templates folder from this path:"C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates"
and added a new view with name "_Entiti.cshtml" to "ViewGenerator" folder, but when trying to add a view it not appears in dialog box of vs 2019 inside of templates drop down, originally i want to use controller with context to generate some views with custom controller, but couldn't change view name that been created like "Create,List,...".
can any body help me?

Try using the solution explorer. Right click on the Shared folder (under Views) and click "Add" --> "View".
Then on top of the pages that you would like to be using that template write:
**substitute the word "View" with the name of your template:
#{ Layout = "~/Views/Shared/View.cshtml"; }

Related

How to make a statically binded rendering editable via Experience Editor (Sitecore MVC)

So I have a layout view within Sitecore Mvc, this view contained a Controller Rendering that pulls in a header and footer navigation. Example:
#Html.Sitecore().Rendering("/sitecore/layout/renderings/some_rendering")
This specifies a Controller Rendering I've defined in Sitecore. This works great, except when I'm in the experience editor. It doesn't give me the ability to select this rendering. If I create a Placeholder and then define these navigation elements to this placeholder dynamically via Sitecore, then I can, but these navigational elements exist on every page of this layout, so I would like them statically placed instead of using a Placeholder, but I would still like the user to be able to select the navigation element in the experience editor (so I can create custom command to interact with this navigation, such as creating new links, etc).
Does anyone have an idea that will help me achieve this?
Use Edit Frame for that and create Custom Edit Frame Button for operations like adding new element to the navigation.
And remember to pass Datarsource ID or Path as a second parameter to the Html.Sitecore().Rendering() method:
#Html.Sitecore().Rendering("/sitecore/layout/renderings/some_rendering", new { DataSource = "{some-id-or-path}" })
Here is set of blog posts which can help you to understand how Edit Frames work and how to add them in Sitecore MVC solution:
https://visionsincode.wordpress.com/2015/01/08/how-to-use-editframe-in-sitecore-mvc/
https://www.cmsbestpractices.com/how-to-properly-use-sitecore-edit-frames/
https://briancaos.wordpress.com/2011/11/28/using-sitecore-editframe-in-pageedit/
You won't be able to remove the component or move it around the page (yeah, it's statically bound to one place on your layout), but you will be able to edit it's properties and datasource.
You can try to use GlassMapper views and statically inherit the view from the GlassView.
Then you'll be able to use Editable method to render the field.
But the consideration you need to take is that you'll not be able to set a datasource to the component from the page editor or content editor.
Instead of injecting the rendering through the Rendering method you should be able to use standart MVC RenderPartial.
I've used this approach on one of the projects I've been on and it worked.

Including MVC in existing Sitecore Project

we have a Sitecore Project up and running, that is based on the regular aspx/ascx approach.
Over time we would like to transform our existing sublayouts to MVC.
For test purposes I am trying to add a very simple MVC text component to the project, still I am stuck somehow.
What I have done so far:
Installed MVC 5.2
Installed WebPages
Added references and bindings
Added the MVC Scaffold
Right now, the Site does compile and run.
I have this Controller:
public class TextComponentController : Controller
{
public ActionResult Index()
{
return View();
}
}
And my view:
<h2>Index</h2>
<p>Hello from my View Template</p>
So absolutely nothing special here ;)
How can I create a sublayout (without a datasource) that just displays this simple MVC component?
In the very simplest way, you need to have the following:
Item for your page, the one that has URL; that is as normal in Sitecore
That page Item should have Layout assigned. From Presentation --> Details menu select at least a layout on that stage. If you do not have layout yet, you need to create a layout definition item under /Layout/Layouts folder and associate it with certain *.cshml file. Also mention that layout should have a placeholder where you will "inject"your rendering.
#Html.Sitecore().Placeholder("Main")
You need to create a Controller Rendering under /Layout/Renderings folder in Sitecore. Make sure you set Controller and Controller Action fields to your controller name and action method name.
Finally, go again to Presentation --> Details --> Edit --> Controls and add your newly created rendering into a placeholder that you have on your layout *.cshtml file.
That's all done.
Hope this helps!

Joomla 3.3.1 category blog not showing on specific template

I'm working on Joomla 3.3.1 (on Mac, MAMP). When I choose to display a menu item as "category blog" it leads to a blank page. If I select a different template style (on the menu item details) the page does show correctly.
How can I use my default template to show the page correctly? Where can the problem be?
I'm using the template "ict_conches_free" as my default template.
Will just add this as a proper answer:
Try checking for the following directory templates/YOU_TEMPLATE/html/com_content/category. If it exists then it mean a Template Override has been made for that specific view which allows users to override the view of an extension without having to modify core files.
In your case, if it exists, then the override is faulty in some way, shape or form. So simply delete the category folder.

Joomla 3.x custom component view is shown in wrong template design

I am developing a custom component. In this component I need Joomla's Redirect with its inbuilt function JRoute for example:
JRoute::_('index.php?option=com_customcomponent&view=registration');
I have a menu item, which is linked to the URL above and has an alias with the name registration. Furthermore I set a special template for this view. If I call the link http://www.mywebsite.com/registration => the view will be opened with the right design (special template).
If I access it on a direct way http://www.mywebsite.com/index.php?option=com_customcomponent&view=registration or inside my component with JRoute, the view will be shown with the wrong template (it will be show with the Standard Template and not the special template).
What could be wrong here?
It is necessary to put the Menu Item in the link.
JRoute::_('index.php?option=com_customcomponent&view=registration&Itemid=xx')

Joomla: How to assign custom layout to category?

I have a magazine using Joomla. I need to be able to have different layouts for different issues.
I copied the default template, modified it and it shows just fine in Template manager, but how do I actually assign it to a category so all articles added to that category would automatically use it?
UPDATE: Solution below seems to work... however now it seems to open it correctly only when I go through the blog view and when I use my link on the front page directly to an article it uses wrong layout?
If you are using Joomla 1.6 or 1.7, you should be able to assign a template to a menu item. So if you have a menu item pointing to the blog view of a category. Set the corresponding template to that menu item.
This is done in Extensions -> Template Manager -> Styles -> "Your Magazine Template"