Page 1 of 2
Joomla template overide
Posted: 17 Jan 2012, 22:50
by heymelby
I'm trying to get Phoca to work on my joomla 1.7.3 site. I know i need to alter my template file located in
templates/your-template/html/com_content/article/default.php. I've seen similar questions answered by giving the phoca-pdf-installation-and-usage link. This does not help at all as my code does not look anything like the example given. It looks like this
Code: Select all
<?php
defined('_JEXEC') or die;
require_once dirname(__FILE__) . str_replace('/', DIRECTORY_SEPARATOR, '/../../../functions.php');
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
$component = new ArtxContent($this, $this->params);
$article = $component->article('article', $this->item, $this->item->params, array('print' => $this->print));
echo $component->beginPageContainer('item-page');
if (strlen($article->pageHeading))
echo $component->pageHeading($article->pageHeading);
$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->toc))
$content .= $article->toc($article->toc);
if (strlen($article->text))
$content .= $article->text($article->text);
if ($article->introVisible)
$content .= $article->intro($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.
if (strlen($article->category))
$params['metadata-footer-icons'][] = "<span class=\"art-postcategoryicon\">"
. $article->categories($article->parentCategory, $article->parentCategoryLink, $article->category, $article->categoryLink)
. "</span>";
// Render article
echo $article->article($params);
echo $component->endPageContainer();
What in the world do i need to add to make the blasted icon show on the frontend?! i've tried comparing the native joomla files which are fine, but i don't know enough about php to know how to alter the above code.
need a answer on this please and thank you.
Re: Joomla template overide
Posted: 18 Jan 2012, 01:07
by SonRiab
Try this one:
Code: Select all
<?php
defined('_JEXEC') or die;
require_once dirname(__FILE__) . str_replace('/', DIRECTORY_SEPARATOR, '/../../../functions.php');
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
$component = new ArtxContent($this, $this->params);
$article = $component->article('article', $this->item, $this->item->params, array('print' => $this->print));
$phocaPDF = false;
if (JPluginHelper::isEnabled('phocapdf', 'content')) {
include_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_phocapdf'.DS.'helpers'.DS.'phocapdf.php');
$phocaPDF = PhocaPDFHelper::getPhocaPDFContentIcon($this->item, $params);
}
echo $component->beginPageContainer('item-page');
if (strlen($article->pageHeading))
echo $component->pageHeading($article->pageHeading);
$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 ($phocaPDF)
$params['metadata-header-icons'][] = $phocaPDF;
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->toc))
$content .= $article->toc($article->toc);
if (strlen($article->text))
$content .= $article->text($article->text);
if ($article->introVisible)
$content .= $article->intro($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.
if (strlen($article->category))
$params['metadata-footer-icons'][] = "<span class=\"art-postcategoryicon\">"
. $article->categories($article->parentCategory, $article->parentCategoryLink, $article->category, $article->categoryLink)
. "</span>";
// Render article
echo $article->article($params);
echo $component->endPageContainer();
Re: Joomla template overide
Posted: 18 Jan 2012, 06:28
by heymelby
Thank you for the help.
I replaced the code with what you provided and got
Fatal error: Call to a member function get() on a non-object in /home/content/75/3187575/html/abramspc/administrator/components/com_phocapdf/helpers/phocapdf.php on line 65
line 65-89 is this in the phocapdf.php
Code: Select all
if ($params->get('show_icons')) {
$text = JHTML::_('image','components/com_phocapdf/assets/images/pdf_button.png', JText::_('PLG_PHOCAPDF_CONTENT_PDF'));
} else {
if ($params->get('show_print_icon')) {
//$sep = JText::_('JGLOBAL_ICON_SEP');
$sep = '';
} else if ($params->get('show_email_icon')) {
$sep = JText::_('JGLOBAL_ICON_SEP');
} else {
$sep = '';
}
$text = ' '. JText::_('PLG_PHOCAPDF_CONTENT_PDF') .' '. $sep;
}
$attribs['title'] = JText::_('PLG_PHOCAPDF_CONTENT_PDF');
$attribs['rel'] = 'nofollow';
$output = '<li class="print-icon">'
. JHTML::_('link',JRoute::_($url), $text, $attribs)
.'</li>';
return $output;
}
any thought?
Re: Joomla template overide
Posted: 18 Jan 2012, 07:51
by SonRiab
Next try: (^_^)
Code: Select all
<?php
defined('_JEXEC') or die;
require_once dirname(__FILE__) . str_replace('/', DIRECTORY_SEPARATOR, '/../../../functions.php');
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
$component = new ArtxContent($this, $this->params);
$article = $component->article('article', $this->item, $this->item->params, array('print' => $this->print));
$phocaPDF = false;
if (JPluginHelper::isEnabled('phocapdf', 'content')) {
include_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_phocapdf'.DS.'helpers'.DS.'phocapdf.php');
$phocaPDF = PhocaPDFHelper::getPhocaPDFContentIcon($this->item, $this->item->params);
}
echo $component->beginPageContainer('item-page');
if (strlen($article->pageHeading))
echo $component->pageHeading($article->pageHeading);
$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 ($phocaPDF)
$params['metadata-header-icons'][] = $phocaPDF;
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->toc))
$content .= $article->toc($article->toc);
if (strlen($article->text))
$content .= $article->text($article->text);
if ($article->introVisible)
$content .= $article->intro($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.
if (strlen($article->category))
$params['metadata-footer-icons'][] = "<span class=\"art-postcategoryicon\">"
. $article->categories($article->parentCategory, $article->parentCategoryLink, $article->category, $article->categoryLink)
. "</span>";
// Render article
echo $article->article($params);
echo $component->endPageContainer();
If the above code do not work, try this one:
Code: Select all
<?php
defined('_JEXEC') or die;
require_once dirname(__FILE__) . str_replace('/', DIRECTORY_SEPARATOR, '/../../../functions.php');
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
$component = new ArtxContent($this, $this->params);
$article = $component->article('article', $this->item, $this->item->params, array('print' => $this->print));
$phocaPDF = false;
if (JPluginHelper::isEnabled('phocapdf', 'content')) {
include_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_phocapdf'.DS.'helpers'.DS.'phocapdf.php');
$phocaPDF = PhocaPDFHelper::getPhocaPDFContentIcon($this->item, $this->params);
}
echo $component->beginPageContainer('item-page');
if (strlen($article->pageHeading))
echo $component->pageHeading($article->pageHeading);
$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 ($phocaPDF)
$params['metadata-header-icons'][] = $phocaPDF;
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->toc))
$content .= $article->toc($article->toc);
if (strlen($article->text))
$content .= $article->text($article->text);
if ($article->introVisible)
$content .= $article->intro($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.
if (strlen($article->category))
$params['metadata-footer-icons'][] = "<span class=\"art-postcategoryicon\">"
. $article->categories($article->parentCategory, $article->parentCategoryLink, $article->category, $article->categoryLink)
. "</span>";
// Render article
echo $article->article($params);
echo $component->endPageContainer();
It is hard to say what is right without knowledge of the the template! (^_^)
Re: Joomla template overide
Posted: 18 Jan 2012, 16:27
by heymelby
Well you are on the right track, now the icon shows up but there is a rendering problem, I tried both force down and inline pop up settings and this is the result.
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 16 bytes) in /home/content/75/3187575/html/abramspc/administrator/components/com_phocapdf/assets/tcpdf/tcpdf.php on line 6912
both scripts created the pdf icon and allowed the page to display. the icon forces the other icons to wrap from 1 line to 3 lines, you can see here
http://heymelby.com/abramspc/dispute-resolution. I tried removing icons in the backend by hiding them and they are still there.
here is alink to download my template
Code: Select all
http://heymelby.com/abramspc2012a.zip
it was made with Artisteer 3.1
Re: Joomla template overide
Posted: 18 Jan 2012, 17:08
by SonRiab
I do not need your template! But the info that this is an Artisteer template explains the weird code! (^_^) Anyway! The error is caused by a php setting which limit the allowed memory size to 32MB. If possible edit the php.ini file (on linux you can find it in most cases in /etc/php5/apache2/) and set memory_limit to a higher value. If you have no access to this file you can maybe set it in the .htaccess file (php_value memory_size 64M for example). If this doesn't work, please contact your hoster. About the "new line" thing: You have to customize /JOOMLAROOT/administrator/components/com_phocapdf/helpers/phocapdf.php. Serach for the getPhocaPDF function and delete the parts where <li class="print-icon"> and </li> is added to the output.
Re: Joomla template overide
Posted: 18 Jan 2012, 20:32
by heymelby
This is getting absurd.
I change the php5.ini file to allow for larger files and it still chokes on it.
with these settings
memory_limit = 64M
upload_max_filesize = 192M
post_max_size = 100M
file_uploads = On
i get
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 9116 bytes) in /home/content/75/3187575/html/abramspc/administrator/components/com_phocapdf/assets/tcpdf/tcpdf.php on line 19406
i upped the mem limit to 164 and get this result
Fatal error: Maximum execution time of 30 seconds exceeded in /home/content/75/3187575/html/abramspc/administrator/components/com_phocapdf/assets/tcpdf/tcpdf.php on line 18077
i'm going to try upgrading to php 5.3 and reinstall the plugin and component and see if that helps.
Re: Joomla template overide
Posted: 19 Jan 2012, 05:59
by SonRiab
It is also possible that PhocaPDF and Artisteer Templates aren't compatible!
Re: Joomla template overide
Posted: 19 Jan 2012, 18:13
by Jan
Hi, check the html of produced content - maybe it was saved to complicated which can have problems while processing it in TCPDF class (for example - if someone copy the code from Word processor, thousands of unnecessary styles, etc. are copied too)
Artisteer template should (I think) have no influence on the PDF as only the content from article is loaded to PDF, not the whole designed site but ... maybe it loads a lot of classes, so it can take some memory ... but no experiences with Artisteer
Jan
Re: Joomla template overide
Posted: 19 Jan 2012, 22:20
by heymelby
Solved!
Happy to report that all is well on a fresh install. The issue ended up being database related. I did a fresh install on a new database AFTER setting php5.ini file size limits and tmp folder locations. Somehow setting the limits after installing the plugin and joomla did not mix well.
Happy to report that after doing that with all the code help from above (thanks you) the pocha plugin seems to be working well.
here is alink showing it working
http://heymelby.com/joomart/using-jooml ... -beginners
thanks for everything!