Clean URL

Andere Lösungen
Gert
Posts: 2065
Joined: Sun 18. Nov 2012, 14:18

Re: Clean URL

Post by Gert »

Hi Maxim,

sorry, but I don't really know, what is your problem?

If it just is target="_blank": The user should have the choice, to use the right mouse button or not, I will not use target="_blank"

Gert
Gert Ebersbach | CMSimple | Templates - Plugins - Services
Maxim
Posts: 95
Joined: Sat 19. Jan 2013, 13:28
Location: Запорожье
Contact:

$link

Post by Maxim »

Image
Не использовать ". $tx['menu']['print'] ."?
Использовать ". $link ."?

Image
Do not use ". $tx['menu']['print'] ."?
Use ". $link ."?
Simple Hosting
Бедная, бросаемая бурею, безутешная!
Gert
Posts: 2065
Joined: Sun 18. Nov 2012, 14:18

Re: Clean URL

Post by Gert »

Code: Select all

function printlink($img_src = '') 
{
...
    $title = $tx['menu']['print'];
    $link = '';
...
    if ($img_src != '') 
        {
            $link = tag('img title="' . $title . '" src="' . $pth['folder']['template'] . 'images/' . $img_src . '" alt="' . $title . '"');
        }
        else 
        { 
            $link .= $title; 
        }

    return '<a href="'.$sn.'?'.$t.'">' . $link . '</a>';
}
Now you can put icons like printlink.gif, mailformlink.gif, sitemaplink.gif and homelink.gif into the images folder of the template, and write in the template:

Code: Select all

<?php echo printlink('printlink.gif');?>
<?php echo mailformlink('mailformlink.gif');?>
...
This way you can have a graphical menu with icons,

Gert

PS: http://www.cmsimple.org/forum/viewtopic.php?f=8&t=270

Have a look at the last item of the feature list.

PS2: Next step will be a template tutorial (for experienced users), there will be documented such features.
Gert Ebersbach | CMSimple | Templates - Plugins - Services
Maxim
Posts: 95
Joined: Sat 19. Jan 2013, 13:28
Location: Запорожье
Contact:

Кокой шаблон я могу использовать для отладки?

Post by Maxim »

Image Кокой шаблон я могу использовать для отладки?
Создайте пожалуйста снимок экрана.

Image What template I can use to debug?
Please create a screen shot.
Simple Hosting
Бедная, бросаемая бурею, безутешная!
Gert
Posts: 2065
Joined: Sun 18. Nov 2012, 14:18

Re: Clean URL

Post by Gert »

Hello,

sorry, but these functions are new in CMSimple 4.2.3, there is no template, that uses this functions, you have to create your own,

Gert
Gert Ebersbach | CMSimple | Templates - Plugins - Services
Gert
Posts: 2065
Joined: Sun 18. Nov 2012, 14:18

Re: Clean URL

Post by Gert »

Hello,

here you have an example: http://www.kstb.de/cmsimpledev/

Take the __cmsimple_default__ template and change in the template.htm:

Old:

Code: Select all

<?php echo toc();?>
<ul class="subnav">
<li><?php echo printlink();?></li>
<li><?php echo sitemaplink();?></li>
<li><?php echo mailformlink();?></li>
</ul>
New:

Code: Select all

<?php echo toc();?>
<div style="padding: 48px 2px;">
<?php echo homelink('homelink.png') . '&nbsp;&nbsp;&nbsp;';?>
<?php echo printlink('printlink.png') . '&nbsp;&nbsp;&nbsp;';?>
<?php echo sitemaplink('sitemaplink.png') . '&nbsp;&nbsp;&nbsp;';?>
<?php echo mailformlink('mailformlink.png') . '&nbsp;&nbsp;&nbsp;';?>
</div>
The icons you can copy from the linked website, and put into the images folder of the template,

Gert
Gert Ebersbach | CMSimple | Templates - Plugins - Services
Maxim
Posts: 95
Joined: Sat 19. Jan 2013, 13:28
Location: Запорожье
Contact:

Правильно так

