I am using localization for view as given below.
<p>#Localizer["Use this area to provide additional information."]</p
I need to create a global resource file from where I can localize the string of view without using ViewModels folder in resource folder.
Resources/ViewModels/Account/RegisterViewModel.fr.resx
Is there any way to use localization of view without using IViewLocalizer or without using #Localizer in view?
here is how to do it :
on your resx file properties, add "PublicResXFileCodeGenerator" for Custom tool.
It will generate the "designer file".
You need to do it only for main language file.
After that, on your view in cshtml, you can use it like this :
//my resource file is named Welcome.resx
<h1>#Welcome.Title</h1>
Related
in my asp.net core web project i have two partial views that are displaying products. the first one shows them in a big layout, while the second one displays them in a smaller, regular layout.
both partial views need a method that composes a SEO-friendly url (using the product name and further information which are provided from the ViewModel). this method should somehow be accessible to the both views.
where can i place it inside of the asp.net core application? are there any particular conventions that must be followed?
#Html.Partial("ViewName")
Uses a view in current folder with this name. If none is found, searches the Shared folder
#Html.Partial("ViewName.cshtml")
A view with this name must be in the same folder
#Html.Partial("~/Views/Folder/ViewName.cshtml")
#Html.Partial("/Views/Folder/ViewName.cshtml")
Locate the view based on the application root. Paths that start with "/" or "~/" refer to the application root
#Html.Partial("../Account/LoginPartial.cshtml")
Locate the view using relative paths
I have a custom list definition in production environment with list instances created with the following definition:
<View BaseViewID="0" Type="HTML" WebPartZoneID="Main" DisplayName="All Items" DefaultView="TRUE" MobileView="True" MobileDefaultView="False" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/issues.png" Url="Forms/AllItems.aspx">
I need to changing the setup path in some way so the AllItems.aspx view of the document library displays documents from it's parent site document library by e.g. CQWP. I've attempted this by using SPView.SetViewXml() but this has no affect.
I have attempted to follow Stefan Stanev's SharePoint blog
I've successfully changed the setup path in development with Unghost a custom SPView but I really do not want to go down this path.
I have customized the viewpage.aspx by mapping to templates\pages and editting / adding the required web part and adding feature upgrading to create a new view set it as default, change the ViewXml by calling SPView.SetViewXml but this does not work.
Is there a way of updating the content database post production to change and customise AllItems.aspx of a custom document library without directly querying content database?
I am having issues implementing a MVC4 Custom View Engine to override the default locations for partial views. I have implemented the code in this example.
My issue is that an error is thrown before CreatePartialView is initiated if the path does not match a value in PartialViewLocationFormats array when HTML.Partial is initiated/executed. Nothing is going to match as the objective of this implementation is to have dynamic paths. Any insight would be appreciated.
Just supply the path by your own way instead of using the default way that MVC to
set partialPath from another source such as passing it to view from controller , or creating your view finder class .
return base.CreatePartialView(controllerContext, **partialPath** );
for example, I hava a partial template named _header.php, I want to use it in both Post, Forum module, How can i write renderPartial(), to load this template.
placed your partial view to app layouts dir.
<?php
$this->renderPartial('//_header.php');
?>
absolute view within a module:
the view name starts with a single slash '/'. In this case, the view will be searched for under the currently active module's view path. If there is no active module, the view will be searched for under the application's view path.
absolute view within the application:
the view name starts with double slashes '//'. In this case, the view will be searched for under the application's view path. This syntax has been available since version 1.1.3.
reference getViewFile()
I'm trying to add a custom field type to our SugarCRM 6.2 instance. I want to add an "email link" type field. I want it to function like the URL field, but prefix every address with "mailto://" prefix instead of "http://".
It will be good if that field type is available in studio while creating new fields or in minimum, some custom code to achieve it.
What I did up to now:
- I've copied include/SugarFields/Fields/URL to include/SugarFields/Fields/Email
- In modules/ModuleBuilder/language/en_us.lang.php I've added a title for the email field
But unable to get anything working. Any help?
First of all you do not want to make any coding changes outside of the custom directory. Doing so outside of this directory is not upgrade safe.
Create a custom fields directory in your custom folder
Create new template files (.tpl) for your custom field
then you can just add a regular textfield in studio
then edit your viewdefs in your custom directory
in your tpl file concatenate the mailto:// to your text and just add the persons email address and it will take care of the rest for you
why you need custom field type for such small functionality? Just add your custom JS file in editviewdef.php. Then use some jQuery selector to perform certain action. For detail view, you can use view.detail.php to add required text in run time.
This will help you to store less data in database and display more in frontend.