News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Pretty URLs

Started by SMFHacks.com Team, January 31, 2007, 10:56:43 AM

Previous topic - Next topic

Dannii

Oh, I forgot to say... empty the pretty_urls_cache table too.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

L.G.S

Eldaka does it again.  Good going Batman!
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


L.G.S

Problem... the code change you gave me fixes RSS but now it stops my members from being able to quote. It just hangs on the ajax loading bar.
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Dannii

Using something like firebug, can you get the URL that the quote button uses with AJAX?
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

L.G.S

http://www.ruthlessintent.com/board/feedback/quote/0/#quickreply

That's from my browser. I'll download firebug now and get the other one.
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


L.G.S

FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


L.G.S

Just had a look around, it's shut down all of my AJAX features.
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Dannii

ahh, well yes thats a known bug with script tags. It's fixed in SVN, so you could try getting the files from: http://prettyurls.googlecode.com/svn/trunk/Base/ and making your own zip package for it.

Also, the dev forum is back: http://dev.eldacar.com/smf/
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

L.G.S

What do I do to just upgrade it from my package manager? Simply put it in a zip and nothing else?
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


eslao


Dannii

LGS, yep, but install the old one first. If you have topics with quotes in them they'll likely be broken by this though (as the old code for quotes is buggy). Hmm there's an idea actually... I could do the conversion when you install.

eslao, are you using UTF-8?
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

L.G.S

Are you sure you don't mean uninstall the Pretty URLS package I already had? Because I get this:

1.     Execute Modification     ./index.php     Test failed
2.    Execute Modification    ./SSI.php    Test successful
3.    Execute Modification    ./Sources/ManageErrors.php    Test successful
4.    Execute Modification    ./Sources/ModSettings.php    Test failed
5.    Execute Modification    ./Sources/News.php    Test successful
6.    Execute Modification    ./Sources/PackageGet.php    Test failed
7.    Execute Modification    ./Sources/QueryString.php    Test failed
8.    Execute Modification    ./Sources/Subs.php    Test failed
9.    Execute Modification    ./Sources/Display.php    Test successful
10.    Execute Modification    ./Sources/MessageIndex.php    Test successful
11.    Execute Modification    ./Sources/QueryString.php    Test failed
12.    Execute Modification    ./Sources/Subs-Boards.php    Test failed
13.    Execute Modification    ./Sources/Subs-Post.php    Test failed
14.    Execute Modification    ./Themes/default/ManageBoards.template.php    Test successful
15.    Execute Modification    ./Themes/default/languages/Modifications.english.php    Test successful
16.    Execute Modification    ./Themes/default/languages/Modifications.english-utf8.php    Test successful
17.    Extract File    ./Sources/PrettyUrls-Filters.php    
18.    Extract File    ./Sources/Subs-PrettyUrls.php    
19.    Execute Code    install.php
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Dannii

Oops yes I meant uninstall. Damn typos!
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

eslao

Quote from: eldʌkaː on October 08, 2007, 12:13:42 AM
LGS, yep, but install the old one first. If you have topics with quotes in them they'll likely be broken by this though (as the old code for quotes is buggy). Hmm there's an idea actually... I could do the conversion when you install.

eslao, are you using UTF-8?

no not utf-8 im using turkish language files

Dannii

This mod works best with UTF-8. Although I do have code to try converting character encodings, it will only work on a few servers.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

eslao

ok am watching the working progress thanks

glennk

Hi Eldacar,

Had something strange happen today. I viewed my site at work in my lunch break and noticed that after the urls there was a ling sessionid visible. However when I return home no such think is visible.

Do you have any idea why this would have happened ? and have you given anymore thought to getting rid of session id's as my SEO guy insists they are bad for the site in terms of seo.

Nao 尚

