How to use Extended Attributes/SubType
Not long ago we blogged about how to dynamically create Extended Attributes/SubTypes. After its post a commenter asked some VERY good questions.
"This might seem like a really basic question, but where would this code go? Could you build an example to show us what a sub page might look like? Would it be smart to use this for something like a resume, where the sub type would store data such as job and education history?"
This expressed to me that we needed much better documentation on the Class Extension Manager which I am happy to say is now available! We encourage you to read the documentation and learn how to build subTypes and attributes through Mura's admin before venturing into building them up dynamically. You may find that the admin console provides you all you would need to get things started.
Now on to the questions
"This might seem like a really basic question, but where would this code go?"
This type of code can be placed either within a site's eventHandler or within a Mura plugin. Within the event handler/plugin you could hook to something like the onApplicationLoad event (this event only fires when Mura is either loaded for the first time or reloaded).
"Could you build an example to show us what a sub page might look like? Would it be smart to use this for something like a resume, where the sub type would store data such as job and education history?"
Yes. What you can do is create either a Mura page subType or a user subType. This all depends on your overall needs of course. If you would like to correlate resume information to a user's profile for instance, then you would go the "user" type route. If the resume is meant to accompany the "user" type then you could build a "page" subType, then link it to the user's profile. The examples found within the Class Extension Manager's documentation should cover the basics on how to do this.
If anyone has any other questions, please let us know so we can write some more stuff up for you.
Team Blue River
Thanks Pat! Extended attributes are awesome! Now if i can only figure out a way to import data from my old non-Mura database to my Mura CMS. Any thoughts on that? Or will i have to manually add them record by record?
- January 21, 2010, 6:52 PM
- Pat Santora
Another good question David!
The best answer I can give you at the moment is that you'll need to move your site into the system manually through the admin console.
Like all other systems, Mura is unique and must work upon it's own business logic to ensure data stability. However, in the near future Mura v5.2 we will be released exposing a remote proxy (remote Mura API) that when programmed against will allow you to create Mura content from a remote source.
It will not magically do what you need, but it will at least provide a programmatical interface to Mura that another system can utilize.
Hope this helps.
- January 25, 2010, 7:16 PM
Thanks for the update, Pat! Any chance you could help me on this topic: http://www.getmura.com/forum/messages.cfm?threadid=1DC99DBF-1E7D-432A-98890C0A773734AA? I'd like to update things like shadowbox and suckerfish to more current versions, but want to do it correctly. perhaps you can write a blog about it? Getting things like Links to pop up in shadowbox has proved a bit funky, so i'd like to learn a bit more how to tweak this.
- January 25, 2010, 7:27 PM
- January 25, 2010, 7:27 PM
- Giochi Gratis
Getting things like Links to pop up in shadowbox has proved a bit funky???
- October 4, 2010, 2:04 PM