Help with phpld detail page SEO

Discussion in 'Scripts' started by ian_batten, Jul 29, 2007.

  1. #1
    Hey peeps,
    Okay, I am having some issssssues with this. The seo mod hack here: http://blog.rakcha.com/2007/05/03/phpld-seo-friendly-details-pages/ is annoying me. I am okay with the first steo, but not the second. I cannot find:

    preg_match ('#(.*)link(_|-)(\d+)\.htm[l]?$#i', request_uri(), $matches);

    in detail.php

    This is what my detail page looks like:

    <?php
    
    require_once 'init.php';
    
    if (ENABLE_REWRITE == 1)
    {
       $dir = explode ("/", $_SERVER['REQUEST_URI']);
       $dir[sizeof ($dir)-1] = ereg_replace (".html$", "", $dir[sizeof ($dir)-1]);
       $dir[sizeof ($dir)-1] = ereg_replace ("^link-", "", $dir[sizeof ($dir)-1]);
       $id = $dir[sizeof ($dir)-1];
    }
    else
       $id = (!empty ($_REQUEST['id']) ? $_REQUEST['id'] : 0);
    
    if (!empty ($id))
    {
       if (!preg_match ("/^\d+$/", $id))
          $tpl->assign('error', "Invalid Link ID");
       else
       {
          $rdata = $db->GetRow("SELECT *, DATE_FORMAT(DATE_ADDED, '%M %d, %Y %r') AS `DAT` FROM `{$tables['link']['name']}` WHERE `ID` = ".$db->qstr($id));
          $data = array ();
          if (!$rdata)
             $tpl->assign('error', "Invalid ID [{$id}] passed - not found in database");
          else
          {
             $data['ID']           = $id;
             $data['TITLE']        = $rdata['TITLE'];
             $data['DESCRIPTION']  = $rdata['DESCRIPTION'];
             $data['URL']          = $rdata['URL'];
             $data['CATEGORY_ID']  = $rdata['CATEGORY_ID'];
             $data['OWNER_NAME']   = $rdata['OWNER_NAME'];
             $data['DATE_ADDED']   = $rdata['DAT'];
             $data['HITS']         = $rdata['HITS'];
             $data['PAGERANK']     = $rdata['PAGERANK'];
             $data['RATE_COUNT']   = $rdata['RATE_COUNT'];
             $data['RATE']         = $rdata['RATE'];
             $data['RATE_ENABLED'] = $rdata['RATE_ENABLED'];
             $cdata                = $db->GetRow("SELECT `TITLE` AS `CATEGORY_TITLE`, `CACHE_TITLE`, `CACHE_URL` FROM `{$tables['category']['name']}` WHERE `ID` = '{$rdata['CATEGORY_ID']}' LIMIT 1");
    
             $data['CATEGORY_TITLE']  = $cdata['CATEGORY_TITLE'];
             $data['CACHE_TITLE']     = $cdata['CACHE_TITLE'];
    
             $site_url = (substr (SITE_URL, -1) != '/' ? SITE_URL.'/' : SITE_URL);
             $data['CATEGORY_URL']    = $site_url;
             $data['CATEGORY_URL']   .= (ENABLE_REWRITE == 1 ? trim ($cdata['CACHE_URL']) : 'index.php?c='.$data['CATEGORY_ID']);
    
             $data['META_KEYWORDS']    = $rdata['META_KEYWORDS'];
             $data['META_DESCRIPTION'] = $rdata['META_DESCRIPTION'];
    
             unset ($cdata, $site_url);
             $odata = $db->GetAll("SELECT * FROM `{$tables['link']['name']}` WHERE `OWNER_EMAIL` LIKE ".$db->qstr($rdata['OWNER_EMAIL'])." LIMIT 0 , 30");
    
             usort ($odata, "cmp");
             $data['RELATED'] = "";
             foreach ($odata as $value)
                if ($value['ID'] !== $id)
                {
                   if (preg_match ("/\/$/", SITE_URL))
                      $link = SITE_URL."details.php?id=".$value['ID'];
                   else
                      $link = SITE_URL."/details.php?id=" . $value['ID'];
    
                   $data['RELATED'] .= "<li><a class=\"special\" href=\"{$link}\">{$value['TITLE']}</a></li>\n";
                }
    
             if($data['RELATED'])
                $data['RELATED'] = "<ul>\n{$data['RELATED']}</ul>\n";
    
             unset ($odata);
          }
       }
       unset ($rdata);
    }
    else
       $tpl->assign('error', "No ID parameter");
    
    $path   = array ();
    $path[] = array ('ID' => '0', 'TITLE' => _L(SITE_NAME)        , 'TITLE_URL' => DOC_ROOT, 'DESCRIPTION' => SITE_DESC);
    $path[] = array ('ID' => '0', 'TITLE' => _L('Listing Details'), 'TITLE_URL' => ''      , 'DESCRIPTION' => _L('Listing Details'));
    $tpl->assign('path', $path);
    $tpl->assign($data);
    
    $tpl->assign('MetaKeywords'   , (!empty ($data['META_KEYWORDS'])    ? trim ($data['META_KEYWORDS'])    : trim ($MetaKeywords)));
    $tpl->assign('MetaDescription', (!empty ($data['META_DESCRIPTION']) ? trim ($data['META_DESCRIPTION']) : trim ($MetaDescription)));
    
    //Clean whitespace
    $tpl->load_filter('output', 'trimwhitespace');
    
    //Compress output for faster loading
    if (COMPRESS_OUTPUT == 1)
       $tpl->load_filter('output', 'CompressOutput');
    
    //Make output
    echo $tpl->fetch('detail.tpl', $id);
    
    unset ($data);
    
    function cmp($a, $b) {
       return strcmp ($a["TITLE"], $b["TITLE"]);
    }
    ?>
    
    Code (markup):
    Any ideas how to overcome setp 2?

    Thanks in advance!
     
    ian_batten, Jul 29, 2007 IP
  2. ian_batten

    ian_batten Well-Known Member

    Messages:
    1,991
    Likes Received:
    106
    Best Answers:
    0
    Trophy Points:
    185
    #2
    Cummon guys!!!! You never usually leave me lagging a few hours :D
     
    ian_batten, Jul 29, 2007 IP
  3. ahmershuja

    ahmershuja Peon

    Messages:
    532
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    those coding for v3.x, I've the same problem, if you;re developer you can change the coding and test it again and again, thats the one I'm doing...

    I'm using phpLD v-2.1.3
     
    ahmershuja, Dec 27, 2007 IP