Seite 2 von 2

Verfasst: Do 10. Aug 2006, 09:20
von MyAccount
Und weil's so schön ist.... auch für GoogleSitemap

Code: Alles auswählen

/***********************************************
* CONTENIDO MODUL - INPUT
*
* Modulname   :     myGoogleSitemap
* Author(s)   :     http://contenido.org/forum/ myAccount
* Copyright   :     http://contenido.org/forum/
* Created     :     02.08.2006
* Based on    :     Google Sitemaps Ausgabe als XML
                    21-12-2005 by derSteffen & HerrB
                    09-06-2005 by micattack@gmx.net
                    05-06-2005 Luxmedia Österreich
************************************************/ 

/***********************************************
* Settings
************************************************/
$myBooDebug = false;
unset($myArrSet);
$myArrSet=array();
$myArrSet["lastmod"]          = "CMS_VALUE[0]";
$myArrSet["changefreq"]       = "CMS_VALUE[1]";
$myArrSet["priority"]         = "CMS_VALUE[2]";
$myArrSet["changefreqArray"]  = array("none","always","hourly","daily","weekly","monthly","yearly","never");
$myArrSet["priorityArray"]    = array("0.0","0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1.0","none");


/***********************************************
* Check Settings
************************************************/
$myArrSet["lastmod"]    = (isset($myArrSet["lastmod"])    && !empty($myArrSet["lastmod"]))    ? "CMS_VALUE[0]" : "0";
$myArrSet["changefreq"] = (isset($myArrSet["changefreq"]) && !empty($myArrSet["changefreq"])) ? "CMS_VALUE[1]" : "0";
$myArrSet["priority"]   = (isset($myArrSet["priority"])   && !empty($myArrSet["priority"]))   ? "CMS_VALUE[2]" : "6";


/***********************************************
* Text
************************************************/
$myArrTxt=array();
$myArrTxt["yes"]             = mi18n("Yes");
$myArrTxt["lastmod"]         = mi18n("Send Last Modifikation");
$myArrTxt["yes"]             = mi18n("Yes");
$myArrTxt["no"]              = mi18n("No");
$myArrTxt["changefreq"]      = mi18n("Send Frequency of Changes");
$myArrTxt["none"]            = mi18n("-- none --");
$myArrTxt["always"]          = mi18n("always");
$myArrTxt["hourly"]          = mi18n("hourly");
$myArrTxt["daily"]           = mi18n("daily");
$myArrTxt["weekly"]          = mi18n("weekly");
$myArrTxt["monthly"]         = mi18n("monthly");
$myArrTxt["yearly"]          = mi18n("yearly");
$myArrTxt["never"]           = mi18n("never");
$myArrTxt["priority"]        = mi18n("Send Priority");
$myArrTxt["0.0"]             = mi18n("0.0");
$myArrTxt["0.1"]             = mi18n("0.1");
$myArrTxt["0.2"]             = mi18n("0.2");
$myArrTxt["0.3"]             = mi18n("0.3");
$myArrTxt["0.4"]             = mi18n("0.4");
$myArrTxt["0.5"]             = mi18n("0.5");
$myArrTxt["0.6"]             = mi18n("0.6");
$myArrTxt["0.7"]             = mi18n("0.7");
$myArrTxt["0.8"]             = mi18n("0.8");
$myArrTxt["0.9"]             = mi18n("0.9");
$myArrTxt["1.0"]             = mi18n("1.0");


/***********************************************
* Template Configuration
************************************************/
echo "<table>\n";
echo "<tr>\n";

echo "<td>\n";
echo "<label>".$myArrTxt["lastmod"]."</label>\n";
echo "</td>\n";
echo "<td>\n";
if ($myBooDebug){echo $myArrSet["lastmod"];};
if($myArrSet["lastmod"] == "0"){
  echo "<input type=\"radio\" name=\"CMS_VAR[0]\" value=\"1\">".$myArrTxt["yes"]."\n";
  echo "<input type=\"radio\" name=\"CMS_VAR[0]\" checked=\"checked\" value=\"0\">".$myArrTxt["no"]."\n";
}else{
  echo "<input type=\"radio\" name=\"CMS_VAR[0]\" checked=\"checked\" value=\"1\">".$myArrTxt["yes"]."\n";
  echo "<input type=\"radio\" name=\"CMS_VAR[0]\" value=\"0\">".$myArrTxt["no"]."\n";
}
echo "</td>\n";

