Tuesday, January 16, 2018

Passing Item Rendering Parameters To Sitecore MVC

Sitecore having functionality to pass the custom addition properties/parameters from item rendering to the Sitecore MVC view or code behind. This makes flexibility to the marketer or content author to make the custom functionality of any rendering on the basis of passed addition parameters. For example HTML Marquee, background Css etc.

There are two ways to use to achieve this functionality:
1) You can pass additional parameters under section Parameters that is shared field works on the basis of key and value. Both are Textboxes.
Example
Key:Background  and Value : Red
Prensentation -> Details -> Final Layout -> Rendering -> Edit
@Html.Sitecore().CurrentRendering.Properties["Background"] //cshtml
//or
RenderingContext.Current.Rendering.Properties["Background"] //controller code

2) Second approach you can use any Template as additional parameters which provide flexibility to working same as other item template. For this, first you need to create template and go the rendering which you applied on the Presentation. After that select that additional template on the "Parameter Template" Drop Down which you have created. Now you can use this template on the template and pass the values of this template as additional parameters to Sitecore MVC.

Cshtml
@{
    string BackgroundCss = string.Empty;
    var rncontrol = Sitecore.Mvc.Presentation.RenderingContext.CurrentOrNull;
    if (rncontrol != null)
    {
        var parms = rncontrol.Rendering.Parameters;
        BackgroundCss = parms["Background"];
    }
    <h4 class="@BackgroundCss">@Model.name</h4>
    <hr>
}

Monday, January 15, 2018

Sitecore APIs with Presentation & Layout Details

Coding for item Presentation Rendering with the use of Sitecore API. You can make it as customozied as per your requirement.Enjoy!!!







Setting Dynamic Datasource at runtime to the rendering

Thursday, August 25, 2016

Sitecore 8.1 XP Admin Tools




                                  URL : To access the URL
                               /sitecore/admin/default.aspx  or /sitecore/admin

Administration Tools with Sitecore Version 8.1

Summary:

Cache
Caches overview.
Database Cleanup
Perform various cleanup operations on specific databases.
DB Browser
The interface for various item manipulations.
EventQueue Statistics
Overview of the EventQueue processing.
Fill DB - Sitecore Item Generator (7.0)
Fill the specific database with dummy items.
Jobs Viewer
Overview of jobs execution.
Ling Scratch Pad (7.0)
Execute custom search code.
Package Item
Package specific items with their dependencies.
Pipeline Profiler (7.0)
Pipelines execution timings.
PublishQueue statistics
Overview of the PublishQueue processing.
Raw Search
Search for the specific string in database or on the file system.
Remove Broken Links (7.0)
Remove broken links from the specific database.
Rendering statistics
Overview of renderings performance
Restore Item
Restore items from archive.
Security Tools
Various login and user management features.
Serialization
Serialize and revert databases
Set Sitecore Application Center Endpoint (6.6)
Change Application Center endpoint address
Show Config
Merge configuration files.
Sql Shell
Execute sql sripts using the specific connection strings.
Unlock Admin
Unlock Admin user.
Update Installation Wizard
Install Sitecore updates.
User Info
Logged in user details
Media Hash (7.5)
Generate values required by Sitecore to return the resized image
Rebuild Reporting Database (7.5)
Rebuilding the reporting database between SQL reporting DB and MongoDB
Path Analyzer (8.0)
Rebuilding the historic maps, triggering the map agents etc
Redeploy Marketing Data  (8.0)
Redeploy the default experience analytics segments and Path Analyzer Mapping
Install Language  (8.1)
It install the new language for the sitecore content
Rebuild Key Behavior Cache (8.1)
Used to rebuild the key behavior Cache
 


