Is it possible to hardcode Kentico webparts into a layout? - kentico

Kentico 8.2.
I've got a layout "master" file - the creatively named Master.ascx.
I've got three web part zones in the layout: header, main and footer. Main just includes a content placeholder which is overridden by the next layout down - home, standard, whatever.
I could just drag and drop web parts onto the header and footer web part zones on to the "design" tab, but I don't want to for a few reasons:
Which web parts go in which zone is stored in the database, which isn't versioned in Git. The layout file itself is versioned via the "store CMS Virtual Files on disk" option.
The layout markup inside the header is complicated enough that I'll end up needing to have 4 or 5 web part zones for 4 or 5 web parts - or I'll need to write a layout web part or drag row layouts / column layouts in, etc - it seems much simpler to just hardcode web parts inside bespoke markup.
I find editing a plain text file with Visual Studio much faster than dragging and dropping web parts into a zone, and the same applies for anyone else who'll ever work on this site.
Which web parts go in which web part zone doesn't ever change - there's always a primary nav, share-on-facebook, etc - which web parts are included will never need to be in any way dynamic.
Is it possible to just hardcode a web part into my layout?

To answer your question, no you cannot hard code webparts in your layout. Simple reasoning is webparts are not part of a layout, they are part of a template . The webpart definition for each template is stored with the template in the database as XML. You can see this by going to a template and selecting the Webparts tab and it will display all the XML for each of the webparts on that page template.
Understand where you're coming from with your 4 points. What you also need to consider is:
what happens when you want/need upgrade or apply a hotfix?
from the client, content editor and content administrators perspective, having everything in code, renders the CMS pretty useless.
if you code everything in a physical file, it's then pretty pointless to have a CMS if it requires a developer or a physical code change for every request
The point of the CMS is to be dynamic and database driven. Not everything can reside in the file system, database or a code repository. Kentico has some very strong developer tools you can enable like workflow, versioning, and check-in/out.
I'd also enable your DBA and ensure they have a valid backup and recovery plan in the event of some disaster.

It's not possible, because it goes against the Portal Engine development model. If your main issue is the unavailability of these objects in GIT consider the option to save virtual objects (https://docs.kentico.com/display/K82/Deployment+mode+for+virtual+objects) to the file system, so they are picked up by GIT. I'd also suggest to keep the website upgrade safe (e.g. by using the Portal model), because the next version will feature CI support (saving of all DB objects to the file system) http://www.kentico.com/product/roadmap which is due to be released in 2 months

Related

Using Kentico CMS with pre-generated HTML

