spacer.png, 0 kB
 
Downloads - Bot link
 
Bot link, a tiny yet powerful Joomla! plugin - Syntax and arguments Print E-mail
Written by molgyk   
Sunday, 06 January 2008
   
 
Article index
Syntax and arguments
Examples and changelog
 
   

I'm very pleased to release my first Joomla! extension! I named it "Bot link". As its name indicates, it is a plugin which automatically places links on pieces of text of your choice in your Joomla! articles. You may use it with a simple text expression or a more advanced perl regular expression. An additional nice feature is that It does not introduce links in places already containing one...

Bot link is still under heavy development and I would not qualify any version as beta, alpha, release candidate or anything. The bot is already relatively stable but requires probably too much the use of regex to be really practical for users which don't like perl regular expressions (Are there any?). My goal is to polish everything for 1.0.0. Anyway, I advise users to check regularly for new versions as Bot link will still improve in the near future...

Syntax

{%bot_link (text="text"|regex="pattern" [text="text"]) link="url" [class="class" alt="text" title="text" html="1" case="1" popup="1"]}

The "%" character after "{" is only here so that the bot is ignored on this page... 

Arguments

text

If used alone, means the text to search for. Used in combination with the regex argument, means the text to replace the regular expression matches (optional).

regex 

A perl-style regular expression to search for. If used, the "case" argument will be ignored.

The expression inside the delimiters has to be set in parenthesese (Have a look at the examples). If a second set of parentheses is used, only its content will be linked by the bot leaving the rest untouched. If a third set is used, the middle set delimits a text portion that will be replaced by the expression delimited by the third (and most inner set) The link will be placed around this last text portion. Any other set of parenthesis should be commented.

For deeper documentation, look at PHP manual's chapter about Pattern syntax.

link 

A valid url. Internal urls are processed through the sefRelToAbs() function.

class 

Specifies a class for the links markups of this specific bot. Overrides the default "class" parameter of the plugin.

alt

The alt attribute of the links markups

title

The tooltip displayed by the link

case

Optional. Ignored if the regex argument is used

0 - Case insensitive (default)

1 - Case sensitive

html

0 - The bot will ignore the HTML markups of your content and translate the HTML special characters (e.g. " will be translated to "). (default)

1 - The bot will treat the HTML markups and special characters as normal text.

In both cases, links already present in the text will not be affected by Bot link. 

popup

Optional.

0 - Open link in the same window (default)

1 - Open link in a popup window


Add to favourites (0) | Quote this article on your site | Views: 4126

Comments (15)
10-01-2008 00:53
 
Like it
Good timing -- I was looking for something like this and you released it same day I was on the hunt. My only suggestion would be to dumb down the explanation a little for us non program gurus. I mean it's very easy to understand the 0/1 to shut off and popups and where to insert your url et cetera but the paragraph talking about expressions and parenthesese had me totally confused. 
 
I would also be curious about one thing -- I would like to have the links actually hidden. Ie.. No underline of links it inserts is there anyway to do this?
 
nefar
10-01-2008 08:40
 
Thanks for the comment
I will maybe put more detailed examples about the regex argument usage. 
As for the hidden links. I will put a "class" argument that will be applied to the link so that its style may be modified through CSS. (For Bot_link 0.1.2?). Thanks again for the very useful suggestions.
 
molgyk
10-01-2008 11:09
 
Error
Hi, 
 
i think it would be very nice bot. But if i enable the bot, my webside does not work. I get this errormessage: 
Fatal error: Call to undefined function: array_combine() in /xxx/home/mambots/content/bot_link.php on line 90 
 
Do you have any ideas? 
The default bot entry is: 
{bot_link regex="/((moleculargeek\.net)[^\/])/i" link="http://www.moleculargeek.net/"} 
 
thx 
Wortspiel
 
wortspiel
10-01-2008 12:01
 
What version did you download?
What exact version did you download?. This should be fixed since 0.1.1... But I could not test this myself since I use PHP5 on my server...
 
molgyk
10-01-2008 13:36
 
Now it Works
Hi, 
 
with Version 0.1.2 it works. But every Link has a '$' at the end of the URL. 
 
Wortspiel
 
wortspiel
10-01-2008 13:40
 
Usage
How i have to seperate more then one entrys in Default bots? 
Do you have a description for this?
 
