Intergration with JomComment

Phoca Gallery - image gallery extension
adam
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 27 May 2008, 10:35

Intergration with JomComment

Post by adam »

I am trying to integrate my Phoca Gallery with JomComment, according to the Azrul people all i need to do is to insert these lines into the display area of a component and it should work:

global $mosConfig_absolute_path;
include_once($mosConfig_absolute_path. "/mambots/content/jom_comment_bot.php");
echo jomcomment($uid, "com_component");

* $uid: the unique id for the particular content
* "com_whatever": the name of the component

http://wiki.azrul.com/index.php/Jom_Com ... ntegration

Can anyone tell me where this should code should be placed? has anyone tried to intergrate Phoca with JomComment ?
And what is the $uid?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49297
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Intergration with JomComment

Post by Jan »

There is some code for integring !JoomComment into a Phoca Gallery, but I thing the !JoomComment is stopped now?

Code: Select all

global $mosConfig_absolute_path;
include_once($mosConfig_absolute_path. "/mambots/content/jom_comment_bot.php");
echo jomcomment($uid, "com_component");
this is still legace or obsolete code (1.0.x or 1.5 legacy) ... maybe you should paste it to some view site:

components/com_phocagallery/views/.../tmpl/default.php ???

Jan
If you find Phoca extensions useful, please support the project
adam
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 27 May 2008, 10:35

Re: Intergration with JomComment

Post by adam »

[quote] There is some code for integring !JoomComment into a Phoca Gallery,

[/quote]

Cool, great news :)

[quote] but I thing the !JoomComment is stopped now?

[/quote]

Not as far as I know, they are responding to e-mails and helped with a couple of issues over the last few days very quickly.

Sorry but I am not a programmer is there any recommended places to put the code? There are 3 sub directoires, does the code need to go into all three files?

Where do I get the $uid from ?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49297
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Intergration with JomComment

Post by Jan »

Hi, you should paste it into a 'template' view, e.g.:

components/com_phocagallery/views/category/tmpl/default.php....

What is an $uid, I don't know :( :( (I didn't do this code)

Jan
If you find Phoca extensions useful, please support the project
FabZ
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 14 Nov 2008, 18:29

Re: Intergration with JomComment

Post by FabZ »

I found this...maybe useful?

------------------------ topic post ----------------------------
Here are some solutions I've come up with for problems encountered integrating my custom component with the latest Jom Comment.

This component has multiple content types, subtypes, and rows spread across dozens of tables.

Problems to solve:

* No $mosConfig_absolute_path
* Central inclusion of Jom Comment as it is used in multiple views
* Unique ID generation as Jom Comment uses an int for the content ID
* ID decoding for future use

Including Jom Comment

We'll refer to the component here as com_foo. The Wiki includes the code using $mosConfig_absolute_path which is unavailable. To include it once without using the var I put it in foo.php after including the component controller. Since I have a custom file for generating the unique ID (later), it's also included here. This solves the first two issues above:

Code:

//Jom Comment
include_once(dirname(__FILE__)."/../../plugins/content/jom_comment_bot.php");
include_once("commentuid.php");

Unique ID Generation

The third issue above required that a unique ID be generated for each content object for which I wanted comments supported. These are in different tables depending on what type and subtype the objects are. This precludes using the DB row ID for comment IDs as the same comments would show up for different objects with an ID of, for example, 1.

Since each table contains thousands of rows I needed to generate an ID which would allow for this. First each type needed to be defined:

Code:

//Comment type IDs
define('TYPE_1_ID', 0x01000000);
define('TYPE_2_ID', 0x02000000);
...

Secondly the subtypes needed to be defined:

Code:

//Comment subtype IDs
define('SUBTYPE_A_ID', 0x00100000);
define('SUBTYPE_B_ID', 0x00200000);
...

This allows sufficient types, subtypes, and IDs to support as many as a million rows per type/subtype.

To generate the ID I have a function defined - getCommentUID - that takes a type string, subtype string, and object ID as parameters and uses switch statements to convert them to type IDs. The following line converts this to a unique ID for use with Jom Comment:

Code:

$uid = ($typeid | $subtypeid)+$objid;
return $uid;

In each view template all I need now is to call the function to get the ID and call jomcomment to handle the comments:

Code:

<?php echo jomcomment(getCommentUID(JRequest::getVar('type'), JRequest::getVar('subtype'), $this->obj->ID), 'com_foo');


Decoding the Unique ID

For future use, the ID can be decoded like so:

* To get the type ID:

$typeid = $uid & ~0x00FFFFFF;

* To get the subtype ID:

$subtypeid = $uid & ~0x0F0FFFFF;

* To get the object ID:

$id = $uid & ~0x0FF00000;

This can be used along with switch statements to determine which table and row the content is in.

Hope this is understandable and useful to some. Smiley
---------------------- end post -----------------------------


My opinion: Well, Jomcomment is not free, but maybe it offers the most realizable integration...maybe!
On the other side there are other specific and good extensions as new Chronocomments or mxcomment or yvComment and I can't believe no one ask for cooperation with Phoca Team!
For a value product as PG, comments lack a little in pubblication options and "guests" management.
But there is no way to integrate at current time... :cry:
I believed that Phoca Guestbook it should have been the next step in Phoca Gallery comments but I read it's not so easy.
Ok I'm waiting for a Phoca Comments...for articles and the only one for Phoca Gallery...a J! world revolution, and rigorously with Phoca Smilies :D
Bye :)
vlaskivlaj
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 17 Dec 2008, 20:29

Re: Intergration with JomComment

Post by vlaskivlaj »

I see a lot of suggestions how to call Jom Comment from Phoca Gallery. Unfortunately, I'm also looking for some comment solution since phoca doesn't allow to leave more than one comment/user.

Does anybody integrated this component (comment) into phoca gallery???

If yes, please could you propose solution.

Thanks a lot in advance...
zak_the_man
Phoca Member
Phoca Member
Posts: 20
Joined: 07 Feb 2009, 21:32

Re: Intergration with JomComment

Post by zak_the_man »

This tutorial shows how to integrate Jom Comment with Phoca Download in Joomla 1.5:

How to integrate Jom Comment with Phoca Download
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49297
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Intergration with JomComment

Post by Jan »

Hi, thank you for this info but there is missing something:

Add the following two lines, just before the last line in the file:

There are no lines displayed

Jan
If you find Phoca extensions useful, please support the project
vlaskivlaj
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 17 Dec 2008, 20:29

Re: Intergration with JomComment

Post by vlaskivlaj »

Hi Jan,

the code that is provided is next:

Code: Select all

<?php
include_once(JPATH_BASE. "/plugins/content/jom_comment_bot.php");
echo jomcomment($this->category[0]->id, "com_phocadownload");
?>

I used (for phoca gallery):
<?php
include_once(JPATH_BASE. "/plugins/content/jom_comment_bot.php");
echo jomcomment($this->category[0]->id, "com_phocagallery");
?>
but, like I mentioned, has some errors. :-(
Last edited by caro84g on 17 Feb 2009, 10:17, edited 1 time in total.
Reason: added code tags
vlaskivlaj
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 17 Dec 2008, 20:29

Re: Intergration with JomComment

Post by vlaskivlaj »

zak_the_man wrote:This tutorial shows how to integrate Jom Comment with Phoca Download in Joomla 1.5:

How to integrate Jom Comment with Phoca Download
Hi Zak,

I have tried to integrate Jom Comment to a phoca gallery according your code (instructions),
but unfortunatelly, I gor an error (please, see attached).

Do you have some solution how to integrate to a phoca gallery???

Thanks,
Vlaski
Post Reply