vBSEO Compatible Hack:Photopost Classifieds

From VBSEO Wiki

Jump to: navigation, search

PhotoPost Classifieds is an addon for vBulletin that adds a user-to-user classified ads system.

Contents

Vendor Description

Add a full-featured user-to-user classified ads system to your website to connect buyers with sellers. No matter what your users interestes may be, they likely want to buy and sell items related to your site's topic, and PhotoPost Classifieds makes it easy.

PhotoPost Classifieds is designed to integrate seamlessly into your current site design, and can even use your existing forum user database (if you have one) for one central login.

Website URL

http://www.photopost.com/class/

Notes on vBSEO and Photopost Classifieds

How do I make vBSEO rewrite Photopost Classifieds URLs?

Assuming that your Photopost Classifieds software is located at the domain_root/classifieds/ directory and vBulletin is located in the domain root:

1. Create "vbseoembedd.php" file in Classifieds folder with this contents (and change $_vbseopath if needed):

<?php

$_vbseopath = '../forum/';


function vbseoembedd_handler($outbuffer)
{
    if(!defined('VBSEO_OUTHANDLER') && function_exists('make_crawlable'))
   	 return make_crawlable($outbuffer);
}

ob_start("vbseoembedd_handler");
include $_vbseopath . 'vbseo.php';


?>

1. Create an .htaccess file in the Photopost Classifieds folder that contains the following information:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ vbseoembedd.php?vbseourl=$1&vbseorelpath=../classifieds/&vbseoaddon=ppclass [L,QSA]
RewriteRule ^(.+.php)$ vbseoembedd.php?vbseourl=$1&vbseorelpath=../classifieds/&vbseoaddon=ppclass [L,QSA]
RewriteRule ^$ vbseoembedd.php?vbseourl=index.php&vbseorelpath=../classifieds/&bseoaddon=ppclass [L,QSA]

2. Create a file named functions_vbseo_ppclass.php with the content specified below and upload it to the vBulletin /includes/ folder:

<?php

    if(!defined('VBSEO_PPCLASS'))
    {

    define('VBSEO_PPCLASS', true);

    function vbseo_preprocess_ppclass()
    {
    }

    function vbseo_postprocess_ppclass(&$output)
    {
        global $CatPerms, $link;

        $vbseo_cats = array(500 => 'my');

        foreach($CatPerms['catname'] as $catugid=>$catname)
            $vbseo_cats[$catugid] = vbseo_filter_text($catname);

        $output = preg_replace('#(showcat\.php\?)(cat=(\d+))#e', '"$1ctitle=".$vbseo_cats[$3]."&$2"', $output);

        preg_match_all('#showproduct\.php\?product=(\d+)#' , $output, $prodmatch, PREG_PATTERN_ORDER);
        $prodids = array_unique($prodmatch[1]);
        if($prodids)
        {
        $query = "SELECT p.id,p.title FROM ".$GLOBALS['pp_db_prefix']."products p
        WHERE p.id IN (".implode(',',$prodids).")";

        $queryv = @ppmysql_query($query,$link);

        $vbseo_prods = array();
        while ( $row = @mysql_fetch_array($queryv) )
            $vbseo_prods[$row['id']] = vbseo_filter_text($row['title']);

        $output = preg_replace('#(showproduct\.php\?)(product=(\d+))#e', '"$1ptitle=".$vbseo_prods[$3]."&$2"', $output);
        }

    }


    }
?>

3. Define the following Custom Rewrite Rules (CRRs) via your vBSEO Control Panel:

'showcat\.php\?ctitle=(.+)&cat=(\d+)$' => 'cat-$1-$2.html'
'showproduct\.php\?ptitle=(.+)&product=(\d+)(&cat=\d+)?(&page=\d+)?$' => 'ad-$1-$2.html'
Personal tools