Post by Maxim »

Image Да, я так и думал
Правильно так:

Code: Select all

return '<a href="'.$sn.''.$t.'.html" target="_blank">' . $link . '</a>';
Спасибо!!!

Image Yes, I thought so
Rightly so:

Code: Select all

return '<a href="'.$sn.''.$t.'.html" target="_blank">' . $link . '</a>';
Thank you!!!
Simple Hosting
Бедная, бросаемая бурею, безутешная!
Maxim
Posts: 95
Joined: Sat 19. Jan 2013, 13:28
Location: Запорожье
Contact:

/Welcome_to_CMSimple&Login.html

Post by Maxim »

Image Здравствуйте

В CMSimple 4.2.3
По умолчанию
/?Welcome_to_CMSimple&login

Если в
cmsimple/functions.php
function loginlink()


Меняю:

Code: Select all

return a($s > -1 ? $s : 0, '&login') . $tx['menu']['login'] . '</a>';
на

Code: Select all

return '<a href="' . $sn . uenc($tx['menu']['login']) . '.html">' . $tx['menu']['login'] . '</a>';
http://maxim.zp.ua/users/files/download52.html - Config-CMSimple-423-CleanURLs-2013-08-12.zip
http://maxim.zp.ua/users/files/download53.html - Addon-CMSimple-423-CleanURLs-2013-08-12.zip
http://maxim.zp.ua/users/files/download54.html - 423-2013-08-12.txt

Получается
/Login.html

Если выбираю "View mode" появляется ошибка:
Forbidden
You don't have permission to access /.html on this server.
Подскажите, что можно сделать, чтобы вместо ошибки было предупреждение, предложение выбрать страницу
Или, чтобы у URL был вид:
/Welcome_to_CMSimple&Login.html

а не:
/?Welcome_to_CMSimple&login
/Login.html

Image Hello

CMSimple 4.2.3
Default
/?Welcome_to_CMSimple&login

If in
cmsimple/functions.php
function loginlink()


Change:

Code: Select all

return a($s > -1 ? $s : 0, '&login') . $tx['menu']['login'] . '</a>';
on

Code: Select all

return '<a href="' . $sn . uenc($tx['menu']['login']) . '.html">' . $tx['menu']['login'] . '</a>';
http://maxim.zp.ua/users/files/download52.html - Config-CMSimple-423-CleanURLs-2013-08-12 .zip
http://maxim.zp.ua/users/files/download53.html - Addon-CMSimple-423-CleanURLs-2013-08-12 .zip
http://maxim.zp.ua/users/files/download54.html - 423-2013-08-12 .txt

It turns out
/Login.html

If I choose "View mode" appears in the error:
Forbidden
You don't have permission to access /.html on this server.
Tell me what you can do to was a warning instead of an error, a proposal to select the page
Or, so that was kind of URL:
/Welcome_to_CMSimple&Login.html

instead of:
/?Welcome_to_CMSimple&login
/Login.html
Simple Hosting
Бедная, бросаемая бурею, безутешная!
Maxim
Posts: 95
Joined: Sat 19. Jan 2013, 13:28
Location: Запорожье
Contact:

$s > -1 ? $s : 0,

Post by Maxim »

Image Объясните пожалуйста эту часть

Code: Select all

$s > -1 ? $s : 0,
Image Please explain this part

Code: Select all

$s > -1 ? $s : 0,
Simple Hosting
Бедная, бросаемая бурею, безутешная!
Gert
Posts: 2065
Joined: Sun 18. Nov 2012, 14:18

Re: Clean URL

Post by Gert »

It's the same as:

Code: Select all

if($s > -1) // if a page is called (not only the blank URL)
{
    $s = $s; // stay on this page
}
else
{
     $s = 0; // call the first page
} 

// and then return:

return a($s, '&login') . $tx['menu']['login'] . '</a>';
Ask Google for "ternary expressions" or look here:

http://phpmaster.com/using-the-ternary-operator/

Gert
Gert Ebersbach | CMSimple | Templates - Plugins - Services
Post Reply