Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

Markup codes, how are they done?

Quote Reply
Markup codes, how are they done?
Hi,

I'm gonna try and add in things like [b]bla[/b] into my Guestbook plugin - but I'm not really sure of the best way to do this? If there a function that does this? (I've looked through Markup.pm, but its pretty confusing :D)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Markup codes, how are they done? In reply to
See GForum::Convert::convert_markup

Adrian
Quote Reply
Re: [brewt] Markup codes, how are they done? In reply to
brewt wrote:
See GForum::Convert::convert_markup
Thanks, I'll take a look :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [brewt] Markup codes, how are they done? In reply to
Hi,

Is there a way I can just use this function?

I tried:

print GForum::Convert::_plg_convert_markup(qq~[code]test[/code] [b]another test[/b]~);

..and also:

print GForum::Convert::convert_markup(qq~[code]test[/code] [b]another test[/b]~);

..but both give an error:

fatal error has occurred:

Quote:
Can't use string ("[code]test[/code] [b]another tes") as a SCALAR ref while "strict refs" in use at /var/home/forum/ultradev.com/cgi-bin/forum/admin/GForum/Convert.pm line 78.

Please enable debugging in setup for more details.

..so I'm guessing thats not how it likes its arguments? =)

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: Feb 22, 2008, 1:46 AM
Quote Reply
Re: [brewt] Markup codes, how are they done? In reply to
Hi,

Ok, I found this in Gforum/Post.pm:

convert_markup(\$signature);


..so I tried:

use GForum::Convert;
my $test = qq~[code]test[/code] [b]another test[/b]~;
print "COVERTED: " . GForum::Convert::convert_markup(\$test);


.. but all that does, is return nothing.

Any suggestions?

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Markup codes, how are they done? In reply to
Mmmm ok - back to this stuff once again.

Tried:

GForum::Convert::convert_markup(\$post_message);

...and that seems to work when doing a dump of $IN, but has an error at the end:

Code:
'forum_edit_timeout' => '120',
'post_message' => 'newest test [img]http://www.freefoto.com/images/04/34/04_34_2---Computer-Keyboard_web.jpg[/img.]
[signature.]',
'forum_hard_delete' => '2',
'forum_desc' => \'<small><br>Belize, Costa Rica, Guatemala, Honduras, Nicaragua, Panama et Salvador.</small>',
'post_sujet2' => undef,
'post_icon' => undef
};
$VAR1 = {
'post_root_id' => 0,
'forum_id' => '46',
'post_id' => '2146288',
'user_id_fk' => '309804'
};
{ photo_post_root_id => 2146288, photo_forum_id => 46 } , { photo_post_id => 2146288 } mCan't use string ("newest test <img src="http://www") as a SCALAR ref while "strict refs" in use at /var/home/voyage/voyageforum.com/www/admin/GForum/Convert.pm line 78.

Please help - as this is driving me NUTS!


Also tried this:
Code:
my $inline_opts = [
$post->{post_id},
\my $forum_inline_calced,
\my %forum_inline,
[$post->{forum_id_fk} || ()],
$post->{forum_id_fk} || undef,
$post->{_post_preview} ? (1, $post->{post_unique_id}) : ()
];
GForum::Convert::convert_markup($post_message, \&GForum::Post::_inline, $inline_opts);

..and that gives exactly the same error :(

All I wanna do, is convert the inputted HTML (from the WYSIWYG editor), into BBCode, and then update the DB (cos for some reason, the hook I'm using doesn't seem to wanna play ball, and update the data)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!