Members: 16,996
Threads: 38,866
Posts: 159,475
Online: 47

Newest Member: Kl_broka@rediffmail.com


Odoo.tv - Outdoor Television


Sedo - Domains kaufen und verkaufen das Projekt mambers.com steht zum Verkauf Besucherstatistiken von mambers.com etracker® Web-Controlling statt Logfile-Analyse

Go Back   Mambers.com > Development > Mambots

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09.06.2004, 22:28   #1 (permalink)
Professional Mamber
 
zorkhh's Avatar
 
Join Date: Apr 2004
Location: Northern Germany
Posts: 713
zorkhh is on a distinguished road
Default Please review my first Mambot

Hi,

I just finished my FIRST mambot. It's used to add links to all other articles with the same Category to the content. I just wanted to ask if there are easier ways to solve the problem (e.g. is there a variable i can use for the category of the actual content?). For me it works fine on my website.

Here is the code (feel free to use it or criticise it!):

Code:
<?php
/**
* moscategory mambot
* @by Thomas Kahl
* @package Mambo Open Source
* @Copyright (C) 2004
* @ All rights reserved
* @ Mambo Open Source is Free Software
* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
* @used parts of mod_related_items
**/

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

if (strtolower($option)=="content" and $id<>"" and strtolower(mosGetParam( $_REQUEST, 'task', "" ))=="view") {
// select other items based on the metakey field 'like' the keys found
	$query = "SELECT #__content.catid, #__categories.name FROM #__content, #__categories WHERE #__content.catid=#__categories.id and #__content.id=$id";
	$database->setQuery( $query );
	$catrows = $database->loadObjectList();
	$catrow = $catrows[0];
	$vglcat=$catrow->catid;
	$vglcatname=$catrow->name;

	if ($vglcat<>"") {
	// now gather all other content with this CATID
	$query = "SELECT #__content.id, #__content.title"
	. "\nFROM #__content"
	. "\nWHERE #__content.catid=$vglcat and #__content.id<>$id AND state=1 AND #__content.access <=$my->gid";
	$query .= " order by #__content.ordering";
	$linkblock="";
	$database->setQuery( $query );
	if ($related = $database->loadObjectList()) {
		$linkblock.= 'Related Items - "'.$vglcatname.'"';
		$linkblock.= '<table cellspacing="0" cellpadding="1" align="left" class="moduletable" style="width: 100%">';
		foreach ($related as $item) {
			$linkblock.= '<tr><td>';
			$linkblock.= '<img src="'.$mosConfig_live_site.'/images/M_images/indent1.png" border="0" alt="" />';
			$linkblock.= "<a href=\"index.php?option=content&task=view&id=$item->id\">$item->title</a></td></tr>";
		}
		$linkblock.= '</table>';
	}
	echo $database->getErrorMsg();
	if ($linkblock<>"") {
		$row->text.=$linkblock;
	}
	}
}
?>
Bye, Zork

Edit: just corrected two errors...

P.S.: You can see an example here

Last edited by zorkhh; 09.06.2004 at 23:30.
zorkhh is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 10.06.2004, 10:25   #2 (permalink)
Senior Mamber
 
novocaine's Avatar
 
Join Date: Apr 2004
Location: Hamburg/Germany
Posts: 241
novocaine is on a distinguished road
Default Re: Please review my first Mambot

I've saved your code to a file named moscategory.php and put it in /mambots. Actually what effect should it make? Didn't realize any changes to my content though.

regards,
novocaine
__________________
Visit ThinkMambo - home of TMEdit and XHTMLSuite
WYSIWYG editors for Mambo Open Source
novocaine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10.06.2004, 10:37   #3 (permalink)
Professional Mamber
 
zorkhh's Avatar
 
Join Date: Apr 2004
Location: Northern Germany
Posts: 713
zorkhh is on a distinguished road
Default Re: Please review my first Mambot

Hi Novocaine!

As you can see in my example, there is a list of links under the content where all the articles of the same category are shown.

This only works on "Content-Section-Category-Items".

In all of my (5) sites it works fine.

Zork
zorkhh is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10.06.2004, 22:09   #4 (permalink)
Professional Mamber
 
eyezberg's Avatar
 
Join Date: Apr 2004
Location: Gap / France
Posts: 860
eyezberg is an unknown quantity at this point
Default Re: Please review my first Mambot

