Need updated code for Joomla 5 for template override.

Phoca PDF - creating PDF documents in Joomla! CMS
SpyderZ
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 28 Mar 2024, 08:08

Need updated code for Joomla 5 for template override.

Post 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.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

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

Post 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
If you find Phoca extensions useful, please support the project
Post Reply