×

Notice

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

TOPIC: How to add comments to different views of the same component

How to add comments to different views of the same component 15 years 3 months ago #5519

  • Jaime
  • Jaime's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 24
  • Thank you received: 0
Hello.... I have created a plugin for a custom component called com_hum for determined view that uses a table called "project" for example.

It works perfectly. The question I have now is that I need to implement comments for 2 more views of the same component: "tvshow" and "video". Both uses different database tables.

Using administrator, I created the components as the attached screenshot shows. But then? what can I do afterwards? I tried to modify jos_com_hum.class.php but it didn't work.

Can you give me some tips on doing this?

Thanks
Jaime

How to add comments to different views of the same component 15 years 3 months ago #5520

  • Jaime
  • Jaime's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 24
  • Thank you received: 0
Now the missing image :)

How to add comments to different views of the same component 15 years 3 months ago #5523

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
The first thing is to add the component to your view:
here is an example with com_content:
require_once(JPATH_SITE."/administrator/components/com_comment/plugin/com_content/josc_com_content.php");

this text should be in your veiw tvshow and video.

Then you will need to play with the checkvisual function
    public function checkVisual($contentId=0)
    {
	$option = JRequest::getCMD('option');
	$view = JRequest::getVar('for your view' );
 
	return  ( $option == 'your component'
	    &&	$view == 'and your view'
	);
    }
 

This should tell the component to appear.

How to add comments to different views of the same component 15 years 3 months ago #5524

  • Jaime
  • Jaime's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 24
  • Thank you received: 0
Thanks for answering... I have done so and the form appear, but, in administration interface I cannot see the comments.

As you see in this new screenshot, "Item de contenido" must show the title of the item, and when I click on "Jaime" at ID 8, for example, the alert "you must add component objects first" is shown (lines that do show text in "Item de contenido" are comments made for the first view I created)

What else do I have to do in order to be able to use administration interface to view comments?



What's the the goal of adding the component as shown in the image of the previous post? is there some relation between the "Name" and the actual view?

I realized also, that styles are commanded by the last entry in that list. I cannot have different styles for each view where the form is shown.

Thanks
Jaime

How to add comments to different views of the same component 15 years 3 months ago #5650

  • Jaime
  • Jaime's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 24
  • Thank you received: 0
any further help please?

When I try to add a comment to the other views an alert is shown telling that Request cannot be made, and inside the text area, this message appears:
<br />
<b>Notice</b>:  Undefined index:  id in <b>F:Web SitesPHPHagaloUstedMismoWebcomponentscom_commentjoscommentcomment.class.php</b> on line <b>1204</b><br />
<?xml version="1.0" standalone="yes"?><post><id></id><published></published><noerror>1</noerror><debug></debug><captcha><![CDATA[<a title="clic para recargar una nueva imagen" href='javascript:JOSC_reloadCaptcha()'><img src="http://hagaloustedmismo//components/com_comment/joscomment/captcha.php?refid=68dee420ae3901a6e17cfd221196d315" alt="Security Image" />
<input type="hidden" name="security_refid" value="68dee420ae3901a6e17cfd221196d315" /></a>]]></captcha></post>

When I post a comment in the original view, itl works.

Thanks
Jaime

How to add comments to different views of the same component 15 years 3 months ago #5653

  • Jaime
  • Jaime's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 24
  • Thank you received: 0
Finally I had to hack the com_comment files because it's impossible to do what I was trying.

Please, can you add this feature in your next release of the component? the hack I made it's momentary because I needed to hardcode the name of my component in admn.comment.php file with this code at line 697:
if (substr($component, 0, 7) == 'com_hum')
	$component2 = 'com_hum';
else
	$component2 = $component;
$component_exist = ($component=="" || is_dir(JPATH_SITE.DS. "components".DS.$component2));

That is because I needed to create 1 plugin for each view. In my case I have 3 views (proyecto, programa and video) that corresponds to only 1 component (com_hum).

Then, the main requirement is:

A component not only can have 1 content table as Joomla default tables do, but for example, my component, com_hum, has 3 tables feasible to be commented. And the class file of the plugin only can manage one content table. So I needed to create a "virtual" component for each table with the hack to admin.comment.php in order to see the comments in administration.

Thanks
Jaime
  • Page:
  • 1
Time to create page: 0.116 seconds