News:

Wondering if this will always be free?  See why free is better.

Main Menu

Show Local Url Titles

Started by Nathaniel, July 17, 2008, 11:17:23 PM

Previous topic - Next topic

[unplugged]

It's the URLs inside a post that would display as titles with this mod. In other words, if you were to put a link to another post in here, like
http://www.somewebsite.org/forum/index.php?action=post;topic=111111111
it would display as the title of that post, something like
My Posts Rock
or whatever. I hope I explained that well.  :P
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



Nathaniel

That seems to be exactly the way I would explain it.

If you make a new post in that website/forum, and put a link to "http://openalternatives.org/forums/index.php/board,1.0.html" then it would be replaced with the title of the post you are linking to "Welcome to SMF!".
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

webdzinez

Got it ... I was confusing it with a permalink mod. Sorry about that. This is a useful functionality ....

Nathaniel

Its one of those functionalities which could almost be a default part of the forum software. Anyway, I have updated the documentation to try to make it clearer that it changes the urls inside posts.

Thank you, for pointing out/finding the lack of clarity. :)
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

L'AltroWeb

#24
Hi!
I have installed your great mod but i have a problem with pretty url:
-
Please see here (click to demo):

Nathaniel

I don't have the time to look at this right now, but I will try to investigate it shortly. I haven't even bothered checking compatibility with this mod, but I can imagine that there issues.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

[unplugged]

I use both mods without any compatibility issues at all. They work flawlessly together on SMF 2.0 Beta 3.1 Public. Just trying to help with your search for a cause.  ;D
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



Nathaniel

The only problem being that Dark-Wolf is running SMF 1.1.5 and there could be a compatibility issue for that version of SMF. ;)
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

L'AltroWeb

OK!
Thanks boy, i attend impatiently smf 2 final :)

Manu.G

I really want to use the mod, but I got the "Test failed" by installing.
I checked the xml file and found out the installation failed at this part:

'content' => '<a href="$1" target="_blank">$2</a>',

But to install this mod the code in the Subs.php has to be this

'content' => '<a href="$1" target="_blank">$1</a>',

I don't know which mod has changed this part in the Subs.php, cause we
have tons of mods installed in our forum.  :-\

What have I to do that I can use the mod in our forum?
Version SMF 2.0.8
SimplePortal 2.3.5

Nathaniel

I am not sure which mod has changed that, could you please post a list of any mods which may have changed/mucked with your urls and also that file so that I can have a look at it.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Manu.G

I checked it, the only mod I have installed which is changing this part in the Subs.php is the "Trim URL" mod.

I added my Subs.php

Thanks in advance for your help :D
Version SMF 2.0.8
SimplePortal 2.3.5

Nathaniel

@Manu0372,
I have fixed this issue and uploaded a copy of your subs.php file which should work with the changes I made. I changed it so that if it can't find a Internal/Local url, it will shorten it with the Trim Urls mod.


Tutorial for fixing Compatibility between This mod and the Trim Urls Mod for SMF 1.1.5:

1. Install the Show Local Url Titles Mod first, its important that you install this mod first, if you already have the Trim Urls mod then you can uninstall it and then re-install it later.
2.  Try to install the Trim Urls Mod, it should have errors with modifications for the Subs.php file, proceed with the install anyway.
3. Find the code below (From Subs.php):
                //    Run the url through the get_ShowUrlTitle() function.
                 $text = get_ShowUrlTitle($data);


Replace it with this code:
//    Run the url through the get_ShowUrlTitle() function.
                $text = get_ShowUrlTitle($data);
                   
                //    Put in the hack for the trim urls mod.
                //    Only do it if the text is still the same as the url.
                if($text == $data)
                $text = urlTrim($text);


Delete this code (From Subs.php):, its now unecessary and will cause bugs, because Urls should now be handled by the Show Local Url Titles mod:
        // Trim the urls
        elseif (($tag['type'] == 'unparsed_content' && $tag['tag'] == 'url'))
        {
            $pos2 = stripos($message, '[/' . substr($message, $pos + 1, strlen($tag['tag'])) . ']', $pos1);
            if ($pos2 === false)
                continue;

            $data = substr($message, $pos1, $pos2 - $pos1);

            if (!empty($tag['block_level']) && substr($data, 0, 6) == '<br />')
                $data = substr($data, 6);

            if (isset($tag['validate']))
                $tag['validate']($tag, $data, $disabled);

            $code = strtr($tag['content'], array('$1' => $data, '$2' => urlTrim($data)));
            $message = substr($message, 0, $pos) . $code . substr($message, $pos2 + 3 + strlen($tag['tag']));
            $pos += strlen($code) - 1;
        }


That's it! You should now have an install that will try to find a Local Url Title, if it fails then the Trim Urls Mod will be used to shorten the leftover url.

Thank you,
LHVWB
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Manu.G

Thanks a lot for your fast help!!!!!  :D
Last question, should I install the mod with the package manager and loading up the modified Subs.php after the installation, or is it only for need to load up the Subs.php?
Version SMF 2.0.8
SimplePortal 2.3.5

Nathaniel

I actually just realized that there is a small error with the Subs.php file that I uploaded with the last post, this post has your Subs.php file with the correction.

You should just need to upload this Subs.php file on top of the old one, I have manually installed the Show Local Url Titles in that file and its the only file that the mod edits, so once you have uploaded that file, the mod will be installed and should work. :)
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Manu.G

I have uploaded the Subs.php which was in your last post and everything
works perfect.
Internal links are shown as topic title and external long links in short form.

Thanks a lot for your help!!  ;D
Version SMF 2.0.8
SimplePortal 2.3.5

Nathaniel

Glad I could help. :D

You had a few mods that changed that file, its good that you only had the one compatibility issue ;D
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Manu.G

Yes we have tons of mods installed in our forum, we decided to stop with
installing mods, but it isn't possible, cause there are a lot of great mods available for SMF.  ;)

Thanks again for your help.
Version SMF 2.0.8
SimplePortal 2.3.5

agentx42

#38
Here is my forum:

http://www.cai.servebbs.org:8080/smf/index.php/topic,47.0.html

I have version 1 running and it shows green, but when I posted a test list of URLS, it didn't do anything. 

It just shows the URLs as I typed them in:

Url integration test

www.partners-international.org/index.html

www.cai.servebbs.org:8080/smf/index.php

http://www2.pstel.net/index.asp

Am I missing something?

BuЯЯЯЯaK


Advertisement: