Customizing Search in Orchard - orchardcms-1.7

Is there any option to completely control a Search module with a Summary view? I am struggling to get there. I have the following settings so far:
In admin I created an Index called PublicSearch with a number of fields.
I am getting a search result which is a mixture of two content parts - Question and Expert
I have a Part view to be used in search result for Experts called ExpertSummary.cshtml. The view only contains the following elements now:
#model dynamic
<p>Expert Summary</p>
When the search result is coming I only expect the "Expert Summary" to be visible in Expert region of the Search but I am getting an additional "body" section (truncated to X characters). It seems to me because "body" is selected as a field when I created the Index it is coming up.
Each Expert record has an image of expert which is coming up in the search result and When I take out <Place Fields_MediaPicker="Content:1" /> from Placement.info it disappears, which is fine.
But I want this summary to be completely controllable in ExpertSummary.cshtml - like a two column layout where the left col will hold the expert image and the right one will hold a brief description along with some other info - but everything would be in the View - should not come from Orchard search module as defaults.
In short I want Orchard's Index and Search modules to be functional and working like it is now but the layout and information I want to control completely using custom HTML in Parts/ExpertSummary.cshtml view.
Is this at all possible? If yes, how?
Please suggest. I am completely lost my way in Orchard framework!

I'm not completely sure I understand your question... Orchards search returns a Summary view by default. So you need to control the layout of your summary. Use shape tracing to create a new alternate to change the layout of the summary view. So ExpertSummary won't control the entire layout, it will just control the Expert part. Then use placement to decide what to display. http://docs.orchardproject.net/Documentation/Understanding-placement-info
Also, tagging questions with "orchardcms" will be more useful than "orchardcms-1.7".

Related

Wordpress - Display Content Conditionally

I am fairly new to Wordpress. I am writing a real estate site, and I want to have a Service Area page that displays the Counties that we serve in various states. So what I want to happen is to have a dropdown list where a user can select a state, and based on the state that they select, a text area will display that counties that we service in that state.
So basically, I want to store text content in the form of counties that will be displayed based on the conditions of a dropdown list.
I have no idea where to start. Is there a plugin that works for this kind of situation such as a form plugin that can store content, or am I going to have to write custom PHP/Javascript to make something like this happen. I am asking because this seems like a common scenario on websites, I just don't know where to look.
Thanks for any suggestions that you may have!!
So what I ended up doing was creating a select box in html that when a change happened on the list, a javascript function was called that changed the visibility of a text area and also set the value of its content to display all the counties that I needed. Ended up being much more simple than I expected. No PHP functions and short code necessary.

How to display the number of nodes or tags in Drupal?

I am new to Drupal. I am working on a site that requires me to display the number of nodes (content) in a group/tag. Similar to the way the number of modules and themes currently available for Drupal are shown on the homepage of Drupal.org.
Can anyone help me on this, or point me to the right module(s)?
I seem to understand that this question is a variation of what the purpose is of one of the Out-of-the-box examples that you get by simply installing (and enabling) the charts module, and without any additional configuration.
By doing so, and assuming you have the views module installed/enabled also, a new view is added to your site. Here are some more details about it, quoted from the linked page above (to which I added some formatting here):
You can see the charts created via this new view in your own site by
navigating to charts/examples or by using a menu link with a title
like Charts examples. After doing so, a page is shown with 2 sub-menu
tabs:
the first tab is titled Built-in examples (this example is used to
showcase Using the Charts API).
the second tab is titled Views
example, and is what is created from the new view created during the
installation of the charts module. As an alternative to using this
tab, just navigate to charts/examples/views in your site. You should
then see a column chart and a pie chart, which are followed by a
tabular display also. Both charts and the table display contain data
about the total number of nodes for each of the available content
types.
Since you're new to Drupal, this might be a good starting point to get you going with some of the basic stuff of the Views module. You can use these views to further tune/clone these samples to make them fit your exact needs.
Disclosure: I'm the maintainer of this module,
I hope this does not violate the site's policy on self-promotion.

