BBCode [Board] [Forum] [Topic] Tags Idea

Started by karlbenson, August 23, 2006, 06:19:22 PM

Previous topic - Next topic

karlbenson

I have an idea for a mod.  I would try it myself, but I'm still learning the basics of mod making.

Some new tags
[forum] = forum link eg http://www.simplemachines/community/
[board=][/board] = board link eg [board=1.0]Announcements[/board] would make a link to that board
[topic=][/topic] eg [topic=1.0]Welcome Topic[/topic] would make a link to that topic
[profile=][/profile] eg [profile=44242]Username[/profile] would make a link to the profile
- It would save you database from holding long urls
- If you change your domain name it should mean you wont have to go and change all the posts.

Maybe even [arcade=][/arcade] to point to arcade games ;)

karlbenson

I decided to try and do it myself.

The only way to learn is to try.

winrules



winrules
SMF Developer
               
My Mods
Please do not PM me for support.


Gary

The Board/Topic/Profile tags seem interesting, they might be useful, I'll have stab at coding them up.

-AwwLilMaggie
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

RyanJones

Here's the [forum] one for you, I'll get working on the others as soon as I get some time. (Tested SMF 1.1RC3)

Open: /Sources/Subs.php

Find:


	
	
if (empty(
$modSettings['enableEmbeddedFlash']))
	
	
	
$disabled['flash'] = true;


After, Add:


    $parts    
parse_url($_SERVER['REQUEST_URL']);
    
$forumURL $parts['scheme'] . '://' $parts['host'] . $parts['path'];



Find:


	
	
	
array(
	
	
	
	
'tag' => 'ftp',
	
	
	
	
'type' => 'unparsed_equals',
	
	
	
	
'before' => '<a href="$1" target="_blank">',
	
	
	
	
'after' => '</a>',
	
	
	
	
'disallow_children' => array('email''ftp''url''iurl'),
	
	
	
	
'disabled_after' => ' ($1)',
	
	
	
),


After, Add:


	
	
	
array(
	
	
	
	
'tag' => 'forum',
	
	
	
	
'type' => 'closed',
	
	
	
	
'content' => '<a href="' $forumURL '">' $forumURL '</a>',
	
	
	
	
'disallow_children' => array('email''ftp''url''iurl'),
	
	
	
	
'disabled_after' => ' ($1)',
	
	
	
),


Save and close all files.

Should be close to what you requested.

-- Ryan Jones
RyanJ (Ryan Jones)

Support Web Standards!

Currently working On: Additions to the Karma system.

niko

Quote from: RyanJones on September 03, 2006, 09:27:50 AM
Here's the [forum] one for you, I'll get working on the others as soon as I get some time. (Tested SMF 1.1RC3)

I would use


	
	
	
array(
	
	
	
	
'tag' => 'forum',
	
	
	
	
'type' => 'closed',
	
	
	
	
'content' => '<a href="' $scripturl '">' $scripturl '</a>',
	
	
	
	
'disallow_children' => array('email''ftp''url''iurl'),
	
	
	
	
'disabled_after' => ' ($1)',
	
	
	
),
or

	
	
	
array(
	
	
	
	
'tag' => 'forum',
	
	
	
	
'type' => 'unparsed_content',
	
	
	
	
'before' => '<a href="' $scripturl '" target="_blank">',
	
	
	
	
'after' => '</a>',
	
	
	
	
'disallow_children' => array('email''ftp''url''iurl'),
	
	
	
	
'disabled_after' => ' ($1)',
	
	
	
),


(or something like this)
Websites: Madjoki || (2 links retracted by team, links out of date and taken over.)
Mods: SMF Arcade, Related topics, SMF Project Tools, Post History

WIP Mods: Bittorrent Tracker || SMF Wiki

RyanJones

Both would work good, I was just following the specs of the OP as best I could :)

-- Ryan Jones
RyanJ (Ryan Jones)

Support Web Standards!

Currently working On: Additions to the Karma system.

RyanJones

Assuming you put in the forum code above already... here are the others.

Find:


	
	
	
array(
	
	
	
	
'tag' => 'blue',
	
	
	
	
'before' => '<span style="color: blue;">',
	
	
	
	
'after' => '</span>',
	
	
	
),


After, Add:


	
	
	
array(
	
	
	
	
'tag' => 'board',
	
	
	
	
'type' => 'unparsed_equals',
	
	
	
	
'before' => '<a href="' $forumURL '?board=$1">',
	
	
	
	
'after' => '</a>',
	
	
	
	
'disallow_children' => array('email''ftp''url''iurl'),
	
	
	
	
'disabled_after' => ' ($1)',
	
	
	
),




Find:


	
	
	
array(
	
	
	
	
'tag' => 'table',
	
	
	
	
'before' => '<table style="font: inherit; color: inherit;">',
	
	
	
	
'after' => '</table>',
	
	
	
	
'trim' => 'inside',
	
	
	
	
'require_children' => array('tr'),
	
	
	
	
'block_level' => true,
	
	
	
),