echo "</tr>\n";
echo "<tr>\n";

echo "<td>\n";
echo "<label>".$myArrTxt["changefreq"]."</label>\n";
echo "</td>\n";
echo "<td>\n";
if ($myBooDebug){echo $myArrSet["changefreq"];};
echo "<select name=\"CMS_VAR[1]\">\n";
foreach ($myArrSet["changefreqArray"] as $key => $value){
  if($myArrSet["changefreq"] == $key){
    echo "  <option value=\"".$key."\" selected=\"selected\">".$myArrTxt["$value"]."</option>\n";
  }else{
    echo "  <option value=\"".$key."\">".$myArrTxt["$value"]."</option>\n";
  }
}
echo "</select>";
echo "</td>\n";

echo "</tr>\n";
echo "<tr>\n";

echo "<td>\n";
echo "<label>".$myArrTxt["priority"]."</label>\n";
echo "</td>\n";
echo "<td>\n";
if ($myBooDebug){echo $myArrSet["priority"];};
echo "<select name=\"CMS_VAR[2]\">\n";
foreach ($myArrSet["priorityArray"] as $key => $value){
  if($myArrSet["priority"] == $key){
    echo "  <option value=\"".$key."\" selected=\"selected\">".$myArrTxt["$value"]."</option>\n";
  }else{
    echo "  <option value=\"".$key."\">".$myArrTxt["$value"]."</option>\n";
  }
}
echo "</select>";
echo "</td>\n";

echo "</tr>\n";
echo "</table>\n";

if ($myBooDebug){
  echo "<pre>";
  var_dump($myArrSet);
  echo "</pre>";
}

Code: Alles auswählen

<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname   :     myGoogleSitemap
* Author(s)   :     http://contenido.org/forum/ myAccount
* Copyright   :     http://contenido.org/forum/
* Created     :     02.08.2006
* Based on    :     Google Sitemaps Ausgabe als XML
                    21-12-2005 by derSteffen & HerrB
                    09-06-2005 by micattack@gmx.net
                    05-06-2005 Luxmedia Österreich
************************************************/ 

/***********************************************
* Includes
************************************************/
cInclude("classes", "class.modrewrite.php");


/***********************************************
* Settings
************************************************/
$myBooDebug = false;
unset($myArrSet);
$myArrSet=array();
$myArrSet["prolog"]           = '<?xml version="1.0" encoding="UTF-8"?>';
$myArrSet["urlset"]           = '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">';
$myArrSet["lastmod"]          = "CMS_VALUE[0]";
$myArrSet["changefreq"]       = "CMS_VALUE[1]";
$myArrSet["priority"]         = "CMS_VALUE[2]";
$myArrSet["changefreqArray"]  = array("none","always","hourly","daily","weekly","monthly","yearly","never");
$myArrSet["priorityArray"]    = array("0.0","0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1.0","none");


/***********************************************
* Check Settings
************************************************/
$myArrSet["lastmod"]    = (isset($myArrSet["lastmod"])    && !empty($myArrSet["lastmod"]))    ? "CMS_VALUE[0]" : "0";
$myArrSet["changefreq"] = (isset($myArrSet["changefreq"]) && !empty($myArrSet["changefreq"])) ? "CMS_VALUE[1]" : "0";
$myArrSet["priority"]   = (isset($myArrSet["priority"])   && !empty($myArrSet["priority"]))   ? "CMS_VALUE[2]" : "6";


