Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Markup Tags: Need help to create an advanced tag

Quote Reply
Markup Tags: Need help to create an advanced tag
Hello,

I'm trying to figure out how to create an advanced tag.

Here is what I would like:

User types [card=banefire]
Gets translated to img src=mydomain.com/banefire.full.jpg

I don't want to have to require the users to type in [card=banefire.full.jpg]
because they will 98% of the time forget to put in the .full.jpg at the end of it.

Of course whatever they type in [card=Absorb Vis] would get translated to img src=mydomain.com/Absorb Vis.full.jpg

On and on to endless possibilities of how many keywords they might enter that should bring up an image stored on our server.

Thanks,
Quote Reply
Re: [Westin] Markup Tags: Need help to create an advanced tag In reply to
Why not just add tags like [banefire] , which then converts to the img tag?

The way you are suggesting is gonna have the potential to make your site look awaful, as people could enter anything (bla bla, for example - and if that doesn't exist, then it obvioulsy won't show, and they will just see a dead image)

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 Tags: Need help to create an advanced tag In reply to
Well, theres a total of 10,669 images. So writing one for each image would be out of the question unfortunately.

I'm not bothered by the broken images, if someone wants to look the fool, more power to them for looking the fool.

Have you seen how many broken images or "image not found at such and such service" or "bandwidth has been exceeded" images popup on forums now adays? It's not a problem for me.

Now down to the tag, can somethng like what I have in mind be done wth a tag?
Quote Reply
Re: [Westin] Markup Tags: Need help to create an advanced tag In reply to
Fair enough =) Afraid I've never really played around with the advanced tag stuff, so can't be of much help.

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: [Westin] Markup Tags: Need help to create an advanced tag In reply to
Fair enough, hopefully someone or maybe someone at Gossamer and can inform me how to go about doing these two types of tags.


Oh and I'd also like the following:

[c]banefire[/c] and it would produce the href=mydomain.com/image.php?file=banefire target=_blank

So I know we have two different tags that would be needed. One that will display the image inline in the forums message and one that would produce a link that people can click on and be shown the image in a new browser window.

Last edited by:

Westin: Apr 28, 2009, 1:44 AM
Quote Reply
Re: [Westin] Markup Tags: Need help to create an advanced tag In reply to
Okay, it wasn't that tough at all

It's unfortunate that there isn't a way to get the markup tags to insert the closing tag too but I guess this is the next best thing for me.

So...

Here's how it works (for me)

