I'm building a site in Kentico 12 MVC and working on setting up content personalization. The normal way to do this is to add an editable area in the view:@div@
@Html.Kentico().EditableArea("area1")
@/div@
Then, in the CMS, the Page tab will show an empty area where the user can add a widget with personalized content. The problem is that the content I want to personalize is located in my site's login box, which is a common element on every page, so I'd need to manually add a widget into the editable area on every page individually. But my site has over 300 pages, so that's totally impractical.Is there a way from within my view model that I could check if the editable area has any widgets, and if it doesn't, output default content instead? I'm trying to see if there's an API method or something that would let me count the number of widgets inside an editable area, but I can't find anything in the documentation.
↧
Kentico 12: detect if an editable area contains any widgets
↧
how to combine 2 methods with different objects (same code in both methods)
New poster here, but have been using SO for a long time now.I'm a bit rusty from C# coding and I have something I'd like to optimize in my code. I have 2 methods that have the exact same code, but with a different object (the object has some different properties, but the ones that are used are the same in both methods). The query is built differently before the call to the method. Is there a way to combine the methods easily so that I can still use it with one or the other object?private static void SetQueryMainFilters(DocumentQueryObject documentQuery, DocumentQuery repeaterQuery, out DocumentQuery outRepeaterQuery)
{
if (documentQuery.NodeID @ 0)
{
repeaterQuery.WhereEquals(KenticoConstants.NODE_ID, documentQuery.NodeID);
}
if (documentQuery.DocumentID @ 0)
{
repeaterQuery.WhereEquals(KenticoConstants.DOCUMENT_ID, documentQuery.DocumentID);
}
outRepeaterQuery = repeaterQuery;
}
private static void SetQueryMainFilters(DocumentQueryObject documentQuery, MultiDocumentQuery repeaterQuery, out MultiDocumentQuery outRepeaterQuery)
{
if (documentQuery.NodeID @ 0)
{
repeaterQuery.WhereEquals(KenticoConstants.NODE_ID, documentQuery.NodeID);
}
if (documentQuery.DocumentID @ 0)
{
repeaterQuery.WhereEquals(KenticoConstants.DOCUMENT_ID, documentQuery.DocumentID);
}
outRepeaterQuery = repeaterQuery;
}
One of the method that calls the duplicated methodpublic static MultiDocumentQuery RepeaterMultiDocumentQuery(DocumentQueryObject documentQuery)
{
MultiDocumentQuery repeaterQuery = new MultiDocumentQuery();
[...]
SetQueryMainFilters(documentQuery, repeaterQuery, out repeaterQuery);
return repeaterQuery;
}
Currently, I have a MultiDocumentQuery object and a DocumentQueryObject. The code is the same in both methods, but the object is different.Is there a proper way to do this so I can avoid code duplication? If you have a better solution to offer me, I have my ears open for suggestions. I need to be able to either call the Multi query builder or the regular query builder, with pretty much the same properties but different behavior. It uses Kentico's DocumentQuery and MultiDocumentQuery.Thanks!
↧
↧
How can I use the same media url between the page builder and live site?
Hi there,I have an issue on the image url between the page builder and the live site.Once I attached files, I found that the image urls are different between the page builder and the live site. For example, in the page builder , the image url is @https://[OUR-DOMAIN]/cmsctx/pv/administrator/culture/en-AU/wg/52761417-63a6-4989-8008-a74476751cfb/readonly/0/ea/1/h/b49bf010dc67edf0691835b6b2e5b4e35fc00fdd410bcbc745befbd6a7bf1c30/-/k12media/getattachment/5fd46d88-fe94-478e-ac20-f91b20d3cdc0/awards-1.png?uh=c78b56a2c50e1aa2d9fdf4cd5890189bca2516d410ee63f8b61199ba7ca70060@administrationurl=https%3A%2F%2Fadmin.stagingcms.rest.com.au%2F@. But, in the live site , it is @https://[OUR-DOMAIN]/k12media/getattachment/5fd46d88-fe94-478e-ac20-f91b20d3cdc0/awards-1.png@How can I use the same image url of the live site in the page builder or preview? I am using UrlHelper.Kentico().ImageUrl to create the image urls.Thanks in advance,Luis
↧
Hierarchical transformations find out level
Hello i would like to know if it is possible to find out the level the transformation is rendering to apply some logic. My problem is i want to have a different style on the first level and on the second level from rest levels, i am trying to achieve that using header and footer transformations but i can't distinguish the level inside their code, and on that note is it possible to find the number of childs of each level? Thanks in advance for any advice
↧
Adding Activity records via the API
I am in need of adding Activity records via the Kentico API. I was originally going to add them via the
ActivityInfoProvider but then I came across the CustomActivityInitializerBasehere.What is the difference between using the two?I mainly need to record Activities of the purchase activity type. The data being recorded will eventually be used in automated marketing tasks. Would one have a benefit over the other in this regard?
↧
↧
Site localization
Hi,I have issues with making a website in multiple languages.Could you please hint me where I can find the forms/ frames with different writings to make bilingual.I tried to manage it from site localization section, still translating the resourse strings didn't give me the appropriate information.Kind Regards,
Loreta
↧
Boosting Title/DocumentName field in Pages/Pages Crawler Index
Does Kentico have any way to boost fields without building my own custom indexer? I would like to slightly boost title over content, since some pages are scoring higher due to referencing certain documents multiple times. For example a page title @Cancer Center@ is scoring 3rd, whereas a page called @Breast Cancer@ that has @Cancer Center@ in it's content multiple times is scoring 1st. I would prefer titles to get preference over content, as it's the most common thing people will be searching for.I would prefer not to build a custom indexer if I don't have to, but if there was a way to duplicate the functionality of the standard Pages / Pages Crawler indexer and just alter it slightly to include the boost, that's an option, too.
↧
Kentico 8.2 and 10 compatible with Windows Server 2018
Is Kentico 8.2 and 10 compatible with Windows Server 2018? We are planning to upgrade our server and wanted to move to Windows Server 2018, however I did not see that version listed as supported with Kentico 8.2 and 10. I want to make sure it is supported before making plans to upgrade our server. Thank you!
↧
Trying to debug a Kentico website but cant
I have a Kentico website project and I wish to debug and develop content on Kentico. I am a c# developer and wish to use Visual Studio Code.
How can I open the website in Visual Studio Code 2019 and work with it?I have the website open in my Visual Studio Code and can't find the contents of the website.
↧
↧
Can I make the Doctype on a master page (Kentico 11 Portal Engine) dynamic based on a macro?
I've inherited a Kentico 11 site that uses a doctype of @!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"@
The client wants to create AMP variants of their pages using Kentico's AMP module, which uses a subdomain for any AMP content.
The module also includes a boolean macro {% AmpFilter.IsAmpPage() %} that tests if you're currently serving AMP content.
https://github.com/Kentico/kentico-ampThe issue I'm running into is that AMP seems to want a doctype of @!doctype html@
. I don't want to change the doctype of the existing site, but it also doesn't look like I can evaluate macros within the master page template's doctype field.Wondering if anyone has come up against an issue like this; if there's a way to allow macros to be evaluated in the doctype field, or some other approach I haven't thought of.
↧
Kentico 12: detect if an editable area contains any widgets
I'm building a site in Kentico 12 MVC and working on setting up content personalization. The normal way to do this is to add an editable area in the view:@div@
@Html.Kentico().EditableArea("area1")
@/div@
Then, in the CMS, the Page tab will show an empty area where the user can add a widget with personalized content. The problem is that the content I want to personalize is located in my site's login box, which is a common element on every page, so I'd need to manually add a widget into the editable area on every page individually. But my site has over 300 pages, so that's totally impractical.Is there a way from within my view model that I could check if the editable area has any widgets, and if it doesn't, output default content instead? I'm trying to see if there's an API method or something that would let me count the number of widgets inside an editable area, but I can't find anything in the documentation.
↧
how to combine 2 methods with different objects (same code in both methods)
New poster here, but have been using SO for a long time now.I'm a bit rusty from C# coding and I have something I'd like to optimize in my code. I have 2 methods that have the exact same code, but with a different object (the object has some different properties, but the ones that are used are the same in both methods). The query is built differently before the call to the method. Is there a way to combine the methods easily so that I can still use it with one or the other object?private static void SetQueryMainFilters(DocumentQueryObject documentQuery, DocumentQuery repeaterQuery, out DocumentQuery outRepeaterQuery)
{
if (documentQuery.NodeID @ 0)
{
repeaterQuery.WhereEquals(KenticoConstants.NODE_ID, documentQuery.NodeID);
}
if (documentQuery.DocumentID @ 0)
{
repeaterQuery.WhereEquals(KenticoConstants.DOCUMENT_ID, documentQuery.DocumentID);
}
outRepeaterQuery = repeaterQuery;
}
private static void SetQueryMainFilters(DocumentQueryObject documentQuery, MultiDocumentQuery repeaterQuery, out MultiDocumentQuery outRepeaterQuery)
{
if (documentQuery.NodeID @ 0)
{
repeaterQuery.WhereEquals(KenticoConstants.NODE_ID, documentQuery.NodeID);
}
if (documentQuery.DocumentID @ 0)
{
repeaterQuery.WhereEquals(KenticoConstants.DOCUMENT_ID, documentQuery.DocumentID);
}
outRepeaterQuery = repeaterQuery;
}
One of the method that calls the duplicated methodpublic static MultiDocumentQuery RepeaterMultiDocumentQuery(DocumentQueryObject documentQuery)
{
MultiDocumentQuery repeaterQuery = new MultiDocumentQuery();
[...]
SetQueryMainFilters(documentQuery, repeaterQuery, out repeaterQuery);
return repeaterQuery;
}
Currently, I have a MultiDocumentQuery object and a DocumentQueryObject. The code is the same in both methods, but the object is different.Is there a proper way to do this so I can avoid code duplication? If you have a better solution to offer me, I have my ears open for suggestions. I need to be able to either call the Multi query builder or the regular query builder, with pretty much the same properties but different behavior. It uses Kentico's DocumentQuery and MultiDocumentQuery.Thanks!
↧
Smart Search results: Display DocumentName instead of title for a search result
Hi,In smart search transformation I want to display DocumentName when a search result displays results from PageType News. Is there a way to have a if else condition to display either title or document name based on a page type?Another issues: When smart search displays results from a News pagetype item, it links to the detail page of the news items which does not have any relevant information (it inherits from parent). Is there a way the link displayed in Search result be one of the fields on the News page type (like an external url field)?Any help will be appreciated.Thanks
↧
↧
Pagination
HiJust looking through the documentation on Kentico 12 SP, but there is nothing on the documentation which covers anything on pagination for lists, blogs etc...Could someone point me in some direction in where I can find anything on this?RegardsAnish
↧
Combine: Azure blob storage media library and file system media library
Hi there! I have a question about media libraries. Can I set up media libraries to get this? :PDF - file system; (https://domain.local/files/pdf/)Images - Azure blob storage; (https://cdn.domain.local/images/) (root of the blob storage, CDN endpoint)Other - file system. (https://domain.local/files/other/)If it's possible than how can I do it?Thank you.
↧
Kentico Upgrade from k10 to k11
Hello, We are upgrading Kentico 10 to 11 and having issue. Most of the issues I have tried to surpress for timebing but this one I could not resovled. Has any one expreince this issue if so any input on resolution?Server Error in '/' Application.
Unable to cast object of type 'CMSModuleLoader' to type 'CMS.Core.ModuleEntry'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.InvalidCastException: Unable to cast object of type 'CMSModuleLoader' to type 'CMS.Core.ModuleEntry'.Source Error:Line 47:
Line 48: // Ensures that registered modules are registered from AppCode/CMSApp assembly
Line 49: ModuleEntryManager.EnsureAppCodeModules(appCodeAssembly);
Line 50: }
Line 51: Source File: D:\Projects\Kentico\Kentico\web\CMS\Global.asax.cs Line: 49Stack Trace:[InvalidCastException: Unable to cast object of type 'CMSModuleLoader' to type 'CMS.Core.ModuleEntry'.]
CMS.Core.@@c__DisplayClass1_0.
↧
Kentico k10 to k11 Database upgrade in produciton
Hello, We are in process to upgrade K10 to K11 however unable to find the best way to upgrade production database. I don't think it's advisable to run upgrade tool inproduciton to run the database script. Can anyone point to the clear stepswise to upgrade prod kentico database?Thanks
↧
↧
Feature Request: Add multiple items to relationship at once
Hey all, Figured I would make a simple (logically simple at least) feature request. On a recent project we have had to add thousands of page relationships on different items and having to add them one by one on each page was really quite a chore. An interface to select multiple items for a relationship would be amazing. Example Solution: We have a relationship called @Treated Conditions@. We are on a Hospital Service page and have to add 50 relationships from that page to each treated condition. When opening the page selector to add the relationship, there is a @select multiple@ button that enables check-boxes next to each page so that we can multi-select. There might be some technical limitation to this, but I know that it probably is a feature that could save people a lot of time on relationship-heavy sites. If there is an easy way to already do this, let me know. I will feel quite dumb if that's the case.
↧
Is there any related with Kentico & Joomla?
my server (snort) detected some attempt to attack. Refer log below for reference:SERVER-WEBAPP Joomla JDatabaseDriverMysqli unserialize code execution attempt [Classification: Attempted User Privilege Gain] [Priority: 1]My website are using Kentico for web platform (CMS). My question, is there any related between Kentico @ Joomla?
↧
Tag API Call
Hi, Just wanted to confirm my understanding of Tags and Tag Groups. I am currently writing an API call to update tags on a number of document pages. My understanding is that there is a distinct relationship between the tags which must belong to a tag group, so my question is. for each tag i associate with a page i also have to assign the page to a tag group. Secondly i note on some pages they inherit the tag group, but no tags have been specified in the tag field. Does this mean all or no tags from the group are applied. I am assuming none ?
↧