listing same content on diffrent pages in MODX - modx

I am trying to add a small "3 box news segment". I wanted it, to be visible on multiple pages. Normally I would just use chunks but the thing is that I want to be able to modify "3 box segment" content and preferably with a ritch text. Any Ideas how to accomplish that?

You can use getResources to grab the content from 3 hidden resources this way you still keep your chunks for the segment layouts and your actual content is in the resources [which you can update with the rich text editor].

Instead of getResources you could also use getResourceField to get the value of a field or template variable on for example the homepage. This allows one place to manage it, and you can just reference it with getResourceField when you want it to show elsewhere.

Related

Automatically Migrate OrchardCMS BodyPart to LayoutPart

tl;dr
Within OrchardCMS, is there any way to automatically migrate the contents of a BodyPart into a LayoutPart? And if so, how?
Detail
I am upgrading an old Orchard instance (v1.8.x) that used the old BodyPart. The goal is to update OrchardCMS to the current release, and with it, migrate to the new Layout system added in v1.9. Enabling the Layout module will add the LayoutPart to content items such as Page, but the two parts both exist on the Content Definition, and moving content from the BodyPart to the LayoutPart seems to be a manual process. Is there any way to automatically migrate content from the BodyPart to the LayoutPart, perhaps even if it was nested within a single Grid->Row->Column(12)->HTML block? And if so, how?
I think you should be able to do this with a little bit of playing around and a little bit of find & replace in your code editor. I would take an empty new site and export two pages, one with content in the BodyPart and one with content in the LayoutPart they way you want it to look. You should be able to see how they are different, I haven't looked at how they export recently, but I think the body part html is contained in a pretty simple xml tag while the layout part includes some code to designate all the elements, with the html contained inside.
Next step is to export all the content from your site (using import/export) and use a good text editor to convert all the body parts into layout parts using find & Replace.
Finally, import the edited file back into the site.
I haven't tried any of this so obviously have a database backup handy and test this out in a dev environment first. Also, I'm guessing that if you follow the directions above you will end up with duplicate content in the body and layout, so you probably want to make sure your import has an empty body tag for each page.

Drupal how to add a search filter to admin content page

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.

Correct way to override content being displayed?

I want to enable the use of codes inside of content on a Drupal website. For example, when creating a block or a node, i want users to be able to insert code like this:
[[EMAIL]]
Depending on what the current language is, it might display a different value. The tricky part is not retrieving the value I want to replace it with, but figuring out at what point I replace it?
What hook or function would I use, to replace any node content that has the specific code in it, with another value? And the same for a block or any other content that is going to be displayed?
I solved this by creating my own input filter. I copied this example.

Orchard Module Override a Field Driver

Hello fellow Orcharders!
I'm not sure if what I want to do is possible, but I want to override the Driver for a single Field in the Module I'm writing.
The Field I want more control over is the Content Picker field. Basically I want the Content Picker to load the shapes for their respective content items. I've looked at Sipke's Content Picker Widget for an example on how to load shapes, however I'm unsure of the best/recommended approach to implement something similar in my module.
I have the Content Picker Field attached to my Content Part, and the default Content Picker comma list of Content Item titles appears as expected. I have tried to define an Alternate in Placement.info, but I can't load the Content Item shapes from within the Alternate view.
Presumably, as per Sipke's example, these shapes need to be built in the Driver and passed along. If this is correct thing to do, how could I do this in the most Orchard-y way with minimal "hacks". Looking into the debugger, I could "hack" my way to the Field I need in my part's Driver; but the module I'm building will be reused in the future by people unfamiliar with it, and if they start adding/deleting Fields from the Content Part, I'd like everything to behave accordingly!
Of course, if I must take the "hacky" option, I'm willing to do so, but only after I've exhausted all other options. This is my first module, and I've learnt an incredible amount along the way, and I'm really trying to learn the "right" way to build an Orchard Module as best I can.
Thanks in advance!

Dividing long content to subpages

I need to divide long content to sub-pages.
Rule for dividing: Heading1 (H1)
Cms-system: MODX Evolution
As far as i know, there is nothing in modx to use for this kind of problem.
I probably got to do this manually anyway, but i still would like to know if there is a way to do this in MODX Evo / Revo.
Edit:
I need to do this in MODX; sub-pages got to be actual subpages, and original page becomes to container.
Navigation will be done with wayfinder.
Edit2:
All done.. manually. Question still open, though.
This is not possible out of the box and I don't know of any extra that archieves what you want. You would have to write a plugin that acts everytime you save a resource and split up the content, create/delete sibling resources as needed etc. Sounds like a lot of work for what you want to archieve to me.
I suppose you have a look at the MIGX extra. It provides you with a TV with the possibility to store an indefinite amount of distinct TV content sets. Have a look at the documentation and Mark Hamstra's tutorial (with screenshots) to see how it is done. You should define one MIGX entry to consist of a text field for the <h1> and a rich text field for the content of the "subpage".
Afterwards, you can use form customization to hide the original content field and display your MIGX Tv instead.
I think, this is a much easier way to archieve, what you want, and can't think of any way, where you would benefit from actual subpages.
Edit: Sorry, I just recognized that you were asking about Evolution, not Revolution. My solution would work in Revo, but I don't think there's something like MIGX for Evo. Sorry, my mistake.
not 'out of the box' you will have to run your content through a snippet to parse it into separate divs or something that you can run some javascript on to possibly 'tab' the content.
If you need to show the 'subpages' in your navigation, you will probably have to use the gatResources extra to parse your content ~ which will be very expensive on resource usage.
You can (depending on how you're using the tree) just create actual sub resources under the parent resource, using Ditto or Wayfinder to build navigation for it.
If you can't use the tree like that (though from your description I think you can), you could also set up a number of template variables ("content1", "content2", "content3" etc) and show that with a simple snippet or so.

Resources