I am developing a corporate-type site using b2evolution (Phoenix). The content doesn't change often, but I like the blogging functionality that b2e has and I'm familiar with it. Since the content doesn't change often I hard-coded my navigation menu to use permalinks to navigate the site, mostly because they look nicer. I used the hack to remove the dates, but I ran into something even uglier.
I have some posts which are multipage entries. On the main navigation menu, you get to a multipage post using the normal attractive permalink, but once you are surfing between pages you get the normal ugly URLs. And what if I wanted to permalink directly to page 3 for some reason? Can't do it currently; not that I found anyway.
So this hack which I am now posting will take the ugly multi-page URL such as this:
/site.com/index.php?p=92&page=3&more=1
And turn it into something like this:
/site.com/index.php/long_article,3
-----
First, in the b2e admin panel, I went to the tab entitled "settings" and turned on "use extra-path info", and for permanlink type I selected the option "post called up by its URL title".
Next, I installed the hack to remove dates from permalinks, as provided by Jeremy Bettis here:
http://www.deadbeef.com/index.php/b2evolution_remove_dates_from_permalinks
My additions below do not require this, so if you want to keep the dates in your URLs that is fine. But why not make them look good all at once? :)
Next, in ./evocore/_blog_main.inc.php find this line:
$title = $path_elements[$i];
and replace it with these lines:
$getpage = explode( ',', $path_elements[$i] );
$title = trim( $getpage[0] );
$page = trim( $getpage[1] );
Finally, in ./evocore/_item.funcs.php find these lines:
if( ($i != $page) || ( (!$more) && ($page==1) ))
echo '<a href="'.url_add_param($file, 'p='.$id.'&more=1&page='.$i).'">';
and replace them with these lines:
global $pagenow;
$newpage = explode( ",", $pagenow );
if( $newpage[1] < 1 ) $newpage[1] = 1;
if( ($i != $newpage[1]) || ( (!$more) && ($page==1) )) {
$new = "/".$newpage[0].",$i";
$newurl = '<a href="'.url_add_param($file, $new).'">';
$done = str_replace( "?".$new, $new, $newurl );
echo $done;
}
Right under this, find this line:
if( ($i != $page) || ( (!$more) && ($page==1) ))
and replace it with this line:
if( ($i != $newpage[1]) || ( (!$more) && ($page==1) ))
This should replace all b2e generated multi-page links with attractive permalink style multipage links. I'm sure it can be optimized a bit but the above works for me. Now, no one ever has to see ugly URLs on my site, but they can see or even bookmark ones that clearly indicate what they are looking at.
I doubt this works with previous versions of b2e and I won't be modifying it for them. If someone else would like to do so, that would be very cool. I will try and come back and help with any replies, but registering just to post this was annoying so I may not.
Good luck all.
Does anyone have any suggestions on how to make this hack:
http://www.deadbeef.com/index.php/b2evolution_remove_dates_from_permalinks
Work for 1.10?
To be clearer, I can get the date out of the links, but that messes up the archives plugin. If I change this:
to this:
The archive links have no dates, but the archive links have capital letters that render the links useless.