Hi, can be you more specific?
Tried the same as novo', and saw no change..?
The code doesn't look like it needs to be called by {moscategory},
is there anything else appart from placing the file into the mambots dir' that needs to be done?
Danke.
__________________
joe / ex Mambo ex Doc Team
Eyezberg.com
eyezberg is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10.06.2004, 22:32   #5 (permalink)
Professional Mamber
 
stingrey's Avatar
 
Join Date: Apr 2004
Location: Marikina, Manila, Philippines
Posts: 776
stingrey is on a distinguished road
Default Re: Please review my first Mambot

I get
Quote:
Notice: Undefined variable: id in C:\apache2\htdocs\Mambo\stingrey\mambots\moscatego ry.php on line 15


And yes I have set error reporting to Maximum, helps me debug my modules as I develop them

__________________
Joomla! Core Team Member
Software Coding & Design - Stability Team Leader
www.joomla.org
Former Mambo Core Team Member
stingrey is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10.06.2004, 23:34   #6 (permalink)
Professional Mamber
 
zorkhh's Avatar
 
Join Date: Apr 2004
Location: Northern Germany
Posts: 713
zorkhh is on a distinguished road
Default Re: Please review my first Mambot

Hi,

first of all - thank you for trying!

This mambot just adds links to all the items in the same category as the shown article:



I think i know what the problem is. Do you all use "searchenginefriendly URLs"? Then maybe this if-clause
Code:
strtolower(mosGetParam( $_REQUEST, 'task', "" ))=="view"
may be the problem. You don't have the "task-parameter" in your URL. But do you know, how i can figure out that the selected content is a complete article an not just a blog?

Zork
zorkhh is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11.06.2004, 00:14   #7 (permalink)
Professional Mamber
 
eyezberg's Avatar
 
Join Date: Apr 2004
Location: Gap / France
Posts: 860
eyezberg is an unknown quantity at this point
Default Re: Please review my first Mambot

Of course, no task, no bot
Good, fast debugging.
Now, do I turn SEF off or not ...
__________________
joe / ex Mambo ex Doc Team
Eyezberg.com
eyezberg is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 13.06.2004, 12:58   #8 (permalink)
Professional Mamber
 
stingrey's Avatar
 
Join Date: Apr 2004
Location: Marikina, Manila, Philippines
Posts: 776
stingrey is on a distinguished road
Default Re: Please review my first Mambot

Hi Thomas,

hope you dont mind but I've played with your mosbot and heavily modified it.
I will make it available soon on MOSforge and give you a link to it to use on your mosbots site.

Basically I cleaned up the code, added mamblefish support, SEF support and added some settings that users can configure without having to play with the code too much. I'm trying to see if I can ceate a simple Admin Backend for to make these settings more easily configurable - I suspect i wont be able to do this, but I'll at least try.

You can see it working on my site:
www.stingrey.biz
__________________
Joomla! Core Team Member
Software Coding & Design - Stability Team Leader
www.joomla.org
Former Mambo Core Team Member
stingrey is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 13.06.2004, 14:54   #9 (permalink)
Professional Mamber
 
eyezberg's Avatar
 
Join Date: Apr 2004
Location: Gap / France
Posts: 860
eyezberg is an unknown quantity at this point
Default Re: Please review my first Mambot

stingrey, this looks really good on your site!
any idea when it'll be out..? (don't wanna disable SEF really)
__________________
joe / ex Mambo ex Doc Team
Eyezberg.com
eyezberg is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 13.06.2004, 14:59   #10 (permalink)
Professional Mamber
 
zorkhh's Avatar
 
Join Date: Apr 2004
Location: Northern Germany
Posts: 713
zorkhh is on a distinguished road
Default Re: Please review my first Mambot

Thank you for your work!

Now my version work with SEF too, but i'd prefer to see yours. So i'll wait, until you give me the link to the bot.

(But the idea for this bot was good - wasn't it? )

Zork
zorkhh is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mambot gesucht/gewünscht MamboMicha Komponenten 1 10.06.2004 11:03
Installing a mambot TheGreek Mambots 0 30.05.2004 15:03
MosBanner Mambot -> how do I use? scorplev Mambots 4 27.05.2004 10:38
MosBanner Mambot -> how do I use scorplev Mambots 3 07.05.2004 02:08


All times are GMT +2. The time now is 10:33.

Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
A vBSkinworks Design
© Copyright 2004-2008 by Arthur Konze Webdesign.