×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Component Integration

Component Integration 9 years 10 months ago #14806

  • Uzi Cohen
  • Uzi Cohen's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 20
  • Thank you received: 0
Hi,

I am trying to create plugin for my new component and I have a question.

my component is a library with items but without categories.

I have two views:
1.library view.
2.item view.
I want the comments will be in item view and when I tried to follow com_REPLACEnewplugin I got confuse when I saw function getCategoriesIdOption() so I tried to change it to be like getSectionsIdOption():

public function getCategoriesIdOption() {
$catoptions = array();
return $catoptions;
}

but I cannot manage to make it work. I am sure I am doing something wrong not sure yet what exactly.

Another question, can I change the position of Show "Read On" instead of the read more position (end of the article) I want to render it before the article to make it float near the title.

Thanks a lot,
Uzi

Component Integration 9 years 10 months ago #14813

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey Uzi,
I don't know your component, but here are some general advises that I can give you. I think that the com_REPLACEnewplugin is outdated and you better follow another plugin - such as the com_docman for example.

It is your decision where you want to show the comment form. If you want you can show it right after the title - all you need to do is to load the comment files on that position.

Something like this for example
require_once(JPATH_SITE . "/administrator/components/com_comment/plugin/com_content/josc_com_content.php");
		echo CommentPluginContent::output($row, $params);

so now in your josc_com_content.php you should have a class CommentPluginContent that has an output function

the content of the output function can be as simple as this:
	$object		= JOSC_utils::ComPluginObject( 'com_content' , $row);
 
		return  JOSC_utils::execJoomlaCommentPlugin( $object , $row, $params );

with this code you'll start the component and it will try to see if you have comments for the $row.

Now your $row object should containt an id and catid variables.

You should set the proper id in the __construct function in your actual comment class. (check josc_com_content.class.php)

The getCategoriesIdOption function is only used in the backend for the settings. If you don't need this the way you have it is perfectly fine.

We actually decide if we should render the component in the checkSectionCategory function. If it return false, then we won't execute the component. if this function returns true, then we go further and checkVisual funciton should tell us if we are in single view (for you item view) or on frontpage (library view for you).

If you manage it so far - you will have already the form and you can comment for this item.

The next important function is linkToContent - this function is used to create proper links to the item. It is used in the frontend/backend/rss and emails - so play special attention to it.

Hope that this information helps. If something is unclear don't hesitate to ask. I'll try to explain again :)

Cheers,
Daniel

Component Integration 9 years 10 months ago #14814

  • Uzi Cohen
  • Uzi Cohen's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 20
  • Thank you received: 0
Hi Daniel :)

Thanks a lot for your help everything is working !

USER wrote: Another question, can I change the position of Show "Read On" instead of the read more position (end of the article) I want to render it before the article to make it float near the title.


I meant to category blog view. (not the comments form just link to comments and count)

Component Integration 9 years 10 months ago #14815

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
If you look at the first code example above - this is all you need to do. You just need to put the code below your title in the category blog view. And the same code needs to be put below the content in the single view. Do you understand what I mean?

Daniel

Component Integration 9 years 10 months ago #14816

  • Uzi Cohen
  • Uzi Cohen's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 20
  • Thank you received: 0
Yes but I think we speaking on different things.

if you go to joomla blog view you have (10 comments)add comment on every article in the blog view

I want to render just this link instead of the end of the article (in Joomla blog view not in my component) before, then I will make it float near the title.

is it possible ?

Component Integration 9 years 10 months ago #14817

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey Uzi,
Can you explain again please? Maybe a screenshot of what you want.

I'm not really sure if we are talking about the same thing :)

Cheers,
Daniel

Component Integration 9 years 10 months ago #14818

  • Uzi Cohen
  • Uzi Cohen's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 20
  • Thank you received: 0


I want to render the add comment near the title then I will change it to write icon and the number of posts but I wand to render it before the article.
is it possible?

Component Integration 9 years 10 months ago #14819

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
ok, so what I said above applies to your example.

In your blog view you need to call the plugin before/after the title. Remember that above I wrote that the checkVisual function will decide if we have to show the form or the write comment link. So if this function returns false in the blog view - you will see "write comment (number of comments) " link. Once you have the link there you can style it as you wish.

Cheers,
Daniel

Component Integration 9 years 10 months ago #14820

  • Uzi Cohen
  • Uzi Cohen's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 20
  • Thank you received: 0
not managed to do it, I will add it to phase 2 or 3.

Again thanks a lot Daniel !!! :)

Re: Component Integration 9 years 9 months ago #15225

  • Uzi Cohen
  • Uzi Cohen's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 20
  • Thank you received: 0
Hi Daniel,

I just found out that I have a little problem with the link I generate, can you tell how can I remove "component" from the link ?

http://mydomain/component/mylink/alias#josc3930

this is the function but not sure what to change:
function linkToContent($id, $commentId='') {
		$comment = '';
		$appl = JFactory::getApplication();
 
		if ($commentId) {
			$comment = '#josc' . $commentId;
		}
 
		$link = JRoute::_('index.php?option=com_games&view=game&id=' . $id) . $comment;
 
		/* if admin backend */
		if ($appl->isAdmin()) {
			$link = JURI::root() . $link;
		}
 
		/* for notification email links and not root directory - ! */
		if (substr(ltrim($link), 0, 7) != 'http://') {
			$uri = & JURI::getInstance();
			$base = $uri->toString(array('scheme', 'host', 'port'));
			$link = $base . $link;
		}

Thanks a lot!
Uzi

Re: Component Integration 9 years 9 months ago #15236

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
I don't see any "component" word in the link??? What do you mean Uzi?

Cheers,
Daniel

Re: Component Integration 9 years 9 months ago #15240

  • Uzi Cohen
  • Uzi Cohen's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 20
  • Thank you received: 0
the link generate: mydomain/component/mylink/alias#josc3930

I want to remove the component so the new link will be mydomain/mylink/alias#josc3930

another question(let me know if to add it to wishlist forum):

there is a way to add a default image if user don't have avatar in JomSocial ?

Thanks again !!! :cheer:

Re: Component Integration 9 years 9 months ago #15241

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Aaa, I see. Well the above link points to the fact that your link generator is missing the component itemid. Look at other plugins and you will see how we get the itemid. Once you have it - your link should be correct.

What is shown right now if the user doesn't have a jomSocial avatar?

Daniel

Re: Component Integration 9 years 9 months ago #15247

  • Uzi Cohen
  • Uzi Cohen's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 20
  • Thank you received: 0
Thanks I will check it :)

If the user have avatar in JomSocial he will see it in his comments if not there is nothing there.

If there is option to do it this way it will be nice:

1.No Avatar image for users with no avatar in JomSocial.
2.Guest Avatar image for logged out users.

Then the admin can link the image from the admin panel.

Re: Component Integration 9 years 9 months ago #15253

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
And what happens if you turn gravatar on? Is there a default image for users that don't have avatars?
Daniel

Re: Component Integration 9 years 9 months ago #15272

  • Uzi Cohen
  • Uzi Cohen's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 20
  • Thank you received: 0
If enabled gravatar support, the no image exist :)
Thanks Again Daniel :)
  • Page:
  • 1
Time to create page: 0.159 seconds