I have a huge amount of content that is in pre-generated static html pages. I am working with an organization that runs their web site using Kentico (11) on IIS. They wish to host the pregenerated HTML, but to have a consistent look and feel on the pre-generated pages.
Is there a way to includes tags etc inside the pre-generated html that gets kentico to process the content to give the standard look and feel for the website, without having to convert the content (potentially 100k+ pages) to normal kentico content (it just doesn't seem like a feasible approach, since the content is refreshed from the source regularly)
There is definitely no out of the box way to that. I also agree it is not a great approach overall. However, if someone was very determined to make it work and if you really had to, custom programming could make that happen.
You could create some custom logic and use the Kentico API (maybe in a scheduled task if the content is periodically refreshed). The custom code could possibly build out a content tree that is based on the folder structure of the files (if portal), or build out some routing logic (if mvc) to route requests. Those requests that match the ~/filename.html could then be intercepted by Kentico and your custom code, read the contents of that filename.html from disk, and use it as a datasource type of webpart (if portal engine) or a repository / model (if MVC), then use that info to populate the presentation layer of the response of the final html to the browser. That way you could wrap that pre-generated content in a master page with some level of control of what the header and footer look like (if portal engine) or a shared layout (if MVC).
Again, I don't recommend it. It might be very slow and tedious to attempt as well as have performance and scalability issues.
It could be a cleaner approach to somehow get that content into a SQL database and then use standard programming to deal with it in the Kentico layer / website.

Is there any possibility to create custom widget for Azure hosted API Management?

https://azure.microsoft.com/en-us/updates/new-azure-api-management-developer-portal-is-now-generally-available/
Extensibility—The portal comes built into every API Management instance (excluding the Consumption tier). If you wish to extend the portal’s core functionality (for example, create your own widgets to fetch data from other sources), fork the GitHub repository, implement the code changes, and self-host your own modified version of the portal.
Is it so that we can't do custom widgets on Azure hosted Developer portal? If so, then this is a backstep from the legacy portal as there we could write custom HTML and JS to get custom features.
I believe still there are couple of things you can do.
Home page
The default Home page is filled with dummy content. You can either remove the whole sections with the content or keep the structure and adjust the elements one by one. Replace the generated text and images with your own and make sure the links point to desired locations.
Layouts
Replace the automatically generated logo in the navigation bar with your own image.
Edit the content of the portal, customize the website's look, and publish the changes.
Please refer https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-developer-portal-customize and let me know how it goes
You can submit a pull request to the repository.
If you create a custom widget and this will be useful for many users it can be included in the default set of widgets.

How to create templates in Kentico 9?

I need to create few templates for E-commerce site. Can anyone guide me as how to create templates in Kentico 9 ? There is an existing site and I need to create five other templates for the same. Am totally new to Kentico.
Please help.
There are many generic templates in Kentico, so you could clone any of them and modify to your needs - this might be easier for you to edit existing one as you'll have an example.
I'd recommend you to take following steps:
Go to Pages application in Kentico administration
Select any page in content tree on the left
go to properties -> template
Save as new template (so you do not screw up exting one) and save your changes
Switch to Design tab - this is where you build/configure you template
On the Design tab there is green line with template name and hamburger menu, where you can choose edit layout - this is where you can implement markup of the page as well as split your page into zones. After you accomplish html for you page save changes and close current dialog.
Now you should be back to Design tab. Here you can add web parts to zones you've specified in the layout. There is huge amount of different web parts (user controls). All they have different purpose and settings, so you should check documentation and figure out which one should be used in your particular case.
Try editable text, editable image, repeater, navigation in order to get an idea how it works.

I want to implement SharePoint, but I want to design it my way

I am aware of a program called "SharePoint Designer 20xx), and I would like to know if any of you have modified the default master page to make it.. less confusing and more simplistic. Can this be however I want it or is there limitations?
I also found this:
http://www.expertsharepointconsulting.com/images/Blue%20Large.PNG
I would like to implement a design similar to this! If I were to download a "Free sharepoint master page", would this design only work for the main page of SharePoint? as in if I were to go from the newly added masterpage, to a page called "reports", would it be completely different? If so how can I get around this?
You can create customized masterpages whichever way you want. Usually you don't touch the default ones, specially because you can break some system pages with that. Just create new ones from them or from the minimum.master one.
As an example of a Sharepoint Website using a very customized master page I can point you to a publishing website project I was involved for a Portuguese company: http://www.ana.pt/en-US/Pages/Homepage.aspx
It's all Sharepoint 2010...and it is fully customized
You can of course use the same template for all pages, just have to set it on the root site and say that all sub sites inherit from it.
To achieve the level of design changes you see on that web site you have to build new master pages, page layouts, use JS, CSS and user controls (the website uses little to no web parts).
we don't use Sharepoint designer because that would mean the files becoming unghosted, which can be pain sometimes, and sharepoint designer is not a very good tool.
The way we do it is by implementing everything on visual studio and deploying it via WSP packages. This way everything stays ghosted on the file system. You can check an example here:
http://mihirsharepoint.wordpress.com/2012/11/23/creating-custom-master-page-in-visual-studio-and-deploy-it-to-the-sharepoint-site/

Deploying site pages in SharePoint

I have around 9 web parts and 3 pages to be deployed. Each page will be having 3 webparts.
From a deploymnet perspective, i think i have the following two options:
Deploy the pages using a feature. The pages will have webparts present.
Create a custom site definition with a document library and have the three pages as part of the document library.
Can you please let me know which one of the options is better or is there any better solution?.
Please note that the solution needs to work on WSS 3.0 as well.
I would code the whole thing as a feature. You can staple it to the site definition for the site type you want it activated on.
If ever you need to migrate to the next version of SharePoint or another server it is easier to not have any custom site definitions. Also, the features leaves the site in a normal out-of-the box state; if you ever remove the feature nothing breaks.
Also, unlike the site definition it will also allow you to run it on sites that where created in the past.
First you need to deploy the webparts using WSP. Once it populated in webpart gallery you can copy the pages from page library and can paste in production.

Resources