Template to provide static HTML wrapping a page-specific value - kentico

I am creating a page template. Each page using the template will have a single unique value that gets embedded into the page HTML. The rest of the HTML is constant for all pages. Assume the following is the desired result:
click me
I want a template that provides click me, while allowing the individual pages (content admins) to provide id.
I've tried using an Editable Text web part, and putting the "before" and "after" HTML in the HTML Envelope before and after sections, and adding the ID on the "Page" tab. However, that is not quite working. What is the best way to accomplish this?

This can be done. What you'd want to do is add that field to the page type fields you're adding those pages with. For instance, say you have a list of locations under /locations.
i.e.:
/location/chicago
/location/new-york
/location/minneapolis
The locations themselves (Chicago, New York, Minneapolis) are your custom page type and have a unique field called LocationID. On your template, add a static text webpart (not static HTML because the WYSIWYG editor overwrites the markup you add) and simply add this:
click me
If the LocationID field has a exists AND has a value, it will output it, otherwise it will just leave the URL http://www.example.com/
If you didn't want to show that link at all on other pages, then set the Show for page types property based on the page type you want it to show for in the Visibility section of the static text webpart.

Related

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.
I guess you need to check with regex if Editable area html contains widget tag "<object type="widget" >"

Redirect to created content from a dynamic form

The Dynamic Forms module has two handy features: Creating content using bindings from the form, and redirecting the page after the form's submission.
I would like to be able to redirect to the new content item after the form has been submitted. Is this possible through the current set of tokens or other available feature?
I've tested out using various combinations of workflows and the {Request.Content.*} token so far.
Let's say you the content you are using is a custom content type "Animal" and you have a form field named "AnimalName" that is set to TitlePart in Bindings. You have the form (named "Create an Animal") set to create an Animal content item and publish it.
For this example, make sure that the Autoroute for Animal is set to {Content.Slug} in the content definition.
Create a workflow that starts with "Dynamic Form Submitted" for "Create an Animal". Set a Redirect as the next step with the URL /{FormSubmission.Field:AnimalName.Slug}.

Add list of item in editor view page of orchard cms driver class

I try to create custom content part with following specification.
I need to add list of items in database with same editor template view page of driver.
I want to include one form with required fields with an add button, by using this add button I want to add more number of rows with given field values in database.
I have checked Orchard documentation in this link, they provide sample with single item add in editor template page. In my case I need to add multiple items in editor page.
In display view page of driver, I want to retrieve collection of data from database and rendered in display view page.
Please share some details for this.
Thanks,

Mixing Orchard CMS content with module

I am currently working on an Orchard module. This module contains an MVC application including the views. I would like to make the module as configurable as possible. One of the items that I would like the customer to configure is the way the MVC views from the module look. Part of it will be determined by the theme. But not everything. Consider the following scenario:
The module contains a view for placing an order. The view displays a form in ´normal view way´. That is field labels and input labels. But at the head of the form each customer must be able to define his own set of instructions to display. Or maybe the customer wants to put there a message for pointing the customer to some other actions.
In the most ideal way I would have a content page where the customer can put all kind of content and one specific block that is the result of the view of the module. Kind like a web part. I can´t find out if it is possible and how that is achieved.
Edit for clarification
Module creates a page like this:
TITLE
FORM
So both title and form are outputted by the module controller.
I have managed to create a layer with the condition that the url matches the page with my form.
I have added a HTML widget to this layer in the content zone with position 1 (tried 0 to).
However the pages looks like this:
TITLE
FORM
WIDGET
instead of
WIDGET
TITLE
FORM
Returning a ShapeResult from your controller action will ensure that your view is themed and benefits from widgets, which are your "kind like a web part" thingies in Orchard.

Using a MulitpleLookupField in MOSS '07 Layout Page

I have a page layout for my MOSS '07 site that I want put a MultipleLookupField in. The field will point to a multiple lookup column in my custom content type that points back to the pages library so I can have a "Related Articles" field.
I've gotten the field to show up correctly--it's even editable when the page is in edit mode! But when you click on the link that shows up there, it display the page's properties view instead of the page itself.
There's lots of properties on the control, but there's little documentation at MSFT as to what they do.
Does anyone know how to change the link's URL to the actual page instead of the properties view?
Here's the tag I'm using:
<SharePointWebControls:MultipleLookupField
ID="MultipleLookupField1"
FieldName="RelatedIssues"
runat="server"></SharePointWebControls:MultipleLookupField>
The link takes me to here: /Pages/Forms/DispForm.aspx?ID=6&RootFolder=*
I want it to take me here: /Pages/faq1.aspx
Unfortunately the lookup control is designed to be compatible with generic lists and does not understand that the document libraries have a file with a specific url associated.
You will probably have to find a custom lookup control on the web or roll your own.

Resources