MyBB Community Forums

Full Version: MyCode Help?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Alright, what I'm trying to do is simple. Yet I can't get it. You know The HTML Name attribute? I wanna do that with my code. For example:
[namelink]test[/namelink]


[name]test[/name]

Where the link will go down the post to that anchor, or it'll go down to the word test. If that made any sense.. well..
Are you talking about anchors?

I'm guessing you want something like this:

Expression
\[namelink=([a-zA-Z0-9 _\-]+)\](.+?)\[/namelink\]
Replacement
<a href="#$1">$2</a>

Expression
\[name\]([a-zA-Z0-9 _\-]+)\[/name\]
Replacement
<a name="$1"></a>


An issue with this is possible conflicts in multiple posts.
Hope that helps.
######
EDIT: I'm using MyCode only to create the anchors, not the links.

(2009-01-17, 03:28 AM)Yumi Wrote: [ -> ]...An issue with this is possible conflicts in multiple posts.
Hope that helps.

For links pointing towards anchors in posts:
Replacing the second pid ((ie. pid=17#pid17)) with the anchor name seems to work and point to only one unique post.

Sample:
http://sample.com/bb/showthread.php?tid=13&pid=17#anchor

Please, tell me if you (or anyone) sees any apparent issues with this method?

########

EDIT #2:
The example above seems to work fine, unless you are using the Spicefuse SEO mod

http://sample.com/bb/thread-title-keywords-in-the-url-t-24.html#pid31

Since the pid isn't repeated, there is no way to replace it with your anchor. Toungue