2.1       Cache Admin Tool
The Sitecore Cache page displays details about the configured cache settings (the defined maximum thresholds) as well as the current use. Measured and retrieved caches include database prefetch, data cache, item cache, HTML cache as well as specifically defined caches. The cache admin page also gives you the opportunity to instantly clear the sitecore caches.
URL: /sitecore/admin/cache.aspx





  • Cacheable: Select this checkbox to enable HTML caching. If your rendering has only one view, you’re done.
  • Clear on Index Update: Select if this component uses Sitecore’s ContentSearch API.
  • VaryByData: The cache will save a separate version of the HTML based on the datasource of the rendering (Sitecore will use the Context Item if no datasource is selected).
  • VaryByDevice: If you use this rendering on multiple devices, select this checkbox.
  • VaryByLogin: If the rendering is displayed differently for logged in users (but not different for each logged in user), select this checkbox.
  • VaryByParm: If you set custom parameters on the rendering/sublayout, select this checkbox.
  • VaryByQueryString: If querystring parameters affect the display of this rendering, select this checkbox.
  • VaryByUser: If this component displays user-specific information, select this checkbox.
NOTE: The all are checkboxes which you will find on the presentation details.

Different Database Cache:

=> Prefetch Cache

Prefetch caches contain items that Sitecore accesses during and immediately after initialization and items with children that Sitecore often accesses as a group. Sitecore maintains those caches over the life of the application.

Each database prefetch cache entry represents an item in a database. Database prefetch cache entries include all field values for all versions of that item, and information about the parent and children of the item.

If you set Bigger Prefetch, it gives slow startup, but it can give you better performance while opening Content Editor or Page Editor because your items' data are already fetched from Database to Prefetch Cache.

In reverse, if you get Smaller Prefetch, it gives fast startup, but it can give you less performance while opening Content Editor or Page Editor because your items' might not be fetched to Prefetch from database. Thus, setting bigger or smaller amount of Prefetch, both have their own pros and cons.

Prefetch Cache Best Practices

If prefetch is customized according to our use of pages of site, it will give you the best performance. For that you have to findout three things:
- Which are the pages used the most in your site like Homepage.
- Which are the pages, whose children are accessed frequently.
- Which kind of pages(templates) are used the most.
Then, try to Prefetch all those items which are used in these pages.

For example,
- Homepage is the most frequently visited page, then you should prefetch Home item and its immediate children.
- Similarly suppose News pages are visited frequently, then you should prefetch News Template and their children too.

See how these configurations will work:
  • <cachesize>300MB</cachesize>
    describes Sitecore will do prefetch upto 300MB.
  • <template desc="mytemplate">{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}</template>
    Defines that items of the specified template will be prefetched.
  • <item desc="myitem">{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX }</item>
    Defines that the specified item will be prefetched.
  • <children desc="childitems">{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}</children>
    Defines that specified children of the given item will be prefetched.
  • <childlimit>100</childlimit>
    Defines a limit to the number of children to include in the prefetch cache.
=> Data Cache

·         Data caches are dependent on database prefetch caches, which operate at a lower level. Like database prefetch caches, each entry in a database data cache represents a single item in a database, including parent/child relationships and field values for all versions in all languages of that item. Sitecore does not pre-populate database data caches.

The Caching.DefaultDataCacheSize setting in the web.config file specifies the default size for database data caches.

The purpose of this cache is to minimize the amount of requests to the database. This is extremely important for performance, as requesting items from the database is rather expensive.

=> Item Cache

Item caches store items. Database item caches are dependent on database data caches, which operate at a lower level. Each entry in a database item cache represents a single version of an item in a single language. Sitecore does not pre-populate database item caches.

The Caching.DefaultDataCacheSize setting in the web.config file specifies the default size for database data caches.

Database item caches contain objects of type Sitecore.Data.Items.Item.

The Caching.DefaultltemCacheSize setting in the web.config file specifies the default size for database item caches.

It would be best to have the average size of an item in Caching.AverageltemSize configuration attribute. 
  
=> Standard Value Cache

Standard values caches contain standard values for data templates in the database. Sitecore does not pre-populate database standard values caches. Database standard values caches do not depend on any other caches.

The Caching.StandardValues.DefaultCacheSize setting in the web.config file specifies the default size for database standard values caches.

