1 edb Feb 24, 2005 18:48
3 tabard Feb 26, 2005 01:17
Very cool. I'm messing around with it on my site. Ha! And it seems to handle two or three grouped words just fine too, as long as neither of the grouped words are already defined (in which case, it reverts to the single-word) :D
4 edb Feb 26, 2005 05:35
I'm guessing, but would that be order-dependent in your LinkAWord list? Like if your linkaword array has 'cream' then 'ice cream' ice cream never gets linked because cream comes first? So maybe moving 'ice cream' above 'cream' would do it?
Hmmm. I like ice cream AND I like Cream. SWLABR still kicks it hard.
Never actually tested it with multiple term linkables. Since I copied the auto-acro thing it just never crossed my feeble mind. Personally I'm still trying to figure out what I would want to link to frequently. Now that I know I can link multiple words I think I'll link "I landed" to my local hospital. (that's a hang gliding joke, sort of.)
5 john Feb 26, 2005 11:57
First off, I don't have the latest .11 version and this works fine in 0.9.0.9 except for one thing.
The linkword cannot be the starting or ending word within <p>tags or <div>'s. They just wont render for some reason!!!
Any ideas?
6 john Feb 26, 2005 12:09
Leaving a single space fixes this issue BTW
7 edb Feb 26, 2005 14:18
Upgrade? Possibly the priorities you've given your plugins? http://wonderwinds.com/test/index.php?blog=1&skin=custom-original - first word, top post. View source shows it is up against a p tag.
8 remyrw May 31, 2005 21:02
I just installed this and made my first post using it, very nice. It was my first plug-in install for B2evo so there was a little confusion there but it still only took about fifteen minutes to go from copy/pasting to test posting with some of my own keywords added. This is a great tool for those of us who regularly refer to other pages on our own sites or other people's sites. To maximize google results I like to link whenever it's reasonable and this lets me set up all my common links and not waste time entering them every time. I haven't exhaustively tested it yet but it handled "EdB's" just fine and your brief explanation of how the array order would influence things let me avoid potential hitches with that as well.
Here's a [url=http://www.rwphoto.easyhost4all.info/b2/]link[/url] to the first post using Link-A-Word. It's a live link to the main blog so it won't always be the first post, but I see no reason why it won't always show an example of this helpful plug-in's handiwork.
Now to see if I can find something similar for phpBB :D That would make this a productive day even if I got nothing else done.
9 raptor Jun 10, 2005 22:16
EdB,
I thought about editing it to use a table.
But i am untill now not familiar with how plugins work.
I tried to slightly change your code to use a table for it.
Mysql table : evo_linkword
[ 2 fields of 150 varstring ] [as word, link ]
code is used :
$result = $DB->get_results("SELECT * FROM evo_linkword"):
$replacements = $results[0];
But it didnt work for some reason.
any idea ?
Regards,
Raptor
10 jwen Sep 08, 2005 19:38
Sounds great! But it seems not work with version 0.9.0.12 b2evo now. Can u make it suit please. Thanks.
11 edb Sep 08, 2005 20:18
I'm using it on v12, so I'm sort of thinking it does work. Can you show us where it's not working? Do you get an error, or it just doesn't make linkage for you? How about showing us a post with something that should've been turned into a link but wasn't?
No promises, but if I can make it work for you I will.
12 jwen Sep 08, 2005 20:57
Thanks for your time!
I only change for key word links, here is the code i changed:
var $replacements = array(
'b2evolution' => 'http://b2evolution.net/',
'b2evo' => 'http://b2evolution.net/',
'EdB' => 'http://wonderwinds.com/',
'StarForum' => 'http://bbs.toustar.com/',
'starforum' => 'http://bbs.toustar.com/',
'StarBlog'=> 'http://blog.toustar.com/',
'starblog'=> 'http://blog.toustar.com/',
'toustar' => 'http://www.toustar.com/',
);
var $search = array();
var $replace = array();
And as u said, I put it in fold: *mysite*/plugins/renderers/ as a name: _linkword.renderer.php
A screenshot from my blog after installing Link a Word as bellow:
http://www.toustar.com/photonline/starblog_screenshot.gif
I do added key words like StarBlog/starforum but it seems not make any change.
Forther, if it will be ok. Can it be no case sensitive?
EDIT by EdB: turned off Smilies to get them out of the pasted code
13 edb Sep 08, 2005 21:22
The screenshot helps. Link-a-word only links words in posts - not comments. I never even thought about making it do comments, but it's probably possible. Same with case-insensitive matching: I never thought about it but it's probably possible. I'm not too sure about case-insensitive matching. I have this feeling it could lead to linking letter strings in the middle of a word. I'll have to think about that a bit, but in the meantime your method of adding both upper and lower case versions works.
BTW I won't do *anything* about this plugin until after phoenix is released. Right now I'm trying to (a) build a wicked-cool open blog app and (b) work on the antispam list and (c) trying to document how to make your skin work in phoenix and (d) trying to make a bunch of existing skins work in phoenix and (e) trying to find myself a job that actually pays me. I'm just not up to tweaking or creating hacks for a version of b2evolution that will be obsolete soon.
Hey I hope you don't mind me editing your post to remove the smilies. It bugs me when code has bunches of => inside is why I did it.
14 jwen Sep 08, 2005 21:48
Yes, u r right! Its not works in comments, but in posts. You got a lot of no pay job to do(what a nice man!) n u do needs to find a paid job. Wish u got one soon! I'll be waiting for the next version of your works. Im now your fans now!
BTW its alright my post got edited, I even dont know how to get them off my post-code before that.
Thanks anyway!
15 opmama Apr 26, 2006 05:13
EdB, this is a gem, and hugely useful for cross-linking posts on my site (I made the link URL search results on my site for that term). Thought I'd share that particular use in case anyone else finds it useful. Thanks!!
16 lexagon May 19, 2006 17:40
Hello EdB,
I've read the whole thread and hope I haven't missed out on anything when I ask if'n'wether the database'd version of your fine plugin ever actually was published.
btw, (do) you know the very nifty [url=http://www.bloggingpro.com/index.php?s=Ubernyms]Ubernyms[/url] for Wordpress? I thought you might find this one inspiring.
Looking forward to your reply a lot. Best Regards; Lex
17 edb May 19, 2006 17:45
Nope - haven't gone near it yet. Kinda mostly waiting for the release of 1.8 so I can do it as a real plugin plugin instead of the kind where you have to hack something.
18 lexagon May 19, 2006 17:59
EdB wrote:
Nope - haven't gone near it yet. Kinda mostly waiting for the release of 1.8 so I can do it as a real plugin plugin instead of the kind where you have to hack something.
aw, shucks. :-)
Any reasonable estimate as to when 1.8 be out? (On the site the newest version I saw was 1.6 Phoenix Alpha, I am mostly toying with 0.9.1 Dawn)
more regards, and thx for your swift reply,
Lex (I'll be off now for today)
19 baileyjs May 23, 2006 19:22
EdB, this works great with 'Sparkle', thanks.
20 lexagon Jun 03, 2006 21:53
Hello EdB,
would it also be possible to store the link references in external files? I have things I'd like to auto-link globally (in 2 evos residing site by site on one server), some in Evo A only, others in Evo B only.
I tried replacing
var $replacements = array(
'b2evolution' => 'http://b2evolution.net/',
'b2evo' => 'http://b2evolution.net/',
'EdB' => 'http://wonderwinds.com/',
'google' => 'http://www.google.com/',
'W3C' => 'http://www.w3.org/',
);
with
var $replacements = array(
{include file="links-global.txt"}
{include file="links-pri.txt"}
);
which didn't work due to the brackets (duh), giving me this error
Parse error: parse error, unexpected '{', expecting ')' in [...]/lexnet/pri/plugins/renderers/_link-a-word.renderer.php on line 36
is there an other way to notate includes inside of the array brackets? Please bear with me since I am none to experienced with PHP so far .. (sometimes I get things to work the way I want them to and other times, well, not. ;) ) Live and learn, I say! So, is there a way I can accomplish calling the links from external files?
TIA! Best regards,
lex
21 edb Jun 03, 2006 22:20
Using an external file, or a table in the database, are pretty straightforward ideas that I never thought of and never got around to even trying. Bummer, but all I do is tweak what I see without really *thinking* about it. In general I haven't really paid much attention to older hacks, but perhaps I should come back to this one now that sparkle is out. Apparently it works in sparkle, so I should put some effort into bumping it up a notch or two. If you beat me to it please share your improvements with the world!
22 lexagon Jun 03, 2006 22:28
LOL, unlikely I'll manage. I don't even know how to make brackets inside brackets work - or how to write it differently.
But I'll still try. Heck, I'll walk by #php right bloody now and see if I can turn up any takers :D
I'll let you know should I get anywhere. Best regards,
lex
23 yabba Jun 03, 2006 22:38
Totally off the top of my head :-
$replacements = file('links-global.txt');
$replacements += file( 'links-pri.txt');
I've got a 1.6 db driven plugin thing if you want to play with it EdB ?
¥
24 lexagon Jun 03, 2006 22:50
Hello Yabba, and thanks for stepping in;
tried your suggestions right away (like
var $replacements = array(
$replacements = file('links-global.txt');
$replacements += file( 'links-pri.txt');
);
) but got
Parse error: parse error, unexpected T_VARIABLE, expecting ')' in [...]lexnet/pri/plugins/renderers/_link-a-word.renderer.php on line 36
maybe something with the semicola? *guessing wildly*
btw, #php crowd on freenode.net prefers to give me lecutrings instead of hints
[...][22:41] <php-bot> Guideline #10) We don't support script(s). We help you *write* PHP, not recommend or download and install/hack/modify/adapt/use pre-written scripts. Contact the authors of the script for support options they provide.
[...]
[22:43] <RiPLeX> actually i was asking for the proper PHP method to include includes inside a array [...] Please?
Oh well, I'll keep scratching.
25 lexagon Jun 03, 2006 23:20
[22:57] <RiPLeX> rephrased question: how can I properly include references to external file/s inside a var $name = array( ); ?
[22:58] <Wolfpaws> you can't?
[22:58] <RiPLeX> ah LOL is that so?
[...][23:00] <RiPLeX> what do you think about using: $replacements = file('name.txt');
[...][23:00] <Wolfpaws> RiPLeX: I think it's sexy
[23:01] <RiPLeX> still gives me an error ;-` and I don't know enough PHP to figure out where I went wrong
[...][23:02] <Wolfpaws> I can't understand what you're doing... Are you trying to included that in the class variable declaration?
[23:02] <RiPLeX> yeah, I guess ...
[23:03] <Wolfpaws> you *can't* do that
[...][23:04] <RiPLeX> aw :-(
[...][23:05] <RiPLeX> so I'll always have to edit the (page).php itself whenever I want to add a new autolink?
[23:05] <Wolfpaws> no need...
[23:06] <Wolfpaws> Where do you have the links stored?
[...][23:06] <RiPLeX> wait a sec ill pastebin it
[...][23:09] <RiPLeX> @Wolfpaws: http://pastebin.com/756394
[...][23:13] <Wolfpaws> RiPLeX: you can put them in the file/db and then do the $this->replacement magic in constructor
[...][23:15] <RiPLeX> @Wolfpaws: constructor? :-0 I don't understand what you are telling me, sorry. Is there an URL wehre I can read up on this that you could tell me?
[...][23:17] <Wolfpaws> RiPLeX: php.net/oop
[...][23:19] <RiPLeX> thx I'll go look it up
26 lexagon Jun 03, 2006 23:43
hum, after reviewing http://de3.php.net/oop and http://de3.php.net/manual/de/language.oop.constructor.php
(not really understanding too much) I tried this:
var $replacements = array(
function B()
{
include file="..\..\..\links-global.txt";
include file="..\..\..\links-pri.txt";
}
// calling B() as constructor.
$b = new B;
);
but still: no cake:
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in [...]/lexnet/pri/plugins/renderers/_link-a-word.renderer.php on line 36
I guess I'll call it a day :(
27 yabba Jun 04, 2006 07:51
Instead of :-
var $replacements = array(
$replacements = file('links-global.txt');
$replacements += file( 'links-pri.txt');
);
just use :
var $replacements = file('links-global.txt');
$replacements += file( 'links-pri.txt');
¥
28 lexagon Jun 04, 2006 14:30
hey, Yabba; thx
putting your suggestion gives me
Parse error: parse error, unexpected '(', expecting ',' or ';' in [...]/lexnet/pri/plugins/renderers/_link-a-word.renderer.php on line 36
and .. if we remove the
var $replacements = array(
);
isn't the
var $search = array();
var $replace = array();
bound to fail?
thx! l8rs,
lex
29 yabba Jun 04, 2006 15:56
The file() command reads a file in as an array, try this instead :-
function linkword_Rendererplugin()
{
$this->replacements = file('links-global.txt');
$this->replacements += file( 'links-pri.txt');
¥
30 lexagon Jun 04, 2006 18:43
Hello Yabba; OK, It took me a while to figure out that your latest suggestion belongs a bit futher down into the file, around line 50, and have put the two lines
$this->replacements = file('links-global.txt');
$this->replacements += file( 'links-pri.txt');
immediately afte the line
function linkword_Rendererplugin()
{
already there. This acesses the files (giving absolute URLs) just fine, however: the rendering doesn't work anymore now.
The referred files contain just what was in the original array brackets in EdB's code, no leading or trailing whitespace.
Now what? I'll attach the renderer file for review.
Clueless,
'lex
31 lexagon Jun 05, 2006 16:10
Hey, Crowd,
by chance I have discovered that the tinkered version indeed does access the files, just output the stored information in an unwanted manner. :-)
Nothing happened as long as I just posted with text only.
However, when I did a test posting employing [url=http://forums.b2evolution.net/viewtopic.php?t=3562&highlight=b2media]Danny's fine Amazon Plugin B2Media[/url], all of a sudden a line from the external test-file for Link-A-Word showed up, in there it says
'b2evolution' => 'http://b2evolution.net/',
like it would have in EdB's original array.
Now, instead of rendering the line to link/s, it seems to deliver the HTML of the line following criteria I have not yet transscended:
=> 'http://b2evolution.net/',
" title="'b2evolution' => 'http://b2evolution.net/',
" target="_blank">0" alt="" />
Potential conflict with the Emoticon renderer turning the arrow (equal-sign-greater-than-sign) into an arrow icon?
I'll attach a screencshot for further illustration.
Best regards, 'lex
32 yabba Jun 06, 2006 10:12
Sorry for the delay, I've been wandering around in a field for the last couple of days :p
There was a smidge of an error in my logic, change these two lines :-
$this->replacements = file('links-global.txt');
$this->replacements += file( 'links-pri.txt');
to :-
require_once dirname(__FILE__).'/links-global.txt');
require_once dirname(__FILE__). '/links-pri.txt');
And then change your two text files to :-
$this->replacements += array (
// current file contents
);
¥
33 lexagon Jun 06, 2006 12:46
Hello Yabba,
hum; I have done as advised, at first slamming into a wall of errors. I then enclosed the textfiles content including your suggested changes into php brackets, so they look like this now:
<?php
$this->replacements += array (
'b2evolution' => 'http://b2evolution.net/',
[i]{etc.}[/i]
);
?>
and
<?php
$this->replacements += array (
'pri' => 'http://www.test.de',
);
?>
respectively.
I now 'only' receive a one line error
Fatal error: Unsupported operand types in [...]/lexnet/links-global.txt on line 9
Line 9 in the file in question is the line having the ");"
If remove the "<?php" .... "?>" in links-global.txt I get
$this->replacements += array ( 'b2evolution' => 'http://b2evolution.net/', 'b2evo' => 'http://b2evolution.net/', 'EdB' => 'http://wonderwinds.com/', 'google' => 'http://www.google.com/', 'W3C' => 'http://www.w3.org/', 'global' => 'http://www.alexandermaiwald.de/', );
Fatal error: Unsupported operand types in [...]/lexnet/links-pri.txt on line 4
Line 4 in links-pri.txt again has the ");". If I remove the PHP brackets here as well I get
$this->replacements += array ( 'b2evolution' => 'http://b2evolution.net/', 'b2evo' => 'http://b2evolution.net/', 'EdB' => 'http://wonderwinds.com/', 'google' => 'http://www.google.com/', 'W3C' => 'http://www.w3.org/', 'global' => 'http://www.alexandermaiwald.de/', );$this->replacements += array ( 'pri' => 'http://www.alexandermaiwald.de/pri', );
Warning: Invalid argument supplied for foreach() in [...]/lexnet/pri/plugins/renderers/_link-a-word.renderer.php on line 60Warning: Empty regular expression in [...]/lexnet/pri/plugins/renderers/_link-a-word.renderer.php on line 89
Warning: Empty regular expression in [...]/lexnet/pri/plugins/renderers/_link-a-word.renderer.php on line 90
Maybe I did something wrong about the order in which the stuff is in the renderer? I'll attach the file in it's latest tinkered version for review.
Maybe I should just leave it be and enter the links in EdB's originally intended manner? This is getting to time consuming, me thinks. Unless, of course, you are feeling ambitious about getting this to work - then I'll be trying to hobble along :-)
Best regards,
'lex
34 yabba Jun 06, 2006 13:03
Ok, your text files should have the <?php ?> tags.
Try this and see if it cures your errors
¥
35 lexagon Jun 06, 2006 13:22
YAY! It works! Incredible!! Teriffic!! Thanks!!!! :D
36 yabba Jun 06, 2006 13:49
I get there eventually :p
¥
37 lexagon Jun 06, 2006 14:10
heh :D winning attitude, if I ever saw one! Kudos to you,
sends 'lex
38 cslepage Oct 11, 2006 20:32
Sadly, I've not been able to get 1.8.2 to recognize or use this plug in.
Something bugs me about this. It makes the URL be the title for the link, which is okay I guess, but I wish I knew how to make it have user-defined text for the title. In other words I type BillyBob so it links to http://fakedomain.com and give a title of "BillyBob's lame web". Any takers?