Script Anpassung
Verfasst: 06.11.2005, 18:13
Ich habe ein kleines Problem in einem Webkatalog von mir.
1. die htacess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [QSA,L]
die URL schauen so aus:
https://www.xxx/Computer_Internet/Webkataloge.html
bis dahin ist noch alles OK. Wenn man aber auf die 2. usw. Seite geht, dann schaut es so aus:
https://www.xxx/Computer_Internet/Webkataloge.html?p=2
Der Bereich in dem Script für die Links zu den folgenden Seiten schaut so aus:
{* Pager (not used yet) *}
{if $list_total gt 0}<br><h3></h3>
<div style="float: left" valign="bottom">
{if $smarty.const.ENABLE_REWRITE}
{assign var='url_pattern' value='?p=$'}
{/if}
{pager rowcount=$list_total limit=$smarty.const.PAGER_LPP class_num="" class_numon="a" class_text="" posvar="p" show="page" txt_next="Next" txt_prev="Previous" shift="1" separator=" " wrap_numon="[|]" url_pattern="$url_pattern"}
</div>
{/if}
Das ist ein Auszug aus der functions.php:
//IIS with ISAPI_REWRITE
if ($_SERVER['HTTP_X_REWRITE_URL'])
return $_SERVER['HTTP_X_REWRITE_URL'];
$p = $_SERVER['SCRIPT_NAME'];
if ($_SERVER['QUERY_STRING'])
$p .= '?'.$_SERVER['QUERY_STRING'];
return $p;
}
function get_category($uri = NULL) {
global $db, $tables;
if ($uri != NULL) {
$uri = parse_url($uri);
$query = $uri['query'];
$path = $uri['path'];
parse_str($query, $vars);
if (isset ($vars['c']))
$cid = $vars['c'];
} else {
if (isset ($_REQUEST['c']))
$cid = $_REQUEST['c'];
$path = request_uri();
}
$id = 0;
if (ENABLE_REWRITE && !isset ($cid)) {
$path = substr($path, strlen(DOC_ROOT) + 1);
$qp = strpos($path, '?');
if ($qp !== false) {
$path = substr($path, 0, $qp);
}
$path = split('/', $path);
$id = 0;
foreach ($path as $cat) {
// ZYV modified: added line to strip ".html" postfix
$cat = str_replace(".html", "", $cat);
if (!empty ($cat))
$id = $db->GetOne("SELECT ID FROM {$tables['category']['name']} WHERE STATUS=2 AND TITLE_URL = ".$db->qstr($cat)." AND PARENT_ID=".$db->qstr($id));
}
}
elseif (preg_match('`\d+`', $cid)) {
$id = $db->GetOne("SELECT ID FROM {$tables['category']['name']} WHERE STATUS=2 AND ID = $cid");
}
return $id ? $id : '0';
}
function get_path($id) {
global $db, $tables;
$path = array ();
$i = 0;
while ($id != 0 && $i < 100) {
$row = $db->GetRow("SELECT * FROM {$tables['category']['name']} WHERE ID = $id");
$id = $row['PARENT_ID'];
$path[] = $row;
$i ++;
}
$path[] = array ('ID' => '0', 'TITLE' => _L(SITE_NAME), 'TITLE_URL' => DOC_ROOT, 'DESCRIPTION' => SITE_DESC);
return array_reverse($path);
}
Ich möchte gern, das die URLs zu den folgenden Seiten so auschauen:
https://www.xxx/Computer_Internet/Webkataloge-2.html usw. auschauen.
Das .html wird nur duch Codeschnipsel angehangen.
// ZYV modified: added line to strip ".html" postfix
$cat = str_replace(".html", "", $cat);
Das ist ein Mod zum originalen Rewrite, welches genau so auschaut wie jetzt ohne html.
Beim originalen schauen die URLs dann so aus:
https://www.xxx/Computer_Internet/Webkataloge/p=2
Kann es sein, das diese Variable ( p=2) in der Smarty erstellt wird? Davon habe ich leider null Ahnung.
Sollte ich mit Hilfe eines Users hier das hinbekommen, kann derjenige einen Eintrag in eine unserer 16 Hauptkategorien bekommen, wenn er die Vorraussetzungen erfüllt, die dafür notwendig sind: https://www.deutscher-index.info/hauptkategorie.html auser, das er keinen Backlink setzen muss.
MFG Ronny
1. die htacess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [QSA,L]
die URL schauen so aus:
https://www.xxx/Computer_Internet/Webkataloge.html
bis dahin ist noch alles OK. Wenn man aber auf die 2. usw. Seite geht, dann schaut es so aus:
https://www.xxx/Computer_Internet/Webkataloge.html?p=2
Der Bereich in dem Script für die Links zu den folgenden Seiten schaut so aus:
{* Pager (not used yet) *}
{if $list_total gt 0}<br><h3></h3>
<div style="float: left" valign="bottom">
{if $smarty.const.ENABLE_REWRITE}
{assign var='url_pattern' value='?p=$'}
{/if}
{pager rowcount=$list_total limit=$smarty.const.PAGER_LPP class_num="" class_numon="a" class_text="" posvar="p" show="page" txt_next="Next" txt_prev="Previous" shift="1" separator=" " wrap_numon="[|]" url_pattern="$url_pattern"}
</div>
{/if}
Das ist ein Auszug aus der functions.php:
//IIS with ISAPI_REWRITE
if ($_SERVER['HTTP_X_REWRITE_URL'])
return $_SERVER['HTTP_X_REWRITE_URL'];
$p = $_SERVER['SCRIPT_NAME'];
if ($_SERVER['QUERY_STRING'])
$p .= '?'.$_SERVER['QUERY_STRING'];
return $p;
}
function get_category($uri = NULL) {
global $db, $tables;
if ($uri != NULL) {
$uri = parse_url($uri);
$query = $uri['query'];
$path = $uri['path'];
parse_str($query, $vars);
if (isset ($vars['c']))
$cid = $vars['c'];
} else {
if (isset ($_REQUEST['c']))
$cid = $_REQUEST['c'];
$path = request_uri();
}
$id = 0;
if (ENABLE_REWRITE && !isset ($cid)) {
$path = substr($path, strlen(DOC_ROOT) + 1);
$qp = strpos($path, '?');
if ($qp !== false) {
$path = substr($path, 0, $qp);
}
$path = split('/', $path);
$id = 0;
foreach ($path as $cat) {
// ZYV modified: added line to strip ".html" postfix
$cat = str_replace(".html", "", $cat);
if (!empty ($cat))
$id = $db->GetOne("SELECT ID FROM {$tables['category']['name']} WHERE STATUS=2 AND TITLE_URL = ".$db->qstr($cat)." AND PARENT_ID=".$db->qstr($id));
}
}
elseif (preg_match('`\d+`', $cid)) {
$id = $db->GetOne("SELECT ID FROM {$tables['category']['name']} WHERE STATUS=2 AND ID = $cid");
}
return $id ? $id : '0';
}
function get_path($id) {
global $db, $tables;
$path = array ();
$i = 0;
while ($id != 0 && $i < 100) {
$row = $db->GetRow("SELECT * FROM {$tables['category']['name']} WHERE ID = $id");
$id = $row['PARENT_ID'];
$path[] = $row;
$i ++;
}
$path[] = array ('ID' => '0', 'TITLE' => _L(SITE_NAME), 'TITLE_URL' => DOC_ROOT, 'DESCRIPTION' => SITE_DESC);
return array_reverse($path);
}
Ich möchte gern, das die URLs zu den folgenden Seiten so auschauen:
https://www.xxx/Computer_Internet/Webkataloge-2.html usw. auschauen.
Das .html wird nur duch Codeschnipsel angehangen.
// ZYV modified: added line to strip ".html" postfix
$cat = str_replace(".html", "", $cat);
Das ist ein Mod zum originalen Rewrite, welches genau so auschaut wie jetzt ohne html.
Beim originalen schauen die URLs dann so aus:
https://www.xxx/Computer_Internet/Webkataloge/p=2
Kann es sein, das diese Variable ( p=2) in der Smarty erstellt wird? Davon habe ich leider null Ahnung.
Sollte ich mit Hilfe eines Users hier das hinbekommen, kann derjenige einen Eintrag in eine unserer 16 Hauptkategorien bekommen, wenn er die Vorraussetzungen erfüllt, die dafür notwendig sind: https://www.deutscher-index.info/hauptkategorie.html auser, das er keinen Backlink setzen muss.
MFG Ronny