Sitecore uses the Caching.StandardValues.AverageValueSize setting in the web.config file to estimate the amount of memory consumed by the database standard values cache.

Manage Website Cache 

If you don't specify cache at a level then it gets its values from default website cache in the web.config. We can customize all these cases site-wise. 


<cacheSizes>
 <sites>
         <website>
            <html>10MB</html>
            <registry>0</registry>
            <viewState>0</viewState>
            <xsl>5MB</xsl>
         </website>
       </sites>
</cacheSizes>

=> HTML Cache

The HTML cache (also known as the output cache) associated with each managed Web site contains the output generated by individual renderings under different conditions.
Sitecore provides caching options which allow the rendered data to be retrieved from cache if the data source, device, authentication status, user, rendering parameters and/or query string parameters are the same as the previous request.
Sitecore allows developers to define output cache criteria in three places:
  • In the Caching section of the sublayout and rendering definition item. (Global)
  • In the properties of the presentation component when you statically bind it to a layout or sublayout. (Static Controls)
  • In the Caching section of the Control Properties dialog when you bind a presentation component to a placeholder in layout details. (Dynamic)
HTML cache is disabled in the preview, webedit and debug modes.

=> Filtered Item Cache 

The filtered items cache associated with each managed Web site contains information about versions of items relevant to different users.

The filteredItemsCacheSize attribute of each /configuration/Sitecore/sites/siteelement in the web.config file specifies the size of the filtered items cache for that managed Web site.

The Caching.DefaultFilteredItemsCacheSize setting in the web.config file specifies the default size of the size filtered items caches.

=> Registry Cache

The registry cache associated with each managed Web site contains data used primarily by the Sitecore user interfaces.

The registryCacheSize attribute of each /configuration/Sitecore/sites/site element in the web.config file specifies the size of the registry cache for that managed Web site.

The Caching.DedaultRegistryCacheSize setting in the web.config file specifies the default size for the registry caches.

  Media Cache 

Sitecore stores all media files to physical file system. All other cache are stored in RAM actually.

When publishing is done, Sitecore does not clear Media Cache like it does for other caches. Sitecore clears these media cache periodically.

    User Cache

The client data store cache stores information about each authenticated user, such as the username or other user properties.

The Caching.DefaultClientDataCacheSize setting in the web.config file specifies the size of the client data store cache.

The disableClientData attribute of each /configuration/Sitecore/sites/site element in the web.config file enables or disables client data caching for that managed Web site.

     Proxy Cache 

Sitecore has a proxy item feature that allows items in one area of the content tree to appear in another.

These proxy items behave in the same way as normal items but have unique IDs to distinguish them from the original items.

The proxy cache keeps track of these IDs and how they map back to the original items.

             How cache clearing works?

HTML cache

On publishing of any item, HTML cache is cleared. If we are using multisite module, the we can rewrite HTML cache module to clear HTML cache for item's related site. HTML cache for each page is built from multiple items, so publishing a single item, we cannot judge at how many items it would affect. That's why we have to clear full site HTML cache.

Item cache

Whenever any item is published, its Item Cache is also updated. If you publish an item which is linked to other items, then these items are cleared as well.

If you publish standard values or a template, it will clear all items based on that template.

If you delete/recycle/restore any item, its parent item's cache also updated, similarly while doing sorting, their siblings cache might get updated.

Data cache

Data cache is updated incrementally when changes take effect after a publish. It is rebuild incrementally when the items are requested again.

Prefetch cache

By default, items/templates specified in the config file are cached in Prefetch Cache when application initiated. Prefetch cache are updated same way of Data Cache.

Note: An ASP.NET application server restarts effectively removes all entries from all caches, except media cache. If we are using ASP.NET caching based on some items' values, we must clear ASP.NET cache too on publishing.
2.2       Clean Up
The database cleanup tools allow you to perform various cleanup operations on specific databases. This is similar to the Clean up Databases tool accessible through the Control Panel but allow you to select the tasks to run at a much more granular level (it is missing the “Clear Caches” step, but you can do that already from /sitecore/admin/cache.aspx).