/***********************************************
* Set Text
************************************************/
$myArrTxt=array();
$myArrTxt["yes"]             = mi18n("Yes");
$myArrTxt["lastmod"]         = mi18n("Send Last Modifikation");
$myArrTxt["yes"]             = mi18n("Yes");
$myArrTxt["no"]              = mi18n("No");
$myArrTxt["changefreq"]      = mi18n("Send Frequency of Changes");
$myArrTxt["none"]            = mi18n("-- none --");
$myArrTxt["always"]          = mi18n("always");
$myArrTxt["hourly"]          = mi18n("hourly");
$myArrTxt["daily"]           = mi18n("daily");
$myArrTxt["weekly"]          = mi18n("weekly");
$myArrTxt["monthly"]         = mi18n("monthly");
$myArrTxt["yearly"]          = mi18n("yearly");
$myArrTxt["never"]           = mi18n("never");
$myArrTxt["priority"]        = mi18n("Send Priority");
$myArrTxt["0.0"]             = mi18n("0.0");
$myArrTxt["0.1"]             = mi18n("0.1");
$myArrTxt["0.2"]             = mi18n("0.2");
$myArrTxt["0.3"]             = mi18n("0.3");
$myArrTxt["0.4"]             = mi18n("0.4");
$myArrTxt["0.5"]             = mi18n("0.5");
$myArrTxt["0.6"]             = mi18n("0.6");
$myArrTxt["0.7"]             = mi18n("0.7");
$myArrTxt["0.8"]             = mi18n("0.8");
$myArrTxt["0.9"]             = mi18n("0.9");
$myArrTxt["1.0"]             = mi18n("1.0");

/***********************************************
* Output
************************************************/
if (meGoogleSitemap()){
  meGoogleSitemap();
}


/***********************************************
* Function
************************************************/
function meGoogleSitemap(){
  global $lang, $client, $cfg, $myArrSet, $myArrTxt;
  
  if (!is_object($myObjDB)) {
    $myObjDB = new DB_Contenido;
  }
  
  $myStrSQL = "
          SELECT 
             E . idcat ,
             E . idart ,
             C . name ,
             UNIX_TIMESTAMP( D . lastmodified ) AS lastmodified 
          FROM
             ".$cfg["tab"]["cat_tree"]." AS A ,
             ".$cfg["tab"]["cat_lang"]." AS C ,
             ".$cfg["tab"]["cat"]." AS B ,
             ".$cfg["tab"]["cat_art"]." AS E 
            INNER JOIN  ".$cfg["tab"]["art_lang"]." AS D  ON ( E . idart  =  D . idart )
          WHERE
            A . idcat  =  B . idcat AND 
            B . idcat  =  C . idcat AND 
            C . idcat  =  E . idcat AND 
            B . idclient  = '".$client."' AND 
            C . idlang  = '".$lang."' AND 
            D . idlang  = '".$lang."' AND 
            C . visible  = '1' AND 
            E . idcatart IS NOT NULL AND 
            C . public  = '1' AND
            D . online = '1'
          ORDER BY
            A . idtree";
  
  $myObjDB->query($myStrSQL);
  
  
  
  header("Content-type: text/xml");
  echo $myArrSet["prolog"]."\n";
  echo $myArrSet["urlset"]."\n\n";
  
  while ($myObjDB->next_record()) {
  
    $myArrLink[$myObjDB->f("idart")] = ModRewrite::build_new_url("?idcat=".$myObjDB->f("idcat")."&idart=".$myObjDB->f("idart"));
    $myArrURL[$myObjDB->f("idart")] = "http://".$_SERVER['HTTP_HOST'].$myArrLink[$myObjDB->f("idart")];
  
    echo "  <url>\n";
    echo "    <loc>".$myArrURL[$myObjDB->f("idart")]."</loc>\n";
  
    if($myArrSet["lastmod"] != "0"){
      echo "    <lastmod>".substr_replace(date("Y-m-d\TH:i:sO",$myObjDB->f("lastmodified")), ':00', -2)."</lastmod>\n";
    }
  
    if($myArrSet["changefreq"] != "0"){
      echo "    <changefreq>".$myArrSet["changefreqArray"][$myArrSet["changefreq"]]."</changefreq>\n";
    }
  
    if($myArrSet["priority"] != "11"){
      echo "    <priority>".$myArrSet["priorityArray"][$myArrSet["priority"]]."</priority>\n";
    }
    echo "  </url>\n";
  }
  
  echo "</urlset>\n";
}
?>

