Keyword

Counter in Category Footer

  • Mike O'Leary
  • Mike O'Leary's Avatar Topic Author
  • Offline
  • New Member
More
8 years 3 months ago #150313 by Mike O'Leary
Counter in Category Footer was created by Mike O'Leary
I know this is a content plugin and therefore the counter code is not really aware of my template CSS.

But I would like to have it display in my Tags section of my template which is built in blog_item.php of my Template

Here is the code that exists there now...
// Change the order of ""if"" statements to change the order of article metadata footer items.
// Build tags 
if (strlen($article->category))
    $params['metadata-footer-icons'][] = "<span class=\"art-postcategoryicon\">"
        . $article->categories($article->parentCategory, $article->parentCategoryLink, $article->category, $article->categoryLink)
        . "</span>";
if (strlen($article->tags))
    $params['metadata-footer-icons'][] = "<span class=\"art-posttagicon\">" . $article->tags . "</span>";
# I would like to display the counter here.

// Render article
echo $article->article($params);

Is there a way to pass this variable from the plugin to the PHP above so I can have the content put in it's proper place?

Something along the lines of
if (strlen($article->comments))
    $params['metadata-footer-icons'][] = "<span class=\"art-postcommentsicon\">" . $article->comments . "</span>";
Or is this impossible without the plugin writing the comments to the database since this is where all the other stuff that displays there is coming from?

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 3 months ago #150375 by Krikor Boghossian
Replied by Krikor Boghossian on topic Counter in Category Footer
Since Disqus is being used it is possible to manually enter a comment count using its API.

help.disqus.com/customer/portal/articles/565624-adding-comment-count-links-to-your-home-page

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Mike O'Leary
  • Mike O'Leary's Avatar Topic Author
  • Offline
  • New Member
More
8 years 3 months ago - 8 years 3 months ago #150404 by Mike O'Leary
Replied by Mike O'Leary on topic Counter in Category Footer
Thanks Krikor,
I did think of that and looked at it....
The issue I'm having seems to be how the template I want to put this is into builds the Content..
All the data it builds with seem to be variables (params) queried from the Database for the article.
Example of how Tags are variablized in my template
if ($this->params->get('show_tags', 1) && !empty($this->category->tags->itemTags)) {
    $this->category->tagLayout = new JLayoutFile('joomla.content.tags');
    $article->tags = $this->category->tagLayout->render($this->category->tags->itemTags);
}

I would not know where to begin to query for the info needed for shortname (which identifies which article to count) but I suppose I could lift the code from the plugin since it does this already. Which is why I was trying to use the Plugin itself instead of using the Disqus API.

I do not know where I could get these params from the plugin or Disqus since neither would be in the Database where the rest of the data this PHP builds the variables with comes from.
So I think I need to either create code to have the plugin save the shortname or count to the database (if the plugin doesn't already)
Or have the plugin create the variable $article->comments and pass it to the template so if I add the code from my original post it will place the comments there.

I'm not sure the latter is even possible. So my first assumption is to build the count inside the template where the Tags and params are put into variables and create the new variable for $article->comments so I can check the strlen at the end and add the display code in the footer where I want it.

About the only thing I am sure of is I need to do this somehow in the php that builds the blog_item cause that's the only place the footer for articles is built in my template.

I will post the entire PHP for the file I'm talking abut inside the spoiler so as not to blow up the thread display! LOL
Warning: Spoiler!
Last edit: 8 years 3 months ago by Mike O'Leary.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum