Copyright © 2006 - 2026 JoomlaWorks Ltd.
JoomlaWorks Ltd. and this site is not affiliated with or endorsed by The Joomla! Project™. Any products and services provided through this site are not supported or warrantied by The Joomla! Project or Open Source Matters, Inc. Use of the Joomla!® name, symbol, logo and related trademarks is permitted under a limited license granted by Open Source Matters, Inc.
Counter in Category Footer
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>";help.disqus.com/customer/portal/articles/565624-adding-comment-count-links-to-your-home-page
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!
<?php defined('_JEXEC') or die; JHtml::addIncludePath(JPATH_COMPONENT . '/helpers'); JHtml::_('behavior.tooltip'); JHtml::_('behavior.caption'); if (method_exists('JHtml','core')) JHtml::core(); else JHtml::_('behavior.framework'); Artx::load("Artx_Content"); $component = new ArtxContent($this, $this->params); $article = $component->article('category', $this->item, $this->item->params); 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); } $params = $article->getArticleViewParameters(); if (strlen($article->title)) { $params['header-text'] = $this->escape($article->title); if (strlen($article->titleLink)) $params['header-link'] = $article->titleLink; } // Change the order of ""if"" statements to change the order of article metadata header items. if (strlen($article->created)) $params['metadata-header-icons'][] = "<span class=\"art-postdateicon\">" . $article->createdDateInfo($article->created) . "</span>"; if (strlen($article->modified)) $params['metadata-header-icons'][] = "<span class=\"art-postdateicon\">" . $article->modifiedDateInfo($article->modified) . "</span>"; if (strlen($article->published)) $params['metadata-header-icons'][] = "<span class=\"art-postdateicon\">" . $article->publishedDateInfo($article->published) . "</span>"; if (strlen($article->author)) $params['metadata-header-icons'][] = "<span class=\"art-postauthoricon\">" . $article->authorInfo($article->author, $article->authorLink) . "</span>"; if ($article->printIconVisible) $params['metadata-header-icons'][] = $article->printIcon(); if ($article->emailIconVisible) $params['metadata-header-icons'][] = $article->emailIcon(); if ($article->editIconVisible) $params['metadata-header-icons'][] = $article->editIcon(); if (strlen($article->hits)) $params['metadata-header-icons'][] = $article->hitsInfo($article->hits); // Build article content $content = ''; if (!$article->introVisible) $content .= $article->event('afterDisplayTitle'); $content .= $article->event('beforeDisplayContent'); if (strlen($article->images['intro']['image'])) $content .= $article->image($article->images['intro']); $content .= $article->intro(artxBalanceTags($article->intro)); if (strlen($article->readmore)) $content .= $article->readmore($article->readmore, $article->readmoreLink); $content .= $article->event('afterDisplayContent'); $params['content'] = $content; // 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>"; // Render article echo $article->article($params);Edited 10 years 10 months ago by Mike O'Leary
Log in or create an account to reply.