wortspiel
10-01-2008 14:14
 
Usage
There is no description. Just put the bots one after each other as what you enter will just be added to the text of your article before the plugin is processed. 
 
Could you give me examples of your bots which add a '$'?
 
molgyk
10-01-2008 15:40
 
Example
{bot_link regex="/((Word)[^\/])/i" link="http://www.link.com/" popup="1"} 
 
I thought i can add some "Bot Links" in the "default Bot" area. So I can generate diffrent links from diffrent keywords. Is it not possible? 
If not, i think it would be very nice, that this is possible.
 
wortspiel
10-01-2008 16:06
 
Example
The "$" issue should be fixed in 0.1.3. 
 
You may enter multiple bots one after each other in the backend "default bot" area. Do not separate them with any ";" or anything. The string you enter there is introduced directly in your content before the Bot_link plugin will process it. 
 
You may also put bots directly in all your content items. Each of those will only modify their own article. 
 
I hope this helps. Otherwise, give me an example of what you would like...
 
molgyk
10-01-2008 16:15
 
Very nice
Hi, 
 
and thanks for this very fast support. Now everything works fine. 
I can add some Bot-URL's as default bot. Therfore i had the special character '/' in one keyword. With this character the bot crashed. But in my opinion it's not a big problem. 
 
Thank you for this nice work. 
 
Wortspiel
 
wortspiel
10-01-2008 16:52
 
"/" crash
The crash is in fact expected if your regular expression delimiters are "/" you should escape the inner "/" with "\". 
Otherwise, using the "text" argument instead of "regex" should do the trick too, if you don't need regular expressions...
 
molgyk
10-01-2008 22:28
 
little help if anyone is able
I have never worked with CSS before so for the past couple hours I've been doing the google hunt for how to setup a class for this. Right now I'm using joomlart Ja_mercury free template. I'm fairly certain that the area I need to edit / add to is their template_css.css file. After my google searching I've come across a section on making a no underline link class and it shows the code as : 
 
.nounder a { 
text-decoration: none; 

 
So I opened the template_css.css file and found : 
 
/* Normal link */ 
 
a { 
color: #404040; 
text-decoration: underline; 

 
a:hover, a:active { 
color: #000000; 
text-decoration: underline; 

 
I added this to the section so it now reads : 
 
/* Normal link */ 
 
a { 
color: #404040; 
text-decoration: underline; 

 
a:hover, a:active { 
color: #000000; 
text-decoration: none; 

 
.nounder a { 
text-decoration: none; 

 
I then formated the bot line to read : {bot_link regex="/((No Underline Test)[^\/])/i" link="http://www.testlink.com/" class="nounder" popup="1"} 
 
The bot does pickup the text and turns it into a link, however the link is still underlined. Have I made a mistake here in the bot syntax or is my .nounder a(text-decoration; None;} css addition wrong?
 
nefar
11-01-2008 08:13
 
Class argument usage
I think you should correct the following line: 
.nounder a { 
 
to: 
a.nounder { 
 
or: 
.nounder { 
 
to specify that it is the link markup that contains the "nounder" class. Otherwise everything is in the right order... Hope this helps!
 
molgyk
11-04-2008 21:30
 
Multiple Default Bots
Hi, first want to say great addition to the Joomla world. Only problem I seem to be having is adding multiple default bots to return links to different pages. 
 
For example I have: 
 
{bot_link regex="/((item1)[^\/])/i" link="http://item1page.html" popup="1"}{bot_link regex="/((item2)[^\/])/i" link="http://item2page.html" popup="1"} 
 
etc. 
 
Is this correct usage? For some reason it only lists item1 as a link, item2 never is linked, so I guess it halfway works?
 
Wiggy
14-04-2008 21:53
 
Works for me
Hi, 
Thanks for the comment. I tested your bots on my local site and it works for me as expected both inside an article or in the default bot parameter... I see no obvious mistake in your bots so I cannot really help. Maybe check whether you have the latest version (0.2.0) of Bot link? But I'm sure that's fine too...
 
molgyk

Only registered users can write comments. Please login or register

 



Last Updated ( Thursday, 24 January 2008 )
spacer.png, 0 kB
spacer.png, 0 kB
   
Design based on the Natura template from www.joomlashack.com - CC share alike license