lunarhotel.co.uk

How about a view of the sea of tranquility?

Sponsored Links
Content Quote Mambot - How it works PDF Print E-mail
Tag it:
Digg
Delicious
De.lirio.us
YahooMyWeb
Reddit
Article Index
Content Quote Mambot - How it works
Page 2

{mosignorehit}

 

If you're looking to download the mosQuote mambot, you can do so here 

 

Coming up with persuasive, sales-orientated text, especially in a clear and concise way, is not one of my strong points. So when I was trying to compose an opening "Welcome to our website" type paragraph for www.sigmasdi.co.uk I hit upon a bit a problem.

"This serves to entice the user into reading the article, but also helps the user decide whether it is something of interest."
I had composed two paragraphs of text as to why the customer should choose us, and how your order will be fufilled etc.. Now, According to a lot of the web site usability books Ive read, most of the text on a web page doesnt actually get read, it gets scanned.  This made my two paragraphs of text a largely pointless feature of the front page, where we could put that space to better use. Now Im not saying that I should get rid of the introduction text all together. Personally I think its a vital device on the front page, and should sum up very quickly what the website is for and about. I realised that if we could highlight parts of the text that were important, that this would help the user quickly find out what a given article (or content item) was about, without having to read the whole thing. I stumbled upon the solution while reading a newspaper. There are small blocks of quotes that give someones opinion, or set the overall theme of the article. This serves to entice the user into reading the article, but also helps the user decide whether it is something of interest. So there I hit upon the idea of allowing quotes of the article (or content item) to be shown within the article, much like we can see in this introduction!

 

 

Note. When Im refering to the tags that are used the curly brace "{" will be replaced with a square brace "[" otherwise the quote mambot (which is installed on this site) will think its for it!

"There are fairly comprehesive notes on how to create your own mambot here,"
So after having a look around the Joomla extensions directory. I found a couple of hopefuls. I found mention of one written back in 2005, that I  cant seem to find where to download. Another worked by putting the quote in a module position. I considered this for a while, there are ways you can show modules in content items, but to me, this seemed like the perfect job for a mambot. Moreover, the functionality I needed was almost already there in the form of the mosimage mambot. This allows the author to put images in thier content, and decide on where its located (left or right) and to a certain degree, how the text wraps around it. I just wanted it to show a user definable portion of the content item currently being displayed, rather than an image.

 

There are fairly comprehesive notes on how to create your own mambot here, and a list of the different kinds of mambot you can create. They're quite usefull especially when it comes to figuring out whats required in terms of making it an installable package. But as usuall, I thought Id get my feet wet straight away, and just started disecting the mosimage mambot.

So first I took a copy of /mambots/content/mosimage.php and copied to the same directory, and called it mosimage.php. I then did a search and replace for mosimage, and changed it to mosquote. Following how the code works is fairly simple. Probably the hardest bit to get my head around (although perhaps not for other people!) was the preg_replace_callback function. I had a bit of a time understanding that everytime it found a match, it called the botMosImage_replacer function and used its output to make the replacement. Once I got my head around that, it was alot easier.

Thinking about how the mambot should work, we'd need two sets of tags (remember Im only using sqaure braces to prevent the mambot from processing it) [mosquote] and [/mosquote] to define which bit of the content we wanted to appear in a quote box, and also [mosshowquote] to dictate where the quote appeared in the text. So after a bit of Googleing, I found a function which returns the text between two string place-holders ([mosquote] and [/mosquote] for example!). These quotes are held in an array, and then for each [mosshowquote] we encounter, it generates the html ( a div element with the quote inside) and replaces the [mosshowquote] tag with it.



Last Updated ( Friday, 08 August 2008 )
 
Tag it:
Digg
Delicious
De.lirio.us
YahooMyWeb
Reddit
< Prev