Drupal 7 Views Module - Can not add wrapper in view “content: title” field

I am setting up a blog. I have developed several views to sort out the various types of articles “business, design, news, etc.” On the article page and in the teaser however I would like to stye the “content: title” field. As seen in the example below.
In the research I have done it sounds as though you can accomplish this by creating a wrapper class in the “style settings” options in that titles configuration menu.
Here is where I am having difficulty. When I select “Customize field and label wrapper HTML” for instance nothing happens. I am not able to the field where I should be able to enter my custom wrapper class. I have tried hitting “apply” then going back, I have applying the section and then saving the changes to the view, and I have tried applying saving and flushing the cache but with no result.
Is there a configuration some where that is preventing me from applying this option? Or am I doing something wrong. It is frustrating to no end any advice would be much appreciated thanks.
To add a wrapper in views "content:title" this is the most easiest way -
Just go to Title fields rewrite section.
you can wrap an element using Style Settings of that specific field. just click a field and there you can see the options. wrap label / field in your desired element.

Drupal "Jump To" Block Filtered by Terms with Children

So, I'm working on a site right now in Drupal that has a block designed to allow a visitor to jump to different "projects" (just a term). Most of the projects have content associated with them. However, some projects become empty from time to time as content is moved around and projects are restructured.
I currently have a view in place that shows an exposed form listing all of these projects as a dropdown and displaying it in a block. Is there a way for me to customize this view to only show projects that have content associated with them?
This would preferably be done entirely with the view. However, I would love to see any solutions you all can come up with. Also, please excuse my terminology if any is incorrect. I'm very new to Drupal and still getting used to the labels and structure of the whole CMS.
Any help would be greatly appreciated. Thx S/O!
Try this:
Edit the view. Under the Advanced section => Relationships, click add.
Add the relationship "Taxonomy term: content with term", and make sure to check "Require this relationship".
If this makes your view full of duplicates, try this answer to a question at drupal.stackexchange.com.
Hope that helps!

Kentico CMS search results

How do I change the Kentico CMS search settings so as to display a part of text from search results as in Google? Presently it shows only the path in the results.
It depends on how you have your search setup really.
At the page level if you are using the Portal Engine model, which the majority of people use now, you have to check the Widget that you are using, basically it boils down to a regular search or Smart Search.
If your using the ASPX Template model you may have to open up your source for the page and see which usercontrol file your using from ~/CMSWebParts/Search/ or ~/CMSWebParts/SmartSearch/
Once you figure out which user control you are using it's a matter of inspecting the Transformation that it uses. Most likely you'll be using one of the following:
CMS.Root.SearchResults
CMS.Root.SmartSearchResults
CMS.Root.SmartSearchResultsWithImages
Click on Edit Transformation and check out which field is inside the Call to SearchHighlight, normally, "Content". Then you know it's pulling from the main content of the document. I've also seen this be tied to a different field like "Title" or "Caption". But the default is "Content".
If you still dont see results with part of the text, make sure you have a Smart Search Index setup, found in CMSSiteManager -> Administation -> Smart Search. If you don't see your site in the Index list then you need to add one. Make sure you rebuild it and optimize it (click edit on the row to get to those options). After that is all rebuilt then you should see the text appear under the result.
One thing to note, is that as #jao has mentioned, this only takes the first 280 characters of the content of the page. If you're matching search text doesn't happen to be in the first 280 characters, then no highlighting will occur.
try the following in your search result transformation:
<p>
<%# SearchHighlight(HTMLHelper.HTMLEncode(TextHelper.LimitLength(HttpUtility.HtmlDecode(HTMLHelper.StripTags(GetSearchedContent(DataHelper.GetNotEmpty(Eval("Content"),"")),false, " ")), 280, "...")),"<span style=\"background-color: #FEFF8F\">","</span>") %>
</p>
This will show the first 280 characters from your content, with the search terms highlighted.

Resources