Great mod! I did write something similar on one of my boards, but it forced me to manually edit a lot of files in Sources.php and my themes. Of course, it also allows for better flexiblity in the URL format. Hard-coding the thread subject is nice because you don't have to specify the topic ID in the URL to be able to read it, but on the other hand it prevents the user from renaming that thread (or at least I suppose so).

My alternative version also doesn't use extra SQL queries either (which might be a good thing for huge boards). I'm wondering whether I should keep my system, or adopt Pretty URLs. It's always better to use a mod than re-coding everything everytime a new SMF is released! ;)

I'm a bit concerned with the CRC encoding of the URLs, though. Is it me, or does the mod call URLs by their CRC checksum? Obviously there's a chance two URLs will get the same CRC result, so one may end up with URL conflicts... I think.

Oh, yes, I also made a SMF 2.0 version of the mod. I'm currently testing it on a live install and it seems to be working... eldʌkaː, would you be interested in seeing it?

glennk > Session IDs only appear when you're a guest and no cookies. Usually, only on the first page. After following a link, the sessid should disappear.
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

Dannii

#818
Quote from: glennk on October 08, 2007, 04:09:40 PMHad something strange happen today. I viewed my site at work in my lunch break and noticed that after the urls there was a ling sessionid visible. However when I return home no such think is visible.

Do you have any idea why this would have happened ? and have you given anymore thought to getting rid of session id's as my SEO guy insists they are bad for the site in terms of seo.
As Nao said, it's probably got something to do with cookies.

QuoteGreat mod! I did write something similar on one of my boards, but it forced me to manually edit a lot of files in Sources.php and my themes. Of course, it also allows for better flexiblity in the URL format. Hard-coding the thread subject is nice because you don't have to specify the topic ID in the URL to be able to read it, but on the other hand it prevents the user from renaming that thread (or at least I suppose so).
It will be easy enough to change topic URLs once an interface is made to do so, I just haven't had the time to do so yet. Got more important changes to make first!

QuoteMy alternative version also doesn't use extra SQL queries either (which might be a good thing for huge boards). I'm wondering whether I should keep my system, or adopt Pretty URLs. It's always better to use a mod than re-coding everything everytime a new SMF is released! ;)
Extra queries could definitely slow things down, which is why I've included a little hack to show the time and queries the mod adds. I think LGS's forum is the largest with this mod, and it shows: Page created in 1.032 seconds with 24 queries. (Pretty URLs adds 0.048s, 1q) I think that's pretty good! :)

QuoteI'm a bit concerned with the CRC encoding of the URLs, though. Is it me, or does the mod call URLs by their CRC checksum? Obviously there's a chance two URLs will get the same CRC result, so one may end up with URL conflicts... I think.
There is that possibility. If someone reports collisions I'll change to MD5 or another hash. So far noone's reported collisions, so might as well keep with CRCs cause they're simpler.

QuoteOh, yes, I also made a SMF 2.0 version of the mod. I'm currently testing it on a live install and it seems to be working... eldʌkaː, would you be interested in seeing it?
I would! Sounds interesting.

If you end up deciding to switch, would you be interested in helping develop this one more?
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Nao 尚

Quote from: eldʌkaː on October 08, 2007, 08:43:38 PM
As Nao said, it's probably got something to do with cookies.
Since session IDs only appear on a first page, I've found they can be removed altogether from the code. Well, it works for me anyway.

QuoteIt will be easy enough to change topic URLs once an interface is made to do so, I just haven't had the time to do so yet. Got more important changes to make first!
What important changes? :)

QuotePage created in 1.032 seconds with 24 queries. (Pretty URLs adds 0.048s, 1q) I think that's pretty good! :)
Yeah... It's very good.

QuoteThere is that possibility. If someone reports collisions I'll change to MD5 or another hash. So far noone's reported collisions, so might as well keep with CRCs cause they're simpler.
I think collisions might be reported when the thread number goes over the millions... I don't mean forums with low thread numbers are safe. Just saying chances to have collisions can only go up.
Why not simply use the topic URLs themselves in the database? Because indexing based on a VARCHAR, TEXT or BLOB field is slower?