Verfasst: Di 12. Sep 2006, 12:53
von lar_zzz
hi,

geht das auch anders, ohne das man eine neue kategorie machen muss und einen artikel? z.B. eine "echte" xml datei erstellen?

Verfasst: Di 12. Sep 2006, 22:44
von MyAccount
Hi,

hast Du was geraucht?! Kleiner Scherz. Mach es einfach so einmal, ruf die Datei auf, lass Dir den Quelltext anzeigen, speicher das Ganze dann als MeineStatischeSitemap.xml in ein beliebiges Verzeichnis auf Deinem Server und schon hast Du eine statische Sitemap-Datei. Oder?! :-)

MyAccount

Verfasst: Sa 4. Nov 2006, 17:52
von makemyday
Hallo zusammen,

hab nochmal ein zusätzliches Feld für idcat´s eingefügt, die nicht in der Sitemap erscheinen sollen (z.B. der Sitemap Artikel selber). Und Tante Google muss ja nicht alles wissen.

Wer die Änderung idiotensicher machen will, soll mittels regex noch überprüfen, ob nur Zahlen und Kommas im CMS_VALUE[3] vorkommen, da es ansonsten zu einem SQL-Error kommt.

Hier zum Moduldownload

no modrewrite

Verfasst: Mi 17. Jan 2007, 22:42
von alwin4711
Hallo,
ich trau mich fast gar nicht zu fragen...

Ich habe bisher modrewrite noch nicht eingesetzt.
Kann man das Modul auch ohne modrewrite benutzen ?

Vielleicht kann man den Aufruf von modrewrite deaktivieren ?

mfg
Alain

Re: no modrewrite

Verfasst: Do 18. Jan 2007, 09:42
von makemyday
alwin4711 hat geschrieben:Vielleicht kann man den Aufruf von modrewrite deaktivieren ?
Kann mann in der contenido/include/config.php

Re: no modrewrite

Verfasst: Do 18. Jan 2007, 12:07
von alwin4711
makemyday hat geschrieben:
alwin4711 hat geschrieben:Vielleicht kann man den Aufruf von modrewrite deaktivieren ?
Kann mann in der contenido/include/config.php
:) ja, ist klar.

Da war wohl meine Frage zu unklar, ich meinte natürlich im GoogleSitemap-Modul.
$myArrLink[$myObjDB->f("idart")] = ModRewrite::build_new_url("?idcat=".$myObjDB->f("idcat")."&idart=".$myObjDB->f("idart"));
$myArrURL[$myObjDB->f("idart")] = "http://".$_SERVER['HTTP_HOST'].$myArrLink[$myObjDB->f("idart")];
mfg
Alain

Verfasst: Di 3. Jul 2007, 07:57
von baumpaul
Bei der Sitemap taucht ein großes Problem auf, dass mir in Verbindung mit ModRewrite aufgefallen ist:

Es wird immer kategorie1-kategorie2.Artikel.html ausgegeben.

Startartikel einer Kategorie dürfen aber nur mit kategorie1-kategorie2.html ausgegeben werden.

Da musst den Code wohl noch etwas anpassen. Sonst schadet die Sitemap deiner Suchmaschinenpositionierung eher, als dass sie etwas bringt.

Verfasst: Di 3. Jul 2007, 09:31
von baumpaul
Sagt mal, stehe ich gerade auf dem Schlauch oder aber ob ein Artikel Startartikel einer Kagegorie oder nicht ist finde ich doch in der Tabelle cat_art in der Spalte is_start oder?

Nur ist bei mir in der DB immer nur eine 0 eingetragen. Also muss ja wohl falsch liegen?

Verfasst: Mi 4. Jul 2007, 10:21
von HerrB
Es kommt drauf an, ob start_compatible true oder false ist (siehe contenido/includes/config.php).

Bei true ja, bei false findet sie sich in con_cat_lang als startidartlang.

Gruß
HerrB