×

Notice

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

TOPIC: Use {READON_COUNT} on the template

Use {READON_COUNT} on the template 15 years 3 months ago #5667

  • Ahmad Alfy
  • Ahmad Alfy's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
Hi, My name is Ahmad...
That's my first post on Jomcomment forums :)

I am building a custom Joomla! installation preloaded with all blogging features...
My package will be free for everyone, I am working on it to help Joomla! beginners who want to blog using Joomla but are confused with the # of extensions they have to install.

I choose Jomcomment cause it's easy to work with, very stable and GPL :)

Take a look at the screenshot I am attaching :


If you see beside the article title, you can find the date and the number of comments on each article ( currently it says 16 ... it's a number I am using till I reach the fix )

I want to insert the # of the comments on that article... How can I do that?
I've tried alot but couldn't reach a solution


PS: I haven't start working on the sidebar yet :blush: I am still working on the content area!!!

Best Regards

Use {READON_COUNT} on the template 15 years 3 months ago #5668

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey there! Nice idea.

It is not easy what you are trying to do. But you can write a plugin for the side bar.
There you can make a query to get the numbers of comments.

Use {READON_COUNT} on the template 15 years 3 months ago #5669

  • Ahmad Alfy
  • Ahmad Alfy's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
Hey thanks for the reply :)
I will see what I can do and post the solution when I reach it!

Regards

Use {READON_COUNT} on the template 15 years 3 months ago #5676

  • Ahmad Alfy
  • Ahmad Alfy's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
I came up with something got me the required result :

$query = "SELECT COUNT(contentid) ";
$query .= "FROM jos_comment ";
$query .= "WHERE contentid = ";
$query .= $this->item->id;
$query .= " AND published=1";
$results = mysql_query($query);
comment = mysql_fetch_array($results);
echo $comment[0];

Is it ok to put a query in the view? the template I mean!
or should I write a plugin :D ?

Use {READON_COUNT} on the template 15 years 3 months ago #5731

  • JonusC
  • JonusC's Avatar
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 785
  • Thank you received: 48
Is that sidebar thing part of the template? If so, wouldn't it be easier to use Template MVC?

Is it ok to put a query in the view? the template I mean!
or should I write a plugin :D ?


If that's what you mean, using MVC (putting it in template/myblogtemplate/html/com_content/frontpage or whatever) then yes it is ok :)

Just incase though, maybe put an IF in there to check if JoomlaComment is enabled and active, otherwise skip the code - just incase the user wants to disable comments!

Use {READON_COUNT} on the template 15 years 3 months ago #5793

  • Ahmad Alfy
  • Ahmad Alfy's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
Yeah by using the MVC I meant using the file in the template/html/...etc

I will add a parameter to the template configuration to let the user to enable/disable the # of comments then if selected I will use an IF statement to check if Jomcomment exists or not
if not and selected enabled -> display nice warning

Thanks for your help JonusC :)

Use {READON_COUNT} on the template 15 years 3 months ago #5918

  • JonusC
  • JonusC's Avatar
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 785
  • Thank you received: 48
Not a problem :) I not long actually realized the power of the Templating in Joomla 1.5, it's very nice that we can easily customize/over-ride templates to move around practically any component element :cheer:
  • Page:
  • 1
Time to create page: 0.116 seconds