Clean URLs

Please post answers on the most frequently asked questions about CMSimple
cmb
Posts: 13273
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: Clean URLs

Post by cmb » Tue Jun 24, 2014 2:10 pm

Maxim wrote:Не хочу дублировать одни и те же буквы.
If you want to use $cf['uri']['lowercase']="", you have to.

See also an alternative solution that delivers nice URLs (at least for some languages) without the need for urichar_org/new.
Christoph M. Becker – Plugins for CMSimple_XH

Maxim
Posts: 121
Joined: Thu Jun 13, 2013 6:52 am
Location: Запорожье
Contact:

URLify.php

Post by Maxim » Wed Jun 25, 2014 5:27 am

Доброе утро.

[ external image ] Получилось, но URLify.php наверно больше памяти занимает. Наверно Urichar (org/new) лучше.
[ external image ] Es passiert ist, aber URLify.php wahrscheinlich mehr Speicher belegt. Wahrscheinlich Urichar (org/new) besser.
[ external image ] Turned out, but URLify.php probably more memory is. Probably Urichar (org/new) better.
Simple Hosting
Бедная, бросаемая бурею, безутешная!

Maxim
Posts: 121
Joined: Thu Jun 13, 2013 6:52 am
Location: Запорожье
Contact:

Помогите добавить ".html" и удалить "?"

Post by Maxim » Mon Jan 26, 2015 10:18 am

Помогите добавить ".html" и удалить "?"
Help add ".html" and delete "?"

Code: Select all

<link rel="prev" href="/cmsimplexh/?menu-levels-and-headings/menu-level-2-page-1">
<link rel="next" href="/cmsimplexh/?menu-levels-and-headings/menu-level-2-page-1/menu-level-3-page-2">
<link rel="canonical" href="http://localhost/cmsimplexh/menu-levels-and-headings/menu-level-2-page-1/menu-level-3-page-1">
<td class="previous"><a href="/cmsimplexh/menu-levels-and-headings/menu-level-2-page-1.html?" rel="prev">« prev</a></td>
<td class="next"><a href="/cmsimplexh/menu-levels-and-headings/menu-level-2-page-1/menu-level-3-page-2.html?" rel="next">next »</a></td>
CleanURLs 1.6.5:
maxim-full-cmsimple-xh-165-cleanurls-20154c60df546305.zip
maxim-addon-cmsimple-xh-165-cleanurls-2054c60e073f045.zip
maxim-config-cmsimple-xh-165-cleanurls-254c60e13a638b.zip
maxim-bkr-cmsimple-xh-165-cleanurls-201554c60e1d4c739.zip

Снимки экрана:
Screenshots:
1html54c6117f66502.png
2html54c6118811a03.png

http://foxpro.maxim.zp.ua/saytostroenie ... -urls.html
Last edited by Maxim on Wed Jan 20, 2016 6:17 am, edited 1 time in total.
Simple Hosting
Бедная, бросаемая бурею, безутешная!

Maxim
Posts: 121
Joined: Thu Jun 13, 2013 6:52 am
Location: Запорожье
Contact:

"prev" и "next"

Post by Maxim » Mon Jan 26, 2015 2:54 pm

"prev"
tplfuncs.php
Меняем эту строчку:

Code: Select all

return tag('link rel="prev" href="' . $sn . '?' . $u[$index] . '"');
На эту:

Code: Select all

return tag('link rel="prev" href="' . $sn . $u[$index] . '.html"');
"next"
Меняем эту строчку:

Code: Select all

return tag('link rel="next" href="' . $sn . '?' . $u[$index] . '"');
На эту:

Code: Select all

return tag('link rel="next" href="' . $sn . $u[$index] . '.html"');
"canonical"
userfuncs.php
Меняем эту строчку:

Code: Select all

. htmlspecialchars($url, ENT_COMPAT, 'UTF-8') . '"') . "\n";
На эту:

Code: Select all

. htmlspecialchars($url, ENT_COMPAT, 'UTF-8') . '.html"') . "\n";
"previous"
tplfuncs.php
Меняем эти строки:

Code: Select all

function previouspage()
{
    global $tx;

    $index = XH_findPreviousPage();
    if ($index !== false) {
        return a($index, '" rel="prev') . $tx['navigator']['previous'] . '</a>';
    }
}
На эти (1.6.2):

Code: Select all

function previouspage()
{
    global $s, $cl, $tx;

    for ($i = $s - 1; $i > -1; $i--) {
        if (!hide($i)) {
            return a($i, '') . $tx['navigator']['previous'] . '</a>';
        }
    }
}
"next"
Меняем эти строки:

Code: Select all

function nextpage()
{
    global $tx;

    $index = XH_findNextPage();
    if ($index !== false) {
        return a($index, '" rel="next') . $tx['navigator']['next'] . '</a>';
    }
}
На эти (1.6.2):

Code: Select all

