Good Afternoon from frozen Stirling!
I wonder if you have some advice about getting into Matrix Development, and specifically about what might be involved in creating Content Types for our system.
In our work with our designers we've developed a range of reusable CSS/HTML 'assets' such as contact boxes, staff profiles, and Post-it note style text boxes. The usual sort of stuff.
I would like to make these assets available to our content editors to be able to drop them into their web pages as easily as possible. Something like Library Items that you might be familiar with (as our users are) from Dreamweaver and Contribute.
At the moment we are approaching this using Paint Layouts to style Nested Content with the appropriate HTML/CSS. For example, a "Contact Us" Paint Layout drops the appropriate user-editable Metadata of the Nested asset into correctly marked-up HTML of the Paint Layout.
We've found this to be a bit too clunky and awkward though, so I thought a custom Content Type (one for each of our 'assets') would be a better solution. Users would then able to edit the content in-line - right next to the WYSIWYG content that's also on the page (unlike with Nested Content which is not editable inline).
Do you think this sounds like a good idea? I'm familiar with PHP and can just about find my way around a Linux command lineā¦
Custom Content Type
It is actually very easy. I have made a content type for FCKEditor/CKEditor which we use across our site.
Just look in packages/cms/content_types for a bunch of the ones used in Matrix. Try duplicating the raw_html content type and give the folder your own name. Then, go through and name each file, excluding asset.xml, and give them the same naming. Open up each file and also make name adjustments to the classes and functions that require it.
Then, run step_03.php and compile_locals.php and it should install your content type. Once it is installed you can start messing around with the php code and see it change on the page when you refresh. Just be sure, if you ever do an upgrade, to add your content types back to the system BEFORE and of the steps are run. If not, you might be in a world of hurt.
Let us know how it goes.
Hi Nic,
Your blog post about the FCK Editor (http://www.zedsaid.com/blog/fck-editor-in-mysource-matrix) was really interesting.
I started off with a fresh Matrix installation (with a little help from http://www.zedsaid.com/blog/installing-mysource-matrix-in-15-min) - a nice sandbox environment on a virtual machine for me to safely hack to bits.
I cleared the first hurdle when I discovered that the rendering of the Asset takes place when the Commit button is clicked, and the HTML that will eventually be displayed on the front end is actually held ready-to-use in an Asset Attribute called 'html'. Before realising this I had been looking for a front-end rendering function since I assumed assets were built on-the-fly. I presume holding the HTML in an attribute gives better performance? Anyway, I've since looked at the parent class Content_Type and it makes sense to me now!
Following from there I added a few additional attributes to store the user-selectable options for the new content types - these go in the management.inc file. Again this was clearer when I took the time to examine what my new class was inheriting! The Squiz Developer Asset tutorial (http://matrix.squiz.net/developer/tutorials/creating-an-asset/10) was also a help here, though I still need to investigate attribute types other than 'text'!
I think the next stage will be to embed a WYSIWYG field into my custom Content Type, but so far we're really pleased that it's possible to quickly add in the functionality we want.
Thanks for you help!
[quote]
Thanks for you help!
[/quote]
No problem. Let me know if you would like me to send you the CKEditor content type that I built.