In EpiServer 7 CMS editor, I have added multiple categories.
I have 2 issues then
1. Those are not coming up in code in CategoryList.
2. Category tab is not appearing in any of the pages
Should I be adding property to my pagebase like below to make it work?
[Display(Name = "Categories", GroupName = PropertyGroupNames.Categories, Order = 2011)]
public virtual CategoryList Categories { get; set; }
You don't need to add your own "Categories" to your page model. The categories are now stored within the PageData so you can basicly reach them by using
CurrentPage.GetProperty("PageCategory")
If you are at editmode in a page, you can reach your categories by clicking on "settings" and you will see them there in a selectbox. They do not look anything like they did in episerver 6 or earlier.
Make sure that you have created your categories by going to adminmode->config->edit categories. There you'll see your categories.
Categories are not in a separate tab anymore.
The new category picker is normally first on the content tab.
You don't need to define it in code.
Related
I have a combobox which I would like to populate with some info. Below is the code:
cmbSelectProject.Items.Clear();
cmbSelectProject.ValueMember = "Sid";
cmbSelectProject.DisplayMember = "Name";
cmbSelectProject.DataSource = new BindingSource(ApiCaller.LstProjects, null);
So, there is a class Project with the existing properties "Sid" and "Name". ApiCaller.LstProjects call returns a list of Projects. So I expect the "Name" to de displayed and "Sid" is used as value.. Instead I see the bunch of Project objects displayed in the dropdown.
What am I doing wrong in here? Thanks for the suggestions.
Try This sequence.
Set DataSource property.
Set ValueMamber and DisplayMember.
Refresh Combo. using Refresh() method.
Lets assume I have created my own custom view for a Link content type. When the user adds a 2sxc Content app to a Pane, then picks the Content Type (Link) then my custom View, when it first starts up, how can I detect that a) the View does not use a Demo item vs. b) the View uses a demo item and is showing the Demo item vs. c) its not the first time and there is a real user added Content (Entity) in place?
I have done stuff like this for the a) case:
var link = AsDynamic(Data["Default"]).First();
then checked if it was null, but it looks like my View code never executes and instead I just see, "No demo item exists for the selected template."
If I do assign a demo, is there a more elegant way to know that the Entity I am handed as Content.First() or Data["Default"]).First() is a Demo item and now a user created Entity? Currently I am hard-coding the EntityId in the template and testing for that.
The template system does not render the template if there is no demo item (unless it's a template without a content-type).
When we need this, we have two ways
give the demo item a unique value in one of the fields and check for that in the template
check the demo-item ID on GUID and check for that (Content.EntityGuid == ...)
IsDemoItem property added in 2sxc 10.06
Dynamic Entity
If a Content Editor "Hides" the only Content Item, the anonymous user will then see a Demo Item where the item was. This is confusing and unexpected from the Content Editor's point of view (as well as the public/anonymous user). If anyone else runs in to it, here is the simple code snippet to add to the start of your view. Basically, if the current user is not logged in and the item to display is a demo item, exit the View w/o displaying anything.
if(!Request.IsAuthenticated) {
if(Content.IsDemoItem ?? false) {
return;
}
}
Best to put it near the start of your first #{} Razor block.
Note: this will not throw an error in 2sxc prior to 10.6.x (because of the "?? false"), but it will not work either.
I'm a beginner Angular guy and I need some help structuring an application. The part I'm having difficulty with is a categorization system.
The Category model has the fields: title, slug, parent category, image, type. Categories can be of simple type (title only, no image) or full (title and image). Other category types should be possible to create in the future - for example, category with lengthy description and no children. Categories can be automatically expanded (a simple category with subcategories has its children expanded by default) or not (a full category by default is not expanded).
Visually, it should look like the following: a category has a title, and inside it the images and titles of subcategories, like apps look on your phone's home screen:
https://s3.amazonaws.com/ish-archive/2016/bjjcollective/20160215.bjjc-uiux.png
When you click one of those "app"-looking things, that subcategory's title gets added to the hierarchy of titles (so the categorization acts as a tree), and the subsubcategories are shown, as app-looking things.
When you click on the title of a parent directory, the children tree gets replaced with the expanded view of that category's subcategories.
Additionally, each category should have a url associated with it, for example: /categories/houses/kitchen/silverware ( /categories/:slug_0/:slug_1 or /categories/*slugs ? ) should be the page where silverware category is expanded, and its subcategories are shown. The slugs are not unique! So you can have a path like /categories/camping/kitchen/silverware as well, which would be different from "houses" silverware.
The backend API can have any shape that's usable by the frontend. /api/categories.json, /api/categories/houses.json?depth=2, /api/category/houses.json - it's completely flexible.
So I am looking into ui-router and directives to make this happen but I don't see how I should structure my code. To tie views to the url I have to use ui-router, not directives, right? Is recursive views a thing in Angular? And, if each category has a sub-view, how do I restrict rendering of subcategories to only the one relevant subview? I have a pretty solid idea how to do it in jQuery, but how do you do it in Angular?
I am working with visualforce. Is there a way to get the fieldname from the id in the rerendered section of the visualforce page.
{!$CurrentPage.parameters.cid} gives me the id. Suppose that cid has the id of the contact object. How can i display certain fields of the contact object in the outputpanel. I tried the but it gave whole detail. I only want certain fields.
Hope you are referencing this documentation in your work. $CurrentPage.parameters.parameter_name is a way of getting query string parameters in Visuaforce and there is nothing to do with that for altering the fields you need in the Contact section.
If you are using <apex:detail /> for the Contact section, what you can do is update your Contact object detail page layout as you need.
I am facing a problem in cake php pagination. In my project I have Category Suppose 'Wooden' , In this I have Sub Category as 'Wooden Tables' and further 'Wooden tables' has many products. In sub category i am doing pagination . I am showing 10 items per page. Now the problem is that When i click on any of the pagination link , its missing sub category number. for example : the URL should look like this : http://amazingtech.in/lariya/products/index/4/page:2 but when i click on pagination link the URL look like this http://amazingtech.in/lariya/products/index/page:2 . It is missing the sub category number 4 , which leads to page not found error. and when i manually enter the URL Like this . It works.
I don't know how to modify pagination URL. Thanks in advance.
Pagination - that is selecting or sorting results - isn't the same as searching for them by criteria, even though Cake supports passing them as an array or named params. That is to say, conditions of your find() are not preserved in the same way as your pagination params.
So You'd need to include your condition as a named or query parameter: eg: assuming your category is 'category' (it might be category_id, replace as needed)
http://amazingtech.in/lariya/products/index/category:1234/page:2
Or possibly:
http://amazingtech.in/lariya/products/index/category:Wooden/page:2 //more SEO friendly
Or even:
http://amazingtech.in/lariya/products/index/4/page:2
http://amazingtech.in/lariya/products/index/Wooden/page:2 //more SEO friendly
To do it this last way you'll need to setup your controller to look for the first URL param in and assign it as a condition of your find() operation:
public function index($category = null) {
$conditions = array('Products.category_id' => $category);
...etc
}
MORE: CakePHP Cookbook Parameters
That way, when you paginate - as long as you're going through the same controller - can preserve that category.