function nextpage()
{
    global $s, $cl, $tx;

    for ($i = $s + 1; $i < $cl; $i++) {
        if (!hide($i)) {
            return a($i, '') . $tx['navigator']['next'] . '</a>';
        }
    }
}
Simple Hosting
Бедная, бросаемая бурею, безутешная!

cmb
Posts: 13273
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: Clean URLs

Post by cmb » Tue Mar 03, 2015 1:17 pm

I received a support request regarding failing page internal links when using clean URLs, e.g. something like the following will not work correctly:

Code: Select all

<a href="#anchor">see below</a> 
The following addition to cmsimple/userfuncs.php is supposed to fix this issue:

Code: Select all

/*
 * Fix links to anchors on same page.
 */
if (!(XH_ADM && $edit)) {
    $i = $s > -1 ? $s : 0;
    $c[$i] = preg_replace(
        '/<a([^>]*)href="?#(.*)"?/',
        '<a$1href="' . $su . '#$2"',
        $c[$i]
    );
} 
Christoph M. Becker – Plugins for CMSimple_XH

wsim123
Posts: 63
Joined: Thu Feb 19, 2015 4:44 pm

Re: Clean URLs

Post by wsim123 » Tue May 05, 2015 9:34 pm

cmb wrote:I received a support request regarding failing page internal links when using clean URLs, e.g. something like the following will not work correctly:

Code: Select all

<a href="#anchor">see below</a>
The following addition to cmsimple/userfuncs.php is supposed to fix this issue:

Code: Select all

/*
 * Fix links to anchors on same page.
 */
if (!(XH_ADM && $edit)) {
    $i = $s > -1 ? $s : 0;
    $c[$i] = preg_replace(
        '/<a([^>]*)href="?#(.*)"?/',
        '<a$1href="' . $su . '#$2"',
        $c[$i]
    );
}
-------------------------------------------------------------------------------
Dies ist zwar keine Anschlussfrage aber auch zu Clean Urls.

Ich habe die Maxim-Version beiseite gelegt und die deutsche Version installiert (ohne .htaccess im root)

In der Sprachdatei habe ich Ä|Ö|Ü|ä|ö|ü|ß|&|&|--| durch Ae|Oe|Ue|ae|oe|ue|ss|||-| ersetzt
und habe jetzt nur noch das Fragezeichen nach der Basisurl. Gibt es eine einfache Methode dieses zu beseitigen ?

cmb
Posts: 13273
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: Clean URLs

Post by cmb » Tue May 05, 2015 9:44 pm

wsim123 wrote:und habe jetzt nur noch das Fragezeichen nach der Basisurl. Gibt es eine einfache Methode dieses zu beseitigen ?
Nein. Die "Beseitigung des Fragezeichens" ist genau das, was die Clean-URL-Lösung macht (oder versucht zu machen). Ich hoffe nach wie vor, dass zumindest der grundlegende (optionale) Support für clean URLs in XH 1.7 Einzug halten wird. Das spart Maxim die Arbeit immer wieder die entsprechenden Anpassungen vorzunehmen, und dürfte auch die entsprechende Unterstützung durch Plugins vorantreiben.
Christoph M. Becker – Plugins for CMSimple_XH

Maxim
Posts: 121
Joined: Thu Jun 13, 2013 6:52 am
Location: Запорожье
Contact:

Re: Clean URLs

Post by Maxim » Wed Jan 20, 2016 6:20 am

cmb wrote:
Maxim wrote:Настройки" > "CMS" > "Show homepage" - не меняется.
Indeed. We will hopefully address this issue in CMSimple_XH 1.6.2. For now you can use (space instead of underscore):

Code: Select all

$mtx['show homepage']="Startseite anzeigen";
Maxim wrote:Не везде нужно переводить и в "Настройки > CMS" и в "Настройки > Язык"
К примеру:
\cmsimple\languages\metaru.php

Code: Select all

$mtx['images']="Изображения";
$mtx['language']="Язык";
I'm not sure if I understand you correctly. If some translations are not necessary, they can be skipped completely (just remove the lines from metaXY.php). If more translations are needed, they can be inserted to the file. However, I'm still not sure, if the translation capabilities are fine grained enough; it might be necessary to translate certain words differently in different contexts.
Maxim wrote:Я только начал переводить, не много могу сказать.
http://foxpro.maxim.zp.ua/saytostroenie ... -urls.html
Thanks. I hope you'll find some time to finish the translation. :)
Simple Hosting
Бедная, бросаемая бурею, безутешная!

Nicky
Posts: 136
Joined: Sun Feb 08, 2009 9:50 am
Location: Antwerp

Re: Clean URLs

Post by Nicky » Fri Mar 11, 2016 10:13 am

Hi there, is this a manual how to create Clean URLs? I'm very interested as well, but unfortunately it seems to contain a lot of Russian characters, which I can't read.. :?

Does the file exist in English (or French, German) somewhere?

Thanks in advance.

Nicky
Posts: 136
Joined: Sun Feb 08, 2009 9:50 am
Location: Antwerp

Re: Clean URLs

Post by Nicky » Fri Mar 11, 2016 1:14 pm


Post Reply