Quote
QuoteOh, yes, I also made a SMF 2.0 version of the mod. I'm currently testing it on a live install and it seems to be working... eldʌkaː, would you be interested in seeing it?
I would! Sounds interesting.
I'm sending the link to you by PM.

I only made one change to the code -- made sure the PrettyURLs stats are shown only when $db_show_debug is set to true. (I don't think it's of any interest to non-admins ;) And my index.php code is modified to set $db_show_debug if the user is an admin.)

QuoteIf you end up deciding to switch, would you be interested in helping develop this one more?
Well, re: the topic subject I reckon? I don't know, I'm no better than a rookie PHP coder. I even had a site crash when attempting to convert your mod ;) (Actually, it was because I had forgotten to convert a db_query into $smfFunc['db_query']... Boom! It screwed up the install process.)
Also, I had issues with the automatically generated .htaccess file, I don't know why. I had originally installed the board into a subdirectory. When I moved it to the root and reinstalled, it worked flawlessly. (And believe me, I have some prior knowledge of .htaccess -- you need that if you want to change your URL format!)

Anyway, I might just do that (switch to PrettyURLs) if we can add more formatting options for the URLs. What I could do is, try to gather all of the mods I made on my side (keep in mind I didn't make an actual mod--this is really a series of modifications directly on the 1.1.3 source files), and share with you anything that could be of interest to PrettyURLs.

For example, here's my URL conversion code. You'll notice it's much shorter than yours ;) My database isn't in UTF-8, though. It basically only converts French accents, well, because I'm French, and my website is French-only. Your mod converts such things as Japanese kana, but it doesn't work on French accents, strangely enough.

function clean_name($txt)
{
$txt = str_replace(array(' ','/','.',',','"','"','?'),'-',strtolower($txt));
$txt= preg_replace('/&#(\d+);/me',"chr(\\1)",$txt);
$txt = strtr($txt,'çàäîïéèëêôöùûüÇÀÄÎÏÉÈËÊÔÖÙÛÜ', 'caaiieeeeoouuucaaiieeeeoouuu');
while (strpos($txt,'--') !== false) $txt = str_replace('--','-',$txt);
if (substr($txt, 0, 4) == 're:-')
$txt = substr($txt, 4);
return trim($txt,'-');
}


Here's an example URL... (Taken from a friend's blog hosted on my system.)
Topic subject: Les douze travaux de Ryô (4e épreuve: Ryo & the secret workers - 1)
Topic URL: http://ryo.cyna.fr/4921/les-douze-travaux-de-ryo-(4e-epreuve:-ryo-&-the-secret-workers-1)/
Having the & sign in the URL is no issue. The .htaccess parser has no problem with it. The only special character I think we have to take care of is "?" because it tells Apache that the rest is $_GET data so it just won't parse it.
Anyway, the subject won't be parsed by SMF, because obviously it uses directly the topic number (4921), saving a SQL query in the process, and allowing for later subject modifications. The subject is here really only for SEO purposes. And user convenience, of course.

I also added an extra field to the boards table, "shortname" (shall be renamed to "short_name" for SMF 2.0...), which holds the URL name for the boards. Allowing for a long and complicated name in the database (and MessageIndex template) without prejudice in the URL. For instance, board #18 in my website is named "Naologismes", but its "short_name" is set to "nao", hence the URL "/nao/". Actually, I changed the system so it would generate a subdomain instead, so it renders it as "http://nao.cyna.fr/". The .htaccess file then just checks for the presence of a subdomain, and if there is, it sends a flag to SMF, similar to your "pretty;" flag in your .htaccess. I'm surprised at how many things we did the same way, while we weren't aware of each other's attempts to do these modifications ;)

Although it's entirely in French, you may want to check out http://cyna.fr -- you can click pretty much anywhere and check the results. It may give you new ideas. :)
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

Advertisement: