1 stevet Jan 27, 2006 12:53
3 stevet Jan 27, 2006 14:00
thanks ¥åßßå this looks most promising. I have done the first bit you suggest [name=Eddon][date=1700][place=Middlesbrough] but I'm not clear what to do next
sorry to be obtuse but what is
bbcode plugin
If this works out as hoped I'd like to prefill all the postings with
[name=???][date=???][place=???]
as these are very non tech people
4 yabba Jan 27, 2006 18:06
Ok, the bbcode plugin is a renderer (funnily enough, it renders bbcode :P), and is usually the quickest way to add "tags" (save you having to code a plugin).
It resides somwhere like plugins/renderers/ or summat, if you crack it open you'll see that it has a "search" and a "replace" array which you can add your tags to.
The search would look something like this (after adding tags) :-
var $search = array(
'#\[ i](.+?)\[/i]#is',
'#\[name=(.+?)]#is',
'#\[date=(.+?)]#is',
'#\[place=(.+?)]#is',
'#\[ b](.+?)\[/b]#is',
and the replace array would look something like :-
var $replace = array(
'<strong>$1</strong>',
'[<a href="/?s=$1&sentance=or" style="name_cat" title="Search for all posts relating to $1">$1</a>]',
'[<a href="/?s=$1&sentance=or" style="date_cat" title="Search for all posts relating to $1">$1</a>]',
'[<a href="/?s=$1&sentance=or" style="place_cat" title="Search for all posts relating to $1">$1</a>]',
'<em>$1</em>',
Whilst it's possible to add to the top of each (new) post, you'd "probably" need to hack the core files, alternatively you could just hack the quicktags plugin to add a toolbar button.
¥
5 stevet Jan 28, 2006 13:57
Ok - I've added the stuff to that plugin. Sorry to be an idiot but this is new stuff to me. How do I make the bb renderer active
6 yabba Jan 28, 2006 18:26
*wracks brain back a version* urm, if I remember rightly it's just a tick box, bottom right of edit/write screen, in admin. :p
¥
7 stevet Jan 28, 2006 19:05
blow me ! can't say I've ever seen that before.
Anyway I've done it and it has achieved something
my test blog
http://www.neukol.org.uk/test/index.php/beryl
the three search parameters I entered have now turned Italic underlined and strice though respectively
thus
[name=Eddon][date=1700][place=Middlesbrough]
becomes
Eddon[u]1700[/u]cant do strikethough here
I'm with you but I can't se how this is going to help me achieve my goal of searchable posts under a number of parameters :-/
8 yabba Jan 28, 2006 19:15
It looks like you've only done the search array and not the replace array changes ?
The end result should be that the name date and place are respective search links which would pull up all posts with the same link (ie you click on 1600 and all posts with 1600 come up).
¥
9 stevet Jan 28, 2006 19:33
maybe I'm missing something
I did indeed add the replace array too. Will copy below.
I added this to my test posting
[place=Eddon] [date=1700] [name=Someting or other]
made the changes you suggested to _bbcode.renderer.php
then ticked the renderer in the write/edit admin page
Not sure what I would do next to search for these things
anyway here is the pertinent bit of _bbcode.renderer.php
from line 39
var $search = array(
'#\[b](.+?)\[/b]#is', // Formatting tags
'#\[i](.+?)\[/i]#is',
'#\[u](.+?)\[/u]#is',
'#\[s](.+?)\[/s]#is',
'#\[name=(.+?)]#is',
'#\[date=(.+?)]#is',
'#\[place=(.+?)]#is',
'!\[color=(#?[A-Za-z0-9]+?)](.+?)\[/color]!is',
'#\[size=([0-9]+?)](.+?)\[/size]#is',
'#\[font=([A-Za-z0-9 ;\-]+?)](.+?)\[/font]#is',
// The following are dangerous, until we security check resulting code.
// '#\[img](.+?)\[/img]#is', // Image
// '#\[url](.+?)\[/url]#is', // URL
// '#\[url=(.+?)](.+?)\[/url]#is',
// '#\[email](.+?)\[/email]#eis', // E-mail
// '#\[email=(.+?)](.+?)\[/email]#eis'
);
/**
* HTML replace array
*
* @access private
*/
var $replace = array(
'<strong>$1</strong>', // Formatting tags
'[<a href="/?s=$1&sentance=or" style="name_cat" title="Search for all posts relating to $1">$1</a>]',
'[<a href="/?s=$1&sentance=or" style="date_cat" title="Search for all posts relating to $1">$1</a>]',
'[<a href="/?s=$1&sentance=or" style="place_cat" title="Search for all posts relating to $1">$1</a>]',
'<em>$1</em>',
'<span style="text-decoration:underline">$1</span>',
'<span style="text-decoration:line-through">$1</span>',
'<span style="color:$1">$2</span>',
'<span style="font-size:$1px">$2</span>',
'<span style="font-family:$1">$2</span>',
// '<img src="$1" alt="" />', // Image
// '<a href="$1">$1</a>', // URL
// '<a href="$1" title="$2">$2</a>',
// '<a href=\"mailto:$1\">$1</a>', // E-mail
// '<a href="mailto:$1">$2</a>'
);
/**
* Constructor
10 yabba Jan 29, 2006 02:20
Your search and replace arrays need to be in the same order. If you change the order to this you should be a tad closer :-
var $search = array(
'#\(.+?)\#is', // Formatting tags
'#\[name=(.+?)]#is',
'#\[date=(.+?)]#is',
'#\[place=(.+?)]#is',
'#\(.+?)\#is',
'#\[u](.+?)\[/u]#is',
'#\(.+?)\#is',
'!\[color=(#?[A-Za-z0-9]+?)](.+?)\[/color]!is',
'#\[size=([0-9]+?)](.+?)\[/size]#is',
¥
11 stevet Jan 29, 2006 18:01
Now it's getting interesting
the posting gets "rendered" and the [ stuff I entered] now looks like this:
[Eddon][1700][Middlesbrough]
I found out the the Eddons have a good many Forgers in their ranks.
Posted by admin
The three details in the [brackets] are hyperlinks now but if I click on [Eddon] it sends me to:
http://www.neukol.org.uk/?s=Eddon&sentance=or
which is another blog entirely - (it says sorry no post to dispay) I'm looking to seach the blog the posting was in which is
12 yabba Jan 29, 2006 18:39
Lol, I did say a tad :p
Ok, this is untested, but, change the code to this and see if it cures things :-
var $replace = array(
'<strong>$1</strong>', // Formatting tags
'[<a href="'.regenerate_url( 'sentance', 'sentance=or').'&s=$1" style="name_cat" title="Search for all posts relating to $1">$1</a>]',
'[<a href="'.regenerate_url( 'sentance', 'sentance=or').'&s=$1" style="date_cat" title="Search for all posts relating to $1">$1</a>]',
'[<a href="'.regenerate_url( 'sentance', 'sentance=or').'&s=$1" style="place_cat" title="Search for all posts relating to $1">$1</a>]',
'<em>$1</em>',
¥
13 stevet Jan 29, 2006 18:44
before we go too much further are you spelling sentence that way sentance that way on purpose.
14 yabba Jan 29, 2006 19:20
Did you not realise that it's the official blonde spelling of the word? 8| Shame on you ...... *whistles innocently*
Feel free to spell it correctly :p
¥
15 stevet Jan 29, 2006 19:24
I just wondered if it was one of those code things like "color" instead of "Colour" etc
16 yabba Jan 29, 2006 19:26
I'm the other side of the island from you and know of the vast difference between humor and humour ;)
¥
I'm assuming that you want to categorise them so that it makes finding all posts in a category simple?
If so, you could just use a keyword system, ie, your first post (in the example) would look something like :-
You could then amend the bbcode plugin (or code your own) to render these as search links :-
[<a href="<blog url>?s=<name>&sentance=and" style="name_cat" title="Search for all posts relating to <name>">name</a>]
That way you have no need to add extra cats every time you add a name/date/place
¥