After, Add:


	
	
	
array(
	
	
	
	
'tag' => 'topic',
	
	
	
	
'type' => 'unparsed_equals',
	
	
	
	
'before' => '<a href="' $forumURL '?topic=$1">',
	
	
	
	
'after' => '</a>',
	
	
	
	
'disallow_children' => array('email''ftp''url''iurl'),
	
	
	
	
'disabled_after' => ' ($1)',
	
	
	
),




Find:


	
	
	
array(
	
	
	
	
'tag' => 'pre',
	
	
	
	
'before' => '<pre>',
	
	
	
	
'after' => '</pre>',
	
	
	
),


After, Add:


	
	
	
array(
	
	
	
	
'tag' => 'profile',
	
	
	
	
'type' => 'unparsed_equals',
	
	
	
	
'before' => '<a href="' $forumURL 'action=profile;u=$1">',
	
	
	
	
'after' => '</a>',
	
	
	
	
'disallow_children' => array('email''ftp''url''iurl'),
	
	
	
	
'disabled_after' => ' ($1)',
	
	
	
),


-- Ryan Jones
RyanJ (Ryan Jones)

Support Web Standards!

Currently working On: Additions to the Karma system.

karlbenson


winrules

Quote from: RyanJones on September 03, 2006, 09:43:35 AM
Both would work good, I was just following the specs of the OP as best I could :)

-- Ryan Jones
I don't see why you can't just use $scripturl...It just takes longer and is less efficient..


winrules
SMF Developer
               
My Mods
Please do not PM me for support.


RyanJones

#10
OK, made the changes per request. Also added validation checks on the params :)

Open: /Sources/Subs.php




(BOARD) Find:


	
	
	
array(
	
	
	
	
'tag' => 'blue',
	
	
	
	
'before' => '<span style="color: blue;">',
	
	
	
	
'after' => '</span>',
	
	
	
),


After, Add:


	
	
	
array(
	
	
	
	
'tag' => 'board',
	
	
	
	
'type' => 'unparsed_equals',
	
	
	
	
'test' => '[0-9]+\.[0-9]',
	
	
	
	
'before' => '<a href="' $scripturl '?board=$1">',
	
	
	
	
'after' => '</a>',
	
	
	
	
'disallow_children' => array('email''ftp''url''iurl''board''forum''profile''topic'),
	
	
	
	
'disabled_after' => ' ($1)',
	
	
	
),





(FORUM) Find:


	
	
	
array(
	
	
	
	
'tag' => 'ftp',
	
	
	
	
'type' => 'unparsed_equals',
	
	
	
	
'before' => '<a href="$1" target="_blank">',
	
	
	
	
'after' => '</a>',
	
	
	
	
'disallow_children' => array('email''ftp''url''iurl'),
	
	
	
	
'disabled_after' => ' ($1)',
	
	
	
),


After, Add:


	
	
	
array(
	
	
	
	
'tag' => 'forum',
	
	
	
	
'type' => 'closed',
	
	
	
	
'content' => '<a href="' $scripturl '">' $scripturl '</a>',
	
	
	
	
'disallow_children' => array('email''ftp''url''iurl''board''forum''profile''topic'),
	
	
	
	
'disabled_after' => ' ($1)',
	
	
	
),





(PROFILE) Find:


	
	
	
array(
	
	
	
	
'tag' => 'pre',
	
	
	
	
'before' => '<pre>',
	
	
	
	
'after' => '</pre>',
	
	
	
),


After, Add:


	
	
	
array(
	
	
	
	
'tag' => 'profile',
	
	
	
	
'type' => 'unparsed_equals',
	
	
	
	
'test' => '[0-9]+',
	
	
	
	
'before' => '<a href="' $scripturl '?topic=$1">',
	
	
	
	
'after' => '</a>',
	
	
	
	
'disallow_children' => array('email''ftp''url''iurl''board''forum''profile''topic'),
	
	
	
	
'disabled_after' => ' ($1)',
	
	
	
),





(TOPIC) Find:


	
	
	
array(
	
	
	
	
'tag' => 'table',
	
	
	
	
'before' => '<table style="font: inherit; color: inherit;">',
	
	
	
	
'after' => '</table>',
	
	
	
	
'trim' => 'inside',
	
	
	
	
'require_children' => array('tr'),
	
	
	
	
'block_level' => true,
	
	
	
),


After, Add:


	
	
	
array(
	
	
	
	
'tag' => 'topic',
	
	
	
	
'type' => 'unparsed_equals',
	
	
	
	
'test' => '[0-9]+\.([0-9]+|new)',
	
	
	
	
'before' => '<a href="' $scripturl '?topic=$1">',
	
	
	
	
'after' => '</a>',
	
	
	
	
'disallow_children' => array('email''ftp''url''iurl''board''forum''profile''topic'),
	
	
	
	
'disabled_after' => ' ($1)',
	
	
	
),



... and that should do it :)

-- Ryan Jones
RyanJ (Ryan Jones)

Support Web Standards!

Currently working On: Additions to the Karma system.

Advertisement: