how to add a dynamic sidebar on drupal?
(Like how do we create a sidebar with the top 3 videos)
Create a Block View and filter it by your video content type. Limit it to 3. Then on the blocks configuration page, drag your newly created block into the sidebar of your choice.
You can do the same for your news content type. Just create another block view that's filtered by your news content type.
Related
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" >"
I have a generic page template that I wish to reuse for lots of pages, but each page also needs to have its own template within that. The generic page template might include a page banner and breadcrumbs for example.
The way I'm currently doing this is having every page be an ad-hoc clone of the generic template, however, this isn't easily managed when changes need to be made to the generic template itself as I then need to make that change on all ad-hoc templates too.
I could get around this by creating a new page that uses the generic template at the parent level and then nest all my pages under it, acting as a master page, but I feel like that's polluting the content tree unnecessarily as I already have a master template at the very root.
Is there a way to make page templates inherit from other templates without actually creating a physical master page in the content tree?
If it were possible to make specific webpart containers not shared to all pages that use the same template that would work too.
ad-hoc are not good as you understand.
You can have 2 master templates: 1 will be your root, 2nd one down in the tree. All page under second master can inherit both templates at same time:
For example you have:
the root master for the whole site that contains site menu and footer and placeholder
your store master template for you store which has store menu and banner and placeholder.
All your products under the store master will inherit both store master and root master. For that you have to go
template >specific ancestor pages > and check both masters : root and store
Another option to share content is add placeholder web part to your pages and point it to the shared page (you have to set "Page to display" property). I have a couple masters that are completely different but they share the same footer. So I have place holder on both of them that point to this shared footer page.
Having a page template inherit from another template will work, the problem is if you don't use that page template on a page, there will be no content for the child page template to inherit from so defeats the purpose of inheritance. Best bet would be to add those items to a parent page template. Assuming a content tree like so:
Page
-- Page 1
-- Page 2
On "Page" add your items in that template and hide or show them based on page type and or level. Then for the "Page 1" and "Page 2" pages, set a default page template for those page types. Then the user will not have to add or select a template, it will auto select for them. Then all they ahve to do is add content for the banner under that "Page 1" or "Page 2" page. The breadcrumbs should then auto show based on the child page showing or setting the node level.
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,
Using orchard 1.6. I've created a content type 'ImageUpload' which has 2 fields 'Image' and 'Date'. So the user can select todays date and upload an image. The uploads can be viewed from the 'Content Items' section of the dashboard but...
I would separately like to access/view the uploads from a different section(as the user wont have access to view the content items page) Iv set up a navigation menu but how can I view the records?
The content items are stored in the 'ContentItemVersionRecord' table...?
I don't fully understand your question. View the content items on the front end? Try using the projections module. You create a query that gets content of ImageUpload type and then you create a projection page that will use this query. Enable Projections feature, it comes with 1.6
I have a custom themed orchard site - I am new to Orchard.
All pages have the same header with primary navigation, and footer. I have set header & footer up as Zones.
There are 4 main sections, 2 require a second navigation on the left; Information & FAQ.
I would like to dynamically create pages for those sections in the CMS - and have the page added to the appropriate second navigation menu, then when clicked navigate to that page (showing the correct navigation menu on the left - with the right styling for the rest of the page).
In simple steps what's the best way to do this - and does it need me to edit the Layout or other files in Visual Studio (I can if required).
I have found several articles on this online - but they all apply to completed themes, not one being created from scratch.
(I also don't have this 'map' of the site on the widgets page - how / should I create one somehow?):
Thanks.
As i understood what you are after is creating a Widget. Basically to show any content in your page you must create appropriate ContentType and attach required parts to it , and to display it you must enter url of that content in browser's address bar or click in a link for that content which in either case it will navigate to a new page and will display content inside [Content] Zone. but if you want to display a Content in a special Zone and special pages, Creating a Widget is the way to go.to create a widget the only thing required is to add a WidgetPart to it and give it Stereotype of 'Widget'.you can do this by making following changes in Migration file for your desired ContentType :
ContentDefinitionManager.AlterTypeDefinition("MyType", cfg => cfg
.WithPart("WidgetPart")
.WithPart("CommonPart")
.WithSetting("Stereotype", "Widget"));
this will turn your Content Type into a widget which can be placed in any Zone you want.
to add your widget to a Zone navigate to widgets from dashboard.
and then select the zone which you want to place your widget in :
and then select your widget
and finally select the layer in which your widget will be shown.a layer is set of rules which determine in which pages your widget will be displayed.for example selecting homepage will display your widget only in home page, selecting default will display your widget in all pages and so on.to define your own rule check here.
Edit :
to create new zone in your theme just include the Zone name in theme.txt file then open up Layout.cshtml (one resides in your custom theme's view directory) , and do following :
given your zone name is SecondaryNavigation then add following code inside your theme
#if (Model.SecondaryNavigation != null)
{
<div id="secondary-navigation" class="group">
<div class="inner">
#Zone(Model.SecondaryNavigation)
</div>
</div>
}
with this an additional Zone will be displayed in zone list and then you can put your widget inside your newly created zone.and about that picture you asked about.it is an image file which created by author of the theme and named 'Theme.png' and will displayed as a preview in manage widget screen , you can create it for your own theme and put it in your theme view directory.
EDIT 2
The migration file itself is not important.the only thing which is important is to define a class which drives from DataMigrationImpl , orchar will pick your migration file and run it automatically , migration file has firstly a Create method which returns 1 , and for each further update you must define a method called UpdateFromN in which N is current version your module is in, that will return 2 , 3 , ... what you can do in a migration file is creating database tables , creating ContentTypes , ContentParts , ContentFields , etc. there is already couple of modules shipped with orchard , check them and get the idea.