Forums / Cotonti / Support / SeeAlso Plugin

Porting to Cotonti needed

aiwass
#1 2009-04-10 00:19
Hi !

I run a very large website that is currently running on a highly modified version of the LDU 800 and there is a plugin that i use very much called Seealso from Kpoxa.

The thing is that i'm in dire need of getting this plugin to work under Cotonti since i'm in the process of updating and porting all my data to it. I have over 10.000 pages, links, events and other stuff.

I would be more the happy if someone would like to help me. Seealso uses page_extra5 field in the database (at least as i've configured it)

All tips/solutions etc. are helpful

The seealso.page.php file :
<?php
/* ====================
Land Down Under - Website engine
Copyright Neocrome
http://ldu.neocrome.net

[BEGIN_LDU]
File=plugins/extended/seealso/seealso.page.php
Version=800
Updated=2005-may-15
Type=Plugin
Author=Sin (vrihedd@yandex.ru)
Description=Adds "See also:" and list of related pages by keywords
[END_LDU]

[BEGIN_LDU_EXTPLUGIN]
Code=seealso
Part=page
File=seealso.page
Hooks=page.tags
Tags=
Minlevel=0
Order=10
[END_LDU_EXTPLUGIN]

==================== */

if ( !defined('LDU_CODE') ) { die("Wrong URL."); }

$sql = ldu_query("SELECT page_id, page_state, page_cat, page_title, page_desc, page_author FROM $db_pages WHERE page_state=0 AND page_id != ".$pag['page_id']." AND \"(".eregi_replace(",", "|", $pag['page_extra4']).")\" REGEXP Replace(page_extra4, \",\", \"|\") ORDER BY page_date desc", "SeeAlso/get related");


if (ldu_num_rows($sql)>0)
        {
        while ($row = ldu_fetch_array($sql))
                {
		$sa_author = ldu_cc($row['page_author']);
		$sa_pageid = $row['page_id'];
		$sa_pagecat = ldu_cc($row['page_cat']);
		$sa_pagedesc = ldu_cc($row['page_desc']);
		$sa_pagetitle = ldu_cc($row['page_title']);
                $sa_pagelink = "<a href=\"page.php?id=".$sa_pageid."\" title='".$sa_pagedesc."'>".$sa_pagecat.$cfg['separator'].$sa_pagetitle."</a>";
		$catpath = ldu_build_catpath($sa_pagecat, "<a href=\"list.php?c=%1\$s\" title=\"%2\$s\">%2\$s</a>");
		$catpath = $catpath." ".$cfg['separator']." <a href=\"page.php?id=".$sa_pageid."\" title=\"".$sa_pagetitle."\">".$sa_pagetitle."</a>";
                $t-> assign(array(
                        "SEEALSO_AUTHOR" => $sa_author,
                        "SEEALSO_PAGE_ID" => $sa_pageid,
                        "SEEALSO_PAGECAT" => $sa_pagecat,
                        "SEEALSO_PAGETITLE" => $sa_pagetitle,
                        "SEEALSO_PAGELINK" => $catpath
                        ));
                $t->parse("MAIN.SEEALSO.SEEALSO_ROW");
                }
        }
        else
        {
        $t->parse("MAIN.COMMENTS.SEEALSO_EMPTY");
        }


$t->parse("MAIN.SEEALSO");
?>

The seeaslo.setup.php file :
<?php
/* ====================
Land Down Under - Website engine
Copyright Neocrome
http://ldu.neocrome.net

[BEGIN_LDU]
File=plugins/extended/seealso/seealso.setup.php
Version=800
Updated=2005-may-15
Type=Plugin
Author=Kpoxa (vrihedd@yandex.ru)
Description=Adds "See also:" and list of related pages by keywords
[END_LDU]

[BEGIN_LDU_EXTPLUGIN]
Code=seealso
Name=See also (Related pages)
Description=Adds "See also:" and list of related pages by keywords
Version=0.1
Date=2005/05/15
Author=Kpoxa (vrihedd@yandex.ru)
Copyright=
Notes=
Config=
SQL=
[END_LDU_EXTPLUGIN]

[BEGIN_LDU_EXTPLUGIN_CONFIG]
[END_LDU_EXTPLUGIN_CONFIG]

==================== */

if ( !defined('LDU_CODE') ) { die("Wrong URL."); }

?>

/Aiwass has a deadline next week
Take all that money that we spend on weapons and defences each year and instead spend it feeding and clothing and educating the poor of the world, which it would many times over, not one human being excluded, and we could explore space, together, both inner and outer, forever, in peace. - Bill Hicks

https://evlear.com
TwistedGA
#2 2009-04-10 00:39
The seealso.page.php file :
<?php
/* ====================
[BEGIN_SED]
File=plugins/extended/seealso/seealso.page.php
Type=Plugin
[END_SED]

[BEGIN_SED_EXTPLUGIN]
Code=seealso
Part=page
File=seealso.page
Hooks=page.tags
Tags=
Minlevel=0
Order=10
[END_SED_EXTPLUGIN]
==================== */

if( !defined('SED_CODE') ) { die("Wrong URL."); }

$sql = sed_sql_query("SELECT page_id, page_state, page_cat, page_title, page_desc, page_author FROM $db_pages WHERE page_state=0 AND page_id != ".$pag['page_id']." AND \"(".eregi_replace(",", "|", $pag['page_extra4']).")\" REGEXP Replace(page_extra4, \",\", \"|\") ORDER BY page_date desc", "SeeAlso/get related");


if (sed_num_rows($sql)>0)
        {
        while ($row = sed_sql_fetcharray($sql))
                {
		$sa_author = sed_cc($row['page_author']);
		$sa_pageid = $row['page_id'];
		$sa_pagecat = sed_cc($row['page_cat']);
		$sa_pagedesc = sed_cc($row['page_desc']);
		$sa_pagetitle = sed_cc($row['page_title']);
                $sa_pagelink = "<a href=\"page.php?id=".$sa_pageid."\" title='".$sa_pagedesc."'>".$sa_pagecat.$cfg['separator'].$sa_pagetitle."</a>";
		$catpath = sed_build_catpath($sa_pagecat, "<a href=\"list.php?c=%1\$s\" title=\"%2\$s\">%2\$s</a>");
		$catpath = $catpath." ".$cfg['separator']." <a href=\"page.php?id=".$sa_pageid."\" title=\"".$sa_pagetitle."\">".$sa_pagetitle."</a>";
                $t-> assign(array(
                        "SEEALSO_AUTHOR" => $sa_author,
                        "SEEALSO_PAGE_ID" => $sa_pageid,
                        "SEEALSO_PAGECAT" => $sa_pagecat,
                        "SEEALSO_PAGETITLE" => $sa_pagetitle,
                        "SEEALSO_PAGELINK" => $catpath
                        ));
                $t->parse("MAIN.SEEALSO.SEEALSO_ROW");
                }
        }
        else
        {
        $t->parse("MAIN.COMMENTS.SEEALSO_EMPTY");
        }

$t->parse("MAIN.SEEALSO");
?>

The seeaslo.setup.php file :
<?php
/* ====================
[BEGIN_SED]
File=plugins/extended/seealso/seealso.setup.php
Type=Plugin
[END_SED]

[BEGIN_SED_EXTPLUGIN]
Code=seealso
Name=See also (Related pages)
Description=Adds "See also:" and list of related pages by keywords
Version=0.1
Date=2005/05/15
Author=Kpoxa (vrihedd@yandex.ru)
Copyright=
Notes=
Config=
SQL=
[END_SED_EXTPLUGIN]

[BEGIN_SED_EXTPLUGIN_CONFIG]
[END_SED_EXTPLUGIN_CONFIG]
==================== */

if( !defined('SED_CODE') ) { die("Wrong URL."); }

?>

Make a backup of the originals and try this. I only see one other thing that might cause a problem as it is, if you still have issues, try removing :::, "SeeAlso/get related":::: form the $sql = line. If that doesnt solve it let me know and I'll actually take it into my test site and figure out what the problem is.
[color=#CC0000]Lazymod[/color] [color=#000000]Studios[/color]
Lombi
#3 2009-04-10 00:53
This plugin is incredibly mysql resource intensive! It needs to be cached per-page into MySQL, the regex it does a really complex operation (brings down a good dedicated server at about 300.000 pages).
<a href="http://www.domenlo.com">Surreal Art</a>
aiwass
#4 2009-04-10 01:06
I know Lombi, but i have almost all my pages wired to it and it's very useful. Do you have another solution linking together pages like this : http://www.megamind.se/page.php?id=126 (keyword : Ferry Corsten)

TwistedGA : Does not work, but thank you.

I'm open to all kinds of solutions which utilizes those keywords that are placed in page_extra4 for this plugin and presents them in a similar fashion like on the link above.

It's my site by the way !

/Aiwass
Take all that money that we spend on weapons and defences each year and instead spend it feeding and clothing and educating the poor of the world, which it would many times over, not one human being excluded, and we could explore space, together, both inner and outer, forever, in peace. - Bill Hicks

https://evlear.com
Lombi
#5 2009-04-10 01:22
We did fix this, the problem is the seealso word in the sql line (cotonti uses seealso for an operation hence it becomes a misunderstanding).

I think removing that fixed it.

I'm using it on all my sites too, just not on sites that have over 50.000 pages since it kills my mysql daemon.

A solution would be to cache it in mysql, like maybe serialized in page_extrasomething so we wouldnt even need to do any db manipulation.
<a href="http://www.domenlo.com">Surreal Art</a>
aiwass
#6 2009-04-10 01:26
# Lombi : We did fix this, the problem is the seealso word in the sql line (cotonti uses seealso for an operation hence it becomes a misunderstanding).

I think removing that fixed it.

Unfortunatly it does not work on my site, just gets a blank page instead. Or did you mean something else ?
Take all that money that we spend on weapons and defences each year and instead spend it feeding and clothing and educating the poor of the world, which it would many times over, not one human being excluded, and we could explore space, together, both inner and outer, forever, in peace. - Bill Hicks

https://evlear.com
TwistedGA
#7 2009-04-10 01:29
# Lombi : We did fix this, the problem is the seealso word in the sql line (cotonti uses seealso for an operation hence it becomes a misunderstanding).

I think removing that fixed it.

So removing what I said should make it work yea? I had issues with the BOX plugin because it had had something like that at the end of the sql lines, removing it solved the problem.
[color=#CC0000]Lazymod[/color] [color=#000000]Studios[/color]
Lombi
#8 2009-04-10 01:31
Yeah, that's cause you're basing it off the LDU version, as opposed to the Seditio version, which is available on neocrome.net -

Please download that (I dont have the link)

then use this on the seealso.page.php

<?php
/* ====================
Seditio - Website engine
Copyright Neocrome
http://ldu.neocrome.net

[BEGIN_SED]
File=plugins/seealso/seealso.page.php
Version=800
Updated=2005-may-15
Type=Plugin
Author=Sin (vrihedd@yandex.ru)
Description=Adds "See also:" and list of related pages by keywords
[END_SED]

[BEGIN_SED_EXTPLUGIN]
Code=seealso
Part=page
File=seealso.page
Hooks=page.tags
Tags=
Order=10
[END_SED_EXTPLUGIN]

==================== */

if ( !defined('SED_CODE') ) { die("Wrong URL."); }

$sql = sed_sql_query("SELECT page_id, page_state, page_alias, page_cat, page_title, page_desc, page_author FROM $db_pages WHERE page_state=0 AND page_id != ".$pag['page_id']." AND \"(".eregi_replace(",", "|", $pag['page_extra5']).")\" REGEXP Replace(page_extra5, \",\", \"|\") ORDER BY page_date desc LIMIT 0,15");


if (sed_sql_numrows($sql)>0)
        {
        while ($row = sed_sql_fetcharray($sql))
                {
		$sa_author = sed_cc($row['page_author']);
		$sa_pageid = $row['page_id'];
		$sa_pagecat = sed_cc($row['page_cat']);
		$sa_pagedesc = sed_cc($row['page_desc']);
		$sa_pagetitle = sed_cc($row['page_title']);
		$link = sed_page_url($row['page_alias'], $row['page_cat'], $row['page_id']);
		$catpath = sed_category_breadcrumb($sa_pagecat);
		
		$catpath = $catpath." ".$cfg['separator']." <a href=\"".$link."\">".$sa_pagetitle."</a>";
                $t-> assign(array(
                        "SEEALSO_AUTHOR" => $sa_author,
                        "SEEALSO_PAGE_ID" => $sa_pageid,
                        "SEEALSO_PAGECAT" => $sa_pagecat,
                        "SEEALSO_PAGETITLE" => $sa_pagetitle,
                        "SEEALSO_PAGELINK" => $catpath
                        ));
                $t->parse("MAIN.SEEALSO.SEEALSO_ROW");
                }
        }
        else
        {
        $t->parse("MAIN.COMMENTS.SEEALSO_EMPTY");
        }


$t->parse("MAIN.SEEALSO");
?>

You might also notice that I have the URL part using my url rewrite system so you should probably work on those two lines to bring it like you have in your first paste.
<a href="http://www.domenlo.com">Surreal Art</a>

Dit bericht is bewerkt door Lombi (2009-04-10 01:33, 14 jaren ago)
aiwass
#9 2009-04-10 01:46
YES ! IT works !

Thanks, Lombi & TwistedGA
Take all that money that we spend on weapons and defences each year and instead spend it feeding and clothing and educating the poor of the world, which it would many times over, not one human being excluded, and we could explore space, together, both inner and outer, forever, in peace. - Bill Hicks

https://evlear.com
Lombi
#10 2009-04-10 01:48
No problem, glad to help :)
<a href="http://www.domenlo.com">Surreal Art</a>