×

Notice

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

TOPIC: multiple readon links in custom plugin (like section/category blog)

multiple readon links in custom plugin (like section/category blog) 13 years 2 months ago #11464

  • Alexander
  • Alexander's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
I've created a custom component, com_stories. It's a sort of testimonials manager. I've created a custom !joomlacomment plugin that allows users to comment on other users' testimonials. (Using !joomlacomment 4.0 RC1. I know, it's deprecated. We'll probably upgrade when we move to Joomla! 1.6.)

This component has two views: stories, which lists all testimonials (paginated) with readon links, and story, which displays a single testimonial including comments. I've modified checkVisual in the plugin to check which view com_stories is in and give a readon link or show the comments depending. This is working perfectly.

Except: in the stories view, all the readon links point to id=0. Or if I set an id via url parameter (which is not meant to be done, by definition stories view is all ids), all of the readon links are to that id.

Before, I just generated the readon links in the component itself, but I would like to be able to show the number of comments on a given testimonial.

Here is the relevant code from com_stories stories view template:

default.php:
foreach ($this->rows as $this->row) {
	echo $this->loadTemplate('story');
	$i++;
}

and default_story.php:
row->name . '';
echo 'Posted ' . date('M. jS, Y', strtotime($this->row->submitted_date)) . '';
echo '' . $this->row->story . '';
echo $this->row->id;
	global $option;
	require(JPATH_SITE."/administrator/components/com_comment/plugin/$option/josc_com_stories.php");
?>

(Used require instead of require_once because otherwise only the first testimonial will have a readon link.)

Is there some way to pass the id of each testimonial to !joomlacomment so that the readon links point to the correct id of each item in the stories view, like they do on com_content's section blog and category blog layouts?

Any help would be greatly appreciated!

Alexander Clark

P.S. Sorry if this question has been answered before. I spent a lot of time googling and was unable to find anything.

multiple readon links in custom plugin (like section/category blog) 13 years 2 months ago #11524

  • Alexander
  • Alexander's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
Nobody?

I'm going to have a hard time justifying to my boss paying for a subscription when we upgrade if there is no support.

We're willing to buy a subscription now even though we aren't upgrading yet if that will get me an answer to my question.

If what I'm wanting to do simply isn't possible with this version please let me know. I can work around by joining the comments table in my SQL query.

It just seems like it should be possible since (as far as I can tell) that's how the plugin for com_content works category- and section-blog layouts.

multiple readon links in custom plugin (like section/category blog) 13 years 2 months ago #11525

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey Alexander,
I have no explanation why I missed your post back on the 24th of January.
How is the code in josc_com_stories.php looking?
Can you give me a copy of it.

That you have to do is make sure that the $this->row is avialble to the plugin and that $this->row has the id. Then in the constructor of the plugin josc_com_stories.class.php - there you should make sure that you have this id.

And that should be all...

multiple readon links in custom plugin (like section/category blog) 13 years 2 months ago #11526

  • Alexander
  • Alexander's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
Daniel,

No worries. It happens to the best of us!

I figured out the problem. In the constructor of josc_com_stories.class.php I had
$id = JRequest::getVar('id', 0);
instead of
$id = isset($row->id) ? $row->id : 0

The first line of code, no less. D'oh!

Thanks for pointing me in the right direction!

Alexander

multiple readon links in custom plugin (like section/category blog) 13 years 2 months ago #11527

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Cheers mate!
And again sorry :) I missed the thread.

To everyone: if you are not getting a reply for more than a day, then please write again in your thread :)
  • Page:
  • 1
Time to create page: 0.139 seconds