2.2       Database Cleanup Admin Tool
   
This tool to cleanup the various cyclic dependencies,invalid language,orphans,blobs etc from the core,master and web database.

2.3       DBBrowser Admin Tool

You can view various sitecore DB (core,master,web and filesystem) with raw values.

2.4       EventQueue Statistics Admin Tool

The Event Queue Statistics queue provides an overview of Event Queue processing from the table in SQL Server. It includes details about the number of events in the table, the last processed timestamp and the last timestamp. The tool is useful for verifying that cleanup tasks are running correctly so that large Event Queue does not cause performance issues. There is also a handy tool on the page allowing you to delete events older than a specified time period.
Note the refresh settings on the top of the page, which will cause the page to reload every X seconds with updated statistics.

2.5       FillDB Admin Tool

The page was introduced in Sitecore 7.0. It allows the developers to create huge amount of test data. The page needs to be enabled via setting EnableFillDB in /App_Config/Include/Sitecore.Buckets.config. A quick walkthrough on how to use this page will be covered in a separate blog post, as the specifics are not so easy to explain. Meanwhile here is an article from the Sitecore Development Team which explains how to use the page with Sitecore 7.2 –  FillDB Updates.

2.6       Jobs Viewer Admin Tool

The Jobs Viewer displays a list of jobs which are currently running, are queued to be run or have recently run. This is useful to figure out “why is the system running slowly”, or “why has my publish been queued”.
The default “after life” that information is maintained about a job is 1 minute and unfortunately this is set using the JobOptions when the Job is run, so it can’t be controlled via config as far as I am aware.
Note the refresh settings on the top of the page, which will cause the page to reload every X seconds with updated job information.

2.7       LinqScratch Pad Admin Tool

A good place to test your Sitecore queries over the current context. Pretty good testing tool when executing queries over indexes or when you are not using any ORM. For more information about the LINQ Scratchpad you can check this article from the Sitecore
Reference Link: Here

2.8       Package Item Admin Tool

The Package Item tools can be used to generate packages of items with their dependencies. Unlike the Package Designer Wizard accessible from through the Desktop though, the UI here is much more limited but the tool will package the dependencies of an item as well: all item references, presentation items if you’re using Webforms, custom assemblies, workflow items and templates. Very useful for creating packages of pages for distribution.

2.9       Pipeline Profiler Admin Tool

In Sitecore version 7, Sitecore introduced a new profiling tool, the Pipeline Profiler. From the Pipeline Profiler tool, you will be able to monitor performance and utilizations of all the Sitecore pipelines used by the Sitecore solution (the Sitecore client and the website). The Pipeline Profiler tool listing the profiling data for each of the pipeline processors. 

Getting this data, you will be able to pinpoint the processors spending most of the time and improve performance by optimizing those specific processors.

2.10     Raw Search Admin Tool

The Raw Search Tools allows you to search for a specific string in database or on the file system. This can you useful if you need to locate where a specific piece of text is defined either in your own site or maybe default labels or settings in Sitecore! You can even conduct a wildcard search but beware of performance implications!
The search can be carried out against all attached Sitecore databases (core, master, web) as well as the file system. Yes, it will even scan through the contents of the files on disk and (rather unexpectedly) provide a link to /sitecore/shell/Applications/Layouts/IDE.aspx?fi=%2f{1} to the matched result. The Developer IDE lives on!

2.11     Remove Broken Links Admin Tool

The Sitecore Remove Broken Links page was introduced in Sitecore 7. It does what it states. It removes all broken links to missing items in a selected database. This is especially handy when you have reorganized, imported or cleaned up your content. The altered items can be serialized so that they can be restored across different instances if needed.

2.12     Rendering Statistic Admin Tool

