Similar Pages

Displays N most relevant pages

This plugin displays N pages which are similar to the current page. Number of pages displayed, relevance strictness and title length are configurable.

Download version for Genoa (v1.0.1) or Siena (v1.0.2).

#1. Installation

  1. Unpack to your plugins folder
  2. Install the plugin in AdminCP
  3. Add {SIMILAR_PAGES} to your page.tpl
  4. Customize plugins/similar/tpl/similar.tpl
  5. Customize plugin configuration if necessary

#2. Authors and Copyright

Ported by Trustmaster from Seditio plugin by Raveex.

Updated and tested for Siena v0.9.22 by Dayver

 


1. 3axap  2010-09-02 16:55
Mega plugin!
2. Alex300  2010-09-28 13:50
It would be nice if the plugin would take similar pages, not only the page title, but also by tags. Similarly it is works on Joomla!
3. elfrenazo  2011-08-27 00:26

Muy buen plug ing, muchas gracias :)

4. Kingsley  2012-01-14 01:04

doesnt work with the latest Siena version..

5. Macik  2013-01-15 11:50

Fixed version for latest Siena you can download here: https://github.com/macik/cot-similarpages

 

6. lukgoh  2013-11-01 17:49

I added some code to mine so that if it doesn't find any by title then it looks by tags, probably a better way to do it but I will share just in case anyone is interested: 

Just after "$jj = 0;"

add:

if ($sql_sim->rowCount() == 0)
{
    $page_tags = $db->query("SELECT tag FROM $db_tag_references WHERE tag_item = ".$id." AND tag_area='pages' ");

    if ($page_tags->rowCount() > 0)
    {
        $tagArray = array();

        foreach ($page_tags->fetchAll() as $row_tags)
        {
            array_push ($tagArray, $row_tags['tag']);
        }

        foreach ($tagArray as $key=>$value)
        {
            $tagArray[$key] = $db->quote($value);
        }

        $input =  '(' . implode(',', $tagArray) . ')';
        $sql_tags = $db->query("SELECT tag_item from $db_tag_references WHERE tag IN $input AND tag_item != ".$id." AND tag_area='pages' ");

        if ($sql_tags->rowCount() > 0)
        {
            foreach ($sql_tags->fetchAll() as $row_tags)
            {
                $sql_sim = $db->query("SELECT * from $db_pages WHERE page_id= ".$row_tags['tag_item']." ");
            }
        }
    }
}

7. lukgoh  2013-11-01 18:11

Sorry I made a mistake:

 

if ($sql_sim->rowCount() == 0)
{
    $page_tags = $db->query("SELECT tag FROM $db_tag_references WHERE tag_item = ".$id." AND tag_area='pages' ");

    if ($page_tags->rowCount() > 0)
    {
        $tagArray = array();

        foreach ($page_tags->fetchAll() as $row_tags)
        {
            array_push ($tagArray, $row_tags['tag']);
        }

        foreach ($tagArray as $key=>$value)
        {
            $tagArray[$key] = $db->quote($value);
        }

        $input =  '(' . implode(',', $tagArray) . ')';
        $sql_tags = $db->query("SELECT tag_item from $db_tag_references WHERE tag IN $input AND tag_item != ".$id." AND tag_area='pages' ");

        if ($sql_tags->rowCount() > 0)
        {
            $pageArray = array();
            foreach ($sql_tags->fetchAll() as $row_tag)
            {
                array_push ($pageArray, $row_tag['tag_item']);
            }

            foreach ($pageArray as $key=>$value)
            {
                $pageArray[$key] = $db->quote($value);
            }

            $pagesinput =  '(' . implode(',', $pageArray) . ')';

            $sql_sim = $db->query("SELECT * from $db_pages WHERE page_id IN $pagesinput LIMIT $limit");
        }
    }
}

Only registered users can post new comments