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  2. September 2010, 16:55
Mega plugin!
2. Alex300  28. September 2010, 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  27. August 2011, 00:26

Muy buen plug ing, muchas gracias :)

4. Kingsley  14. Januar 2012, 01:04

doesnt work with the latest Siena version..

5. Macik  15. Januar 2013, 11:50

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

 

6. lukgoh  1. November 2013, 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  1. November 2013, 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");
        }
    }
}

Nur registrierte Benutzer können Kommentare schreiben