I want to let the users type in the name of a gaming card (we'll use Spellbound Dragon as the card) and make it as clean and simple as possible.

Here's what they type in: [c Spellbound Dragon][/c]
Here is the markup tag itself

Tag: c()
Html:
Code:
<a href="http://gatherer.wizards.com/pages/card/details.aspx?name=%1% %2% %3% %4% %5% %6% %7% %8%" target="_blank">%1% %2% %3% %4% %5% %6% %7% %8%
Closing Tag Html:
Code:
</a>

You'll note all those %1% %2% %3% etc etc. What I've found out is that for each one of those, it will take the word that the user wrote inside of the tag [c Spellbound Dragon] which is two words, so it's going to use the %1% %2% and replace that inside of the tag with Spellbound Dragon.

The reason that I've got all the way up to %8% is simply to insure that if the game company ever comes out with a card with a 8 word name, then it's covered and I don't need to mess around with it.

So somebody could type in [c The Rain in Spain falls mainly on the plains][/c] and it would get translated in the forums to:
Code:
<a href="http://gatherer.wizards.com/pages/card/details.aspx?name="The Rain in Spain falls mainly on the" target="_blank">The Rain in Spain falls mainly on the</a>
Note that our phrase above is actually 9 words, but because I only have the tags up to the eighth word (%8%) it will chop off anything beyond the 8th word. Likewise if you use less than 8 words, that's okay too since it will just ignore the rest of the %#% tags in the markup tag.

What I would have really liked however would be for our users to only have to type in [c Spellbound Dragon] and leave off the closing [/c] and have it still translate it over, however Im not seeing a way to do that with this forum software unfortunately, so im gonna guess that it just can't be done and the peeps will have to add the closing tag.

Mainly I want that for convienience, however I know people will forget the closing tag, and unfortunately that means that Gforums will not put the closing </a> tag for them so it will hotlink whatever text comes behind it if they forget to put the closing tag.

If there is a better way of doing this, I'd sure like to know about it.
Quote Reply
Re: [Westin] Markup Tags: Need help to create an advanced tag In reply to
Actually, I should clarify that, the forum doesn't actually ignore the extra %#%, it simply replaces them with a blank space if there isn't a word to go in their place so if I were to type [c Spellbound Dragon][/c] it would actually write it out as Spellbound Dragon######## The # represent blank spaces that the forum would put in it's place.

So while I can't use this method to pull images via my image.php script, I can use it to link to the manufacturers website to show the members a particular card since the manufacturers scripts ignore blank spaces at the end of the card name.

So it's just something to keep in mind. It's rather unflexible this way since if you don't know how many words a person is going to enter, you kind of just have to make sure you have enough %#% in the html tag to hopefully accomodate them, but then you end up with a bunch of blank white space following whatever word gets inputed into the translating of the tag.

Again, if theres a better way i'd love for Gossamer to step up to the plate here and let us know.

And something to remember, the forum software does have "issues". If you edit your post and have a link like what I've written in this thread, then all those extra %#% are going to get tagged onto the end of the verbage in your link as 2020202020 with 20 for each extra space unfortunately. But as long as you don't have to edit your post your fine, or if you do, then you have to delete the links that are in the wysiwyg editor and rewrite them or switch to the basic editor.

Yeah, this is whY I'd rather use a more modern piece of forum software but since I also want to use Links, Im pretty much stuck with these quirks and using Gforums.

Last edited by:

Westin: May 13, 2009, 6:59 PM
Quote Reply
Re: [Westin] Markup Tags: Need help to create an advanced tag In reply to
I added support for using %0% to the unreleased gforum 2 for this reason.

If you're adventurous, you can try this patch (google if you don't know how to use a patch):
Code:
--- gforum/cgi/admin/GForum/Convert.pm 2006/09/28 23:04:10 1.59
+++ gforum/cgi/admin/GForum/Convert.pm 2006/11/27 19:30:44 1.61
@@ -235,12 +235,13 @@ sub _plg_convert_markup {
}
}
if (@args) {
- for (1 .. @args) {
- my $html_escaped = $args[$_ - 1];
+ for (0 .. @args) {
+ my $arg = $_ ? $args[$_ - 1] : join ' ', @args;
+ my $html_escaped = $arg;
$html_escaped =~ s/"/&quot;/g;
$html_escaped =~ s/'/&#39;/g;
- $args[$_ - 1] =~ s/&amp;/&/g;
- my $cgi_escape = $IN->escape($args[$_ - 1]);
+ $arg =~ s/&amp;/&/g;
+ my $cgi_escape = $IN->escape($arg);
$val =~ s/%c$_%/$cgi_escape/g;
$val =~ s/%$_%/$html_escaped/g;
}
It _should_ apply to gforum 1.

Adrian
Quote Reply
Re: [brewt] Markup Tags: Need help to create an advanced tag In reply to
Before I go looking up how to do the patch files.... (seems from what I remember the same way that SMF forums has for when we needed to do manual patches,)

Does using a %0% arguement in the tag, basically eliminate needing to write out the %1% %2% %3% %4% etc. It takes the place and just grabs the entire phrase that someone enters in the tag?
Quote Reply
Re: [Westin] Markup Tags: Need help to create an advanced tag In reply to
Yes, I believe that is what it does. If I did the patch correctly then replacing all the %#% that I used to have (about 5 to 8 of them) with simply %0% now takes the full arguement that the person adds to the tag so seems to work well.

Thanks for the help.
Quote Reply
Re: [Westin] Markup Tags: Need help to create an advanced tag In reply to
Yup, that's right.

Adrian
Quote Reply
Re: [brewt] Markup Tags: Need help to create an advanced tag In reply to
For anybody else that is interested, in the case as listed above, you can get rid of the closing tag i.e. ([c cardname][/c]) and just use [c cardname] by restructuring the markup tag to be :
Code:
[<a href="http://gatherer.wizards.com/pages/card/details.aspx?name=%0%" target="gatherer">%0%</a>]
And leave the closing HTML empty, this way it's all hotlinked inside of the opening tag and no longer a need for writing out the extra [/c] to close the tag like we were doing on my site which was getting really tiresome.

I don't know why I didn't think of this before, other than maybe by having the closing html tag listed in the markup tag entry form, I thought maybe it was mandatory to have something in there, but obviously it's not.