I am beginner to Orchard. My purpose of starting this discussion is, to make beginners aware about Orchard Fundamentals.
I am currently Developing on web site using Orchard. But most of the times I am facing difficulty in rendering contents and how to place content on front end. As well, use of content items, content types and modules. Usually, I get confuse in using all these things. For example : I have created new content type for displaying latest post on my site, with date and user's profile picture. So for that my question is, "Is it right that I have created content type for it? or should I have to make module? and if yes than can I use my content type as a widget on my homepage? "
FYI: I went through the documentation and plural sight's video. But I was not able to clear above fundamentals.
Sorry for any inconvenience or any stupid questions, but at this time it seems bit complex for me. Can anybody please help me to clear my fundamentals of orchard?
Thank you,
Sohil Shah
I am currently Developing on web site using Orchard. But most of the times I am facing difficulty in rendering contents and how to place content on front end. As well, use of content items, content types and modules. Usually, I get confuse in using all these things. For example : I have created new content type for displaying latest post on my site, with date and user's profile picture. So for that my question is, "Is it right that I have created content type for it? or should I have to make module? and if yes than can I use my content type as a widget on my homepage? "
Is it right that I have created content type for it? or should I have to make module?
Sure, a ContentType just means that you can create instances of that specific type through the CMS.
or should I have to make module?
Do you want to re-use your contenttype across different projects? If so, then you should create code that creates the contenttype for you (in a migration script) and put that in a module.
can I use my content type as a widget on my homepage?
Yes, you need to enable your contenttype to be a widget. You can do this also with a migration script like so (add the WidgetPart and settting Widget stereotype:
ContentDefinitionManager.AlterTypeDefinition(
"MyWidget",
x => x.WithPart("WidgetPart")
.WithSetting("Stereotype", "Widget")
);
Related
I need to build a comments section on my apostrophe for users to be able and leave comments/feedback around content that someone will create in pages. That would require to create collections in the database as well as allow users to comment only but not to remove any the module/widget. Also, comments need to, of course, be linked to pages.
Not really sure, how I can approach this task. Whether, to build a separate microservice or a widget to handle this. I have read the tutorial for building a contact form in apostrophe, also tested. However, I don't really need to have an option on the Admin Bar as comments are linked to each page, I need the form to be static (don't want any users to remove them or add more than one on a single page), also want the comments to appear below the form once they have been submitted.
Any idea of how I can do this?
Thank you for your time.
Dcram
EDIT
Well, before I needed to do this for pages and I even managed to post the comments specific for each page where it should be. However, needed to make a few changes on my site and now this comment widget appears in pieces like blogposts! However, haven't being able to display the specific comments for each piece. Is there any way I can find the piece page url similar to data.page._url so that I can compare with the one attached to each comment?
Thanks!
We almost always use Disqus for this purpose, but if you need a commenting functionality that is internal to your site, there is the apostrophe-pieces-submit-widgets module that can be extended for this purpose.
You would definitely want the comments to be an instance of an apostrophe-piece in the docs collection, which would mean it would by default be included as an item in the admin bar. Easy enough to hide that, however.
Following this pattern would result in creating / configuring 3 project-level modules:
comments - extends apostrophe-pieces, defines the comment piece type
comments-widgets - extends apostrophe-pieces-widgets, a widget to display comments on a template (you could also hard code this behavior into a template instead of making it a widget)
comments-submit-widgets - extends apostrophe-pieces-submit-widgets, a widget to display the front-end form that users use to submit their comments
Building this sort of functionality directly into a piece and its widget player is not too difficult, check out this project for more
https://github.com/stuartromanek/apostrophe-comment-system
Steps:
Checkout project / install / create user / get up and running
Create a Comment piece from the admin bad (Home Page Comments, for example)
Add the new piece to singleton widget on the homepage
Comment!
This code should give you a pretty clear guide for creating backend functionality that can be interacted with on the frontend.
Permissions for interacting with the widget itself should be managed through apostrophe-permissions http://apostrophecms.org/docs/tutorials/intermediate/permissions.html
I created a custom Type that has a UserPart attached to it.
According to this issue on GitHub you can't add a CommonPart to content that also has a UserPart because it causes a StackOverflowException but I would still like items of my custom Type to show up in the content list. I already store CreatedUtc and PublishedUtc in the custom PartRecord, can I manually plug these in somewhere?
EDIT: For clarification, my specific scenario is that I am building a public facing Orchard website based on existing data that was used in a private application up to this point. I have a legacy table with user accounts that need to be mapped to Orchard Users but they also represent travel agencies that visitors should be able to browse and that Orchard admins should easily be able to edit and create through the Dashboard. I got the idea to create a TravelAgency type with a UserPart from Sipke's webshop tutorial
Content Types do not require to have a CommonPart to show in the Content List. If i remember properly its done by triggering the Creatable() in your migrations.
Also if you have a UserPart, you could Lazy loaded or just reference it via Foreign Key.
Why would you like something like that to be part of the Content List? I usually keep my business-specific Content Types tucked away in a nice section, so there are easier to visualise and use for users.
There is definitely a bug but as they comment you could extend taxonomies to accomplish your task and keep in mind sometimes changing the Orchard Codebase might fit your purposes, you only have to keep track of your changes when you upgrade next time. I have done it a couple of occasions to fit my projects.
If i remember properly, its been a while.. If you look in the core code where the Content List is created it looks for Creatable() Types. digging even more inside the code, chances are the Query in charge will join the CommonPart, hence your problem. You could easily add another query in the controller and add whatever you are after. The problem though, will be refactoring the rest of actions to accommodate your your type too. Way easier isolating your new Type. had to look at it for you, check this baby: Orchard.Core.Contents.Controllers.AdminController
I've never used Drupal before (development or managing content). I was asked to extend the admin content page to have a filter and simply don't know enough to get moving quickly.
Can anyone tell me if adding a search by text filter in the admin content area requires code or is there a CMS feature like adding a node for this task.
If code is required, is there something like a hook for this area? Not sure where to start. I will be investigating on my own but pointers to get me oriented to Drupal would help.
By default Drupal provides search mechanism ready to use. But there are also additional module which can improve search experience. You don't need any coding to use that search. You already have search form block ready to use.
Go to Structure -> Blocks and find block called "Search form". Now all you have to do is to put that block in some region and it will appear on front-end. Of course if it's not already styled by your theme it may be needed to put some extra CSS to make it look nice. There are also some template files which you can override and put some your HTML if you need.
There's also template file for search results page (which of course will work out of box also).
You may also need to create new block region if you want to place your form at some specific place, not covered by any existing region defined by your theme (easy thing to do!).
See https://drupal.stackexchange.com/q/30633/101329, the "Admin Views" module lets you configure the search form as you like.
I am using drupal 6. I created a content type called 'Mobile' using CCK and added content for it. I want to change the way the content is displayed to the user. How do i do this.
Currently looks like this. I want to play around with the fields in this only for this content type. How do i do it and can i do some work around with the form of the mobile content type.
Questions like "teach me how to walk"
You need to learn Drupal theming system. you can get general idea http://drupal.org/node/17565 and by looking at node.tpl.php from your theme - that's for the beginning.
P.S: as far as I see from your other questions, you didn't tried to search in the web for this.
I need to rename the content type I created a couple months back and
have been using for a document library, assigned site columns to, created
document library views for and have added workflow to.
It appears that this is quite simple to do under the site settings for content type. However it is often the simple, apparently straight forward things that cause unforeseen
issues.
Does anyone know of any gotchas when it comes to renaming a content type?
Here's some guidelines, the main statement though is:
The general guideline for evolving the content type IA is to never change or rename content types or their aspects, make new ones and hide the old ones.
You can set the SPContentType.Name property and then call SPContentType.Update(). Considering the guidelines linked to in Colin's answer you should test this in a non-production environment first.