View Full Version : Custom Mambots (developers, please read)
chipjack
November 21st, 2003, 11:25
Custom mambots are neat, but there are some things missing.
- A custom mambot might need to collect information, like the {mosimage} mambot does. It'd be nice to be able to add your own tab to the content editing page.
- It may need some additional configuration outside the scope of the content item you're messing with. Itd be nice if you could install mambots with the MOS Installer and manage them like components.
- It'd be nice to know what mambots are installed when you're editing content
- It'd be nice to be able to effect ranges of content with mambots. For example: {quote}Some stuff here{/quote} might enclose the text in pretty typographical “quotes”.
Rather than complain about what ought to be there, I've implemented all of that and more, in a friendly object-oriented API for custom mambot developers. Some interesting examples are already written. Also, this doesn't effect the use of the "/mambots" directory for down-and-dirty one-file mambot parsing.
Its not available for download yet, but you can see it in action, with screenshots, and read more about it here.
http://chipjack.com/content/view/8/1/
This is really something that belongs in MOS core, and I'd be more than happy to do whatever the dev team would like to do to help make that happen.
-chip
Jason407
November 21st, 2003, 13:21
Very interesting Chip!
Can't wait to see what you have come up with!!! :D
brynieman
November 21st, 2003, 16:24
yep very interesting chip...
...at last someone talking about mambots, love to see where you go with this, but the examples on your site look really interesting
good work mate
:-)
mmx
November 21st, 2003, 16:48
Chip... GOOD NEWS because this basically takes the open mambot API in the direction it needs to go. The only other cms that I know of with a similar feature is Xaraya's widgets or TYPOscript objects created for TYPO3.
You probably don't need the database access information for osctoys. Could you not can just pass a url with the applicable options to query Mamcom for the data.
Here are some other ideas along the same lines.
-- A mambot that appears as a 'buy now', 'order' or 'add to cart' button where you associate a product_id with the button. The trick here is to query for the correct product description in whatever the current language is. This could basically function like SUMO and could be inserted in any content (good for requesting donations, membership funds and such within content).
-- Also, osc supports a URL on the product detail page, so a url could be used to refer the user from the products detail page to internal content rather than an external page, and a similar 'return' button could be used to send them back to the detail page.
-- A mambot that can display a osc results list in content based on a category/subcategory id. (use the cPath= value as the basis for the query). This would be useful for those who have content describing a line or category of products and who want to display a results list of the various items at the end of the content, complete with hyperlinks to jump to the appropriate detail page. Here, you would probably need the connection information to display the results list independent of MamCom.
Gardener
November 21st, 2003, 19:36
Fantastic work! Looks like a really smart way of handling adding new mambots and making it easy to create them. This will make some of the things I want to do a lot easier. =]
vilhelmk
November 21st, 2003, 20:27
AMAZING! This is on of the cooolest and most important additions I've seen to mambo in some time! Hope to see it in the core soon... :D
jns
November 21st, 2003, 23:20
This does look like it's opening up a new world for Mambots. I can see how something like {quote} allows you greater customization than simply typing ", but I see some more powerful uses. Here are some ideas:
1. Create a Mambot that allows for a variety of call-out boxes and other design devices. One example would be an text area for a pull quote, that is, a highlighted quote that's lifted from the text of the story.
2. Create a Mambot that adds related stories or related links boxes. The mambot would display a small table of links to other stories or links that are related to the currently displayed story. These might be pulled directly from a category of stories or links appearing elsewhere, or maybe they are specifically created for that story.
3. Create a Mambot that allows ads to be inserted into the middle of a story. The ads would be pulled from an adserver and allowed to rotate, according to the adserver's schedule. I'm thinking here of the way some sites, such as MSNBC.com, display ads in the middle of stories.
mmx
November 21st, 2003, 23:29
You could go on and on with this...Flash mambots, javascript mambots, reusable content, conditional text, markers for cross referencing, current date mambots, user-definable variables, wrappers for embedding modules or php code in content, and so on....
chipjack
November 22nd, 2003, 13:46
Hehe. I didn't really figure anybody'd be interested... Thanks for the supportive feedback.
mmx - oscToys was written with the idea that the site admin could set up the database connection information for osCommerce, but anyone with editor access could use the mambot in their content to insert products - even though they didn't know the database password, etc for osCommerce.
MamCom, of course, wouldn't require a separate database, so that'd become a moot point. Really, it was just to demonstrate how one would go about putting together a more complex mambot with administration pages and whatnot.
Your other ideas about osCommerce / MamCom mambots sound good, mmx. Perhaps you'll write 'em? :D
jns - the purpose behind all this was basically to do what you suggest; call out boxes. I also wanted to implement a mechanism for styling content differently based on whether it appeared on the front page or in full-article view. Even with some very convoluted CSS, I wasn't ableto do that in an elegant way, so it seemed like a mambot was the best way to go about things.
Anyway, preliminary stuff is available for download, if you'd like to take a look at it. You don't have to register.
I haven't done any sort of documentation yet either, so you may need to exercise the hacker-ethic within and check out the source code to see what's actually going on.
Thanks,
chip
http://chipjack.com
Gardener
November 22nd, 2003, 13:56
Fantastic, will make my upgrade of a heavily modded 4.0 site so much easier. Adding mambots for adding author info boxes, product review graphics with easy grade selection, easy linking to selected related articles, and anything else I can think of. Possibly could make my webcomics component completely moot as well, just add a mambot for easy webcomicstyle browsing of articles at the end of normal content instead.
There are so many possibilities with this that my mind boggles at the thought. =]
PhilTaylor (aka PrazGod)
November 22nd, 2003, 18:32
i like all the talk of mambot technology since i published my article on them - however always keep in mind that mambots are only called by the core code on conent text - ie the places where you would find {mosimage} and {mospagebreaks}
(Did you know we now have a new and improved Table of Contents Mambo Bot and mospagebreak in Beta 1.0.4 ??? )
Custom components do not - unless specifically programed to - run through the mosbot system
chipjack
November 25th, 2003, 13:30
Posted a new version for use with MOS 4.5 beta 1.0.4. (here (http://chipjack.com/index.php?option=com_remository&Itemid=30&func=fil einfo&parent=folder&filecatid=6))
-chip
chipjack
November 27th, 2003, 05:29
Seems the htmlarea2 popup editor wasn't working with the changes i made. To fix that, take a look at "/editor/htmlarea2/popups/fullscreen.html" and insert this after the first <script> tag:
var bots = opener.document.all.bots;
I've updated the download on my site to include this change in the 1.0.4 files.
chipjack
November 27th, 2003, 06:48
Niall requested the ability to drop modules into content. Rather odd, if you ask me, but sort of interesting to write. You can download it here (http://chipjack.com/index.php?option=com_remository&Itemid=30&func=fil einfo&parent=folder&filecatid=7). It plugs into com_mambots (http://chipjack.com/index.php?option=com_remository&Itemid=30&func=fil einfo&parent=folder&filecatid=6), so you'll need that too.
-chip
brynieman
November 27th, 2003, 07:39
thanks chipjack..
just what I was looking for too :-)
only I am getting this error..I installed com mambots first??
[code:1:f8e99a142b]Warning: Missing argument 4 for uploadfile() in d:\phpdev\www\beta 1.0.4\administrator\includes\installer_common.php on line 1135
Upload new module - error
Installation file is not a module installation file
[/code:1:f8e99a142b]
any clues please..I'm sure its something simple, but its gettin late and for the life of me I can't see anything wrong with the xml file?
can the two files just be added manually..and if so could you tell which directories they should go in please..
sorry..tired today..thanks in advance :-)
EDIT: DOH!!!! :oops:
in case anybody else does what I did..it plugs into com mambots..you add the module in install/uninstall from its own menu
pha..told you it was late!
cheers for this
:-)
chipjack
November 27th, 2003, 09:12
hehehe - yeah... the installer for mambots is buried in the components menu. it'd be really nice to integrate this with the core and put the menu for managing them someplace sensible.
out of curiousity, what modules do you want to stick in your content? i'm rather hard pressed to see the usefulness of something like this...
chipjack
November 27th, 2003, 09:34
I thought embedding the related items module in an article would be fun - but it didn't seem to want to show up. Wasn't finding any matches because it splits keywords up expecting them to be delimited by commas and i've got spaces in mine. ;)
An easy fix is to find this line in mod_related_items.php:
[code:1:885726d5ab]$keys = explode( ',', $metakey );[/code:1:885726d5ab]
and replace it with this:
[code:1:885726d5ab]$keys = preg_split('.[,\s].', $metakey);[/code:1:885726d5ab]
Now it'll break it treat commas and any whitespace character (space, tab, newline, etc) as a delimiter.
spignataro
November 27th, 2003, 13:37
very impressive
brynieman
November 27th, 2003, 17:10
in answer to your question chipjack..
I thought about related items yes..to have it appear at the end of my items rather than being hardcoded into the template via a module position..the same goes for most read..I simply used a split table with header graphics of my own choosing, and placed the html code into the maintext area at the bottom.
Also..I'm quite keen on the 'Author bio' feature..using the same method of a split table I should be able to include a column on the right of the item that has this information..but i'm still experimenting [and not getting very far] with exactly how to code this, and have it appear.
This could also be used to pull any kind of .php, html, javascript into an item..
I bought a program for one of my clients called Mini-Fetch..it has the ability to call external webpages and strip out any formatting or text thats not required..it takes a bit of getting used to, but I'm finding it dead handy for a particular site, and it's cheap! but remember you should ask the website's permission before grabbing anything ;-)
heres the link:
http://www.mikenew.net/download/index.asp
so..with a little bit of playing..this could be really useful, and I'm sure now that you have coded this..our mambo users will find all kinds of ingenious uses for it..
thanks for taking the time..I appreciate it, I hope others do to
:-)
chipjack
November 28th, 2003, 08:15
Well, like most things, it was something I needed to be able to do, and rather than hacking something together, I wanted to do it right. Having written it, if it does someone else some good, I'm glad.
I'm not sure how "right" this is, but it seems workable.
The "Author Bio" feature sounds great, but Mambo Open Source doesn't really collect much information about its users, does it? :D I'm interested in what info you're tracking and where you've stuck it.
Meanwhile I'm putting together something to handle sidebars and callouts at the moment. Basically a javascript based style editor. Sure, those of us who are comfortable editing HTML directly to create a DIV and set its style wouldn't need such a thing, but so far it seems rather cool.
Here's the html file (http://chipjack.com/style.html) I'm playing with, if anyone's interested in seeing what I'm talking about. And yeah, I ripped that color selection dialog right outta htmledit2. Hehe.
Might be cool.
Suggestions are welcome - I'd like it to be simple enough that my mother could use it. ;) I haven't come across anything out there that does this, and it'd make a nice addition to the system I think. Your thoughts?
-chip
PhilTaylor (aka PrazGod)
November 28th, 2003, 08:20
Hi Chip
long time no chat!
Check out my implementation of author bios over at www.devarticles.com (now a mambo site!!!!)
http://www.devarticles.com/cp/bio/Mitchell_Harper/
The users can update their own bios from the frontend :-)
chipjack
November 28th, 2003, 08:33
That's extremely slick, Phil! One wonders, from the picture, if Mr. Harper isn't just a tad... short? :lol:
Did you integrate that with com_user for the "Edit Your Details" page, or is it a separate component on the User Menu?
-chip*
*wishing he weren't out of coffee...
spignataro
November 28th, 2003, 10:26
just a tad short...heck everyone should see my mother and father....they are extremely short....
anyways i like the implementation of that
mambofrog
November 28th, 2003, 10:39
Suggestions are welcome - I'd like it to be simple enough that my mother could use it. I haven't come across anything out there that does this, and it'd make a nice addition to the system I think. Your thoughts?
Looks pretty cool to me. Am I correct in assuming that this is integrated into htmlarea? (i.e. user presses button and the pop-up appears). If so I think it is a great idea and would be happy to help you test it out. (I am using htmlarea3). I have a similar dealie that inserts a pre-formatted "sidebar" div into the body, but no user configuration like you have going. Very nice stuff.
chipjack
November 28th, 2003, 11:27
Hehe. I'm not sure what to do with it yet. I haven't looked at htmlarea3... are there plans to bump MOS up to the new version?
brynieman
November 28th, 2003, 17:47
yep thats lookin good chip! i'm thinking that bascially all these little addons are useful features for Mambo..I don't think we should forget that not all users are coding geniuses like yourself and Phil..even basic html knowledge eludes some people..
..the basic function of a CMS remains the same I think..the need to be able to update webpages, without too much need for any programming knowledge..make it as simple as possible! The more we can manipulate that information in our sites..the nicer our designs and functionality will be..agree?
as for what I'm doing..your right..mambo doesnt collect enough info right now to create a useful 'bio' feature, not for my prospective client anyway..so for the moment the details will be collected via a form and transferred to a static page that will be called into the mos page using your module include..hopefully! I'd love this functionality to eventually be built into mambo, but the problem is different webmasters may want to collect different information about the authors/editors, and display it differently too?
Unfortunately there isn't the funding to have this coded specifically..so that will have to do, unless I can find another solution myself. Phil's implementation on DevArticles looks great..very slick ;-)..but we don't have their budget :roll:
Good work though chip..another excellent addition to our mambo..keep it up ok? You may not find much of a use for your creations..but I'm sure we can!
thanks!
:-)
chipjack
November 30th, 2003, 13:25
I've fixed a bug in the modified htmlarea2's "editor.js" as distributed with com_mambots. The change prevents errors when embedding htmlarea2 in non-content (ie, 3rd Party Component) pages that don't provide information on installed mambots.
More info here (http://chipjack.com/content/view/13/2/)
Additionally, if you're using Olle Johansson's Mamblog (http://mambo.theyard.org/index.php?option=com_remository&Itemid=28&func=fil einfo&parent=folder&filecatid=59), and you'd like htmlarea2 to show up in the blog entry editor, drop this into mamblog.html.php on line 150:
activateEditor('fulltext', 'adminForm');
You might also want to play with the rows and cols set on the textarea element on line 67 of that file - its a bit small by default, and when you stuff a bunch of buttons and dropdowns and things in there... well... ick.
Cheers,
chipjack
Gardener
November 30th, 2003, 23:26
Additionally, if you're using Olle Johansson's Mamblog, and you'd like htmlarea2 to show up in the blog entry editor, drop this into mamblog.html.php on line 150:
activateEditor('fulltext', 'adminForm');
Hey, was it that easy? That's good to know. Actually I had already done it in the new component I'm working on, but I hadn't bothered to try if it worked. =]
I'll add that to the Mamblog for the next release. Thanks!
chipjack
December 2nd, 2003, 09:59
paolox wrote (in another thread (http://forum.mamboserver.com/viewtopic.php?p=13372#13372))
Yes, i'm testing your component. The problem is that it requires the changing of some cose files, but I saw it's only to add them a couple of text rows...
So, when updating those core files to a new version you have to update them or the component will be broken up.
This is quite true. I tried to keep the changes as isolated as possible. The fact that you observed that my only changes were adding a couple of lines of code here and there pleases me greatly. :D that was my intent. Basically, I've defined a class to provide an interface to the custom bot system, and I've injected a little code where necessary to allow the bot manager class to provide whatever it needs to add to the base content editing pages. The HTMLArea2 customizations are a bit more extensive, but I'm looking into HTMLArea3's plugin structure at the moment, which seems to be a much neater way of doing things.
I've been hoping to see this mambot api (or some other method that provides the same functionality - doesn't have to be mine) moved into the core, but I haven't heard a peep from the dev team on the subject. Truth is, I don't feel that providing custom mambots is the job of a component - that's the job of the core content editing subsystem.
I don't like changing core files, but custom mambots are something *I* need, regardless of whether or not its integrated with the core. The sites I'm building are going to be maintained by people that don't know basic HTML, and something as trivial as inserting a hyperlink is a big deal to them. Custom bot insertion is going to make things so much simpler for them. I know that many Mambo-based sites have the same problem, and that's why I released this.
If it must remain a separate 3rd party component, then that component needs to handle the editing of content as well, I guess. The first version of com_mambots that I wrote was actually called com_content, and did exactly that - mirrored the existing content editing environment. Integration with the core system seemed more desirable, however, so I pursued that instead.
I guess I could provide editing capabilities and keep things isolated, but I'm loathe to reinvent the wheel on this one. Front-end editing would have to take place through a component then, as well, and that would either require a patch to content.php to send the user to the right place when they attempt to edit an article, or it would become a training issue ("You could edit that article that way, but go over here and do it instead...")
I don't really know what's best. Here are my goals:
I want to make it easy to create mambots at least as complex as those that come with the system
I want to provide a way to install/remove them just as one would a component.
I want to make content authors aware of what mambots are available, and make it easy to insert them into content
I want to provide a way for those mambots to collect whatever information they need from the author during composition
What I've written does all that, but if anyone feels its a bit of a kludge, I'd have to agree wholeheartedly. Any ideas on what I should do to resolve that? This is basically something for 3rd Party developers to use - what would make it more usable to you?
Thanks,
chip
Michelle Bisson
December 30th, 2003, 10:06
chipjack,
Thanks for all your contributions in the way of Mambots!!! Have you considered having others work with you on developing Mambots? If so, the TOSMO project may be a way to go... This TOSMO project was designed for 3rd party developers to colloborate together.
http://www.whitecotton.net/
=================================>>
Message to all,
I will be representing Mambo at the Linux World Expo. I am looking for creative ways to fundraise for this event. So if you have any ideas or you just want to sponsor me directly, please read the following post as it has all the details.
http://forum.mamboserver.com/viewtopic.php?t=1212
Thanks in advance!!! :D :D :D
mambofrog
December 30th, 2003, 10:53
Hey chipjack:
Have you spent any more time playing with htmlarea3? Now that it is "officially" available for 4.5 stable it is all I am using so just wondering if you have any plans for that.
Sincerely,
Mr. Small
fechten
January 1st, 2004, 08:32
Hey there. I saw that the current code is for beta 1.04. What changes need to be made to get this working with 4.5 stable?
Thanks,
Craig
mmx
January 1st, 2004, 10:45
Arthur recently added a copy of HTMLarea3 to the downloads area on mamboportal.com. I'm not sure if this is an updated version or the same version you mention above.
vBulletin® v3.6.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.