Page 1 of 1

Need updated code for Joomla 5 for template override.

Posted: 28 Mar 2024, 08:18
by SpyderZ
I almost have this plug-in working with a 3rd party template (Helix Framework Ultimate), but when clicking the button, I'm getting the error "Failed to load PDF document."

I have the component, content plugin, system plugin, and all the fonts installed and activated.

The example code on the site is for older Joomla with icons.php, which no longer exists. We need a code example for Joomla 4/5 to get this working.

Here's the code I have in com_content/article/default.php

Code: Select all

	<?php if ($params->get('show_title') || $params->get('show_author')) : ?>
	<div class="article-header">
		<?php if ($params->get('show_title')) : ?>

		<?php $phocaPDF = false;
		if (JPluginHelper::isEnabled('phocapdf', 'content')) {
			include_once(JPATH_ADMINISTRATOR.'/components/com_phocapdf/helpers/phocapdf.php');
			$phocaPDF = PhocaPDFHelper::getPhocaPDFContentIcon($displayData['item'], $displayData['params']);
		}
		?>
		<?php echo $phocaPDF; ?>

			<<?php echo $page_header_tag; ?> itemprop="headline">
				<?php echo $this->escape($this->item->title); ?>
			</<?php echo $page_header_tag; ?>>
		<?php endif; ?>
This is a popular template that is used by a lot of Joomla websites. Being compatible would make a lot of developers' lives easier.

Re: Need updated code for Joomla 5 for template override.

Posted: 29 Mar 2024, 14:31
by Jan
Hi, if you get "Faild to load PDF document" error, then this should have nothing to do with template. Try to see your content and try to test generate the PDF based on really simple article content (e.g. only one sentence without formating). Maybe there is some part in content (advanced formatting, or e.g. javascript, etc.) which prevents from building PDF.

Jan