Located at /sitecore/admin/Stats.aspx this page provides rendering statistics for all registered sites. Includes load times, cache sizes, etc
This tool provides the necessary insight into what presentational components have been loaded for each site. It also provdes information on load time, amount of time it was loaded (and how many times the cache was hit), when it was last ran and so on.
Alongside with the showConfig, Pipelines and Cache pages, this page serves as a vital tool for fine tuning and tweaking of your solution.

2.13     Restore Admin Tool

Located at /sitecore/admin/Restore.aspx this page helps you reset Archived content back to a specified database.
This admin tool feels somewhat needless and outdatedand does not adhere to the authentication and look&feel used in the other tools.

2.14     Security Admin Tool

In this we can reset User Password, Login user as security user or ASP.Net Login Form into Sitecore Context. Also we can create new user.

2.15     Serialization Admin Tool

Located at /sitecore/admin/Serialization.aspx this page helps you serialize database content into XML.
Serialization allows you to backup database content / place it into version control and create the basis for a version comparison. Just like when creating Sitecore packages, where content is serialized in the background, this is a direct interface to help serialize database content into flat files for further use. The tool also allows for either Serialization or updating of the Sitecore databases.

2.16     Set Sitecore Application Center Endpoint (SetSACEndPoint) Admin Tool

Located at /sitecore/admin/SetSACEndPoint.aspx this page allows you to change the Sitecore App Center endpoint. It is useful when playing whit Email Campaign Manager.

2.17     Show Config Admin Tool

Sitecore merge the all sitecore configuration files .config files from /Include folder at run time which can see in the browser with url  sitecore/admin/showconfig.aspx. But it don’t displayed System related configuration For example <system.web></system.web> Node. Best practice to create separate custom config file which you had customized. For any customization in web.config, best practice to use any web.config transformation files which merge in the web.config at runtime.

2.18     Sql Shell Admin Tool

2.19     Unlock Admin Tool

Located at /sitecore/admin/Unlock_admin.aspx this page helps you unlock the locked-out admin account.
When the Administrator account would become locked out of the system due to for example too many invalid login attempts, this page can be used.
As a means of securing this page and functionality, the "Unlock Administrator" button is disabled by default, modify the ASPX to enable further functionality.

2.20     Update Installation Wizard Admin Tool

This tool is use to allow you to upload .update package and execute them over the sitecore instance. It also provides you whether you want to update or not certain item at runtime. When you are using TDS it will create automatically the .update in the release mode.

2.21     User Info Admin Tool

This tool providing all information about the logged user.

2.22     Media Hash Admin Tool
            url: /sitecore/admin/mediahash.aspx

This page allows to generate the hash values required by Sitecore to return the resized image.

2.23     Rebuild Reporting Database Admin Tool
            url: /sitecore/admin/RebuildReportingDB.aspx
           
Starting from Sitecore 7.5 Sitecore now uses MongoDB for storing analytics data, but most of the aggregated data is stored in the SQL Reporting Database. In the rare cases of inconsistencies or problems with the processed data – this page can be used for rebuilding the reporting database. Keep in mind that this process requires your instance to have secondary reporting database attached in order to transfer the data. You can find more information about rebuilding the reporting database on the official documentation.

2.24     Path Analyzer Admin Tool
            Url: /sitecore/admin/PathAnalyzer.aspx

Admin page for Path Analyzer Utilities. Contains the maps manager and if they are deployed correctly. Also used to rebuilding the historic maps, triggering the map agents etc.

2.25     Redeploy Marketing Data Admin Tool
            Url: /sitecore/admin/RedeployMarketingData.aspx

Used to redeploy the default Experience Analytics segments. Also has an option to redeploy the Path Analyzer Mappings.

2.26     Install Language Admin Tool
            Url: /sitecore/admin/InstallLanguage.aspx

Used to install a new language for the Sitecore content. Also has an option to run the Sitecore UI in the selected language, so be careful when using this feature !

2.27     Rebuild Key Behavior Cache Admin Tool
            Url: /sitecore/admin/RebuidKeyBehaviorCache.aspx

            Used to rebuild the Key Behaviour Cache.For more details you will be find on       
            the sitecore official site here