PDF Dynamic Header

Phoca PDF - creating PDF documents in Joomla! CMS
jmes91
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 06 Jun 2015, 00:04

PDF Dynamic Header

Post by jmes91 »

Hi,

I currently run multiple layouts, with different logos, based upon the user's URL (using Virtual Domains to set Access Levels).

My question is, is there any way of producing a PDF of an article, and including the set logo on the page? As the articles are used on multiple pages, but under different logos.

Help would be greatly appreciated!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: PDF Dynamic Header

Post by Jan »

Hi, you can set the logo in options, but not dynamically, so this needs to be directly customized (directly for each article) in the php code :idea:

Jan
If you find Phoca extensions useful, please support the project
kiran.cheema@nhs.net
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 16 Jun 2015, 14:48

Re: PDF Dynamic Header

Post by kiran.cheema@nhs.net »

I have just done this ... There may be a better way but this has worked for me !

In the Content.php plugin :
round about line 40 - in the onBeforeCreatePDFContent section
add in

Code: Select all

$content->header_logo="";
		$app             = JFactory::getApplication();
		$tparams = $app->getTemplate(true)->params;
		if ($tparams[logoFile])
			{
                             $logo ='<img src="'.$tparams[logoFile].'" alt="" height="40" />';
			}else {$logo = "";}
		$content->header_logo		=  $logo;
You will need to change [logoFile] to whatever it is in your template, the standard protostar uses [logoFile]

and then around line 117 (onBeforeDisplayPDFContent) in the

Code: Select all

 if ($content->header_data != ' ')
section add the following:

Code: Select all

$content->header_data = str_replace('{phocapdflogo}',$content->header_logo,$content->header_data);
this will now allow you to use the {phocapdflogo} tag in the header editor alongside {phocapdftitle} and {phocapdfheader}
jmes91
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 06 Jun 2015, 00:04

Re: PDF Dynamic Header

Post by jmes91 »

Cheers Kiran, you should work with us on our site at some point! SCW could do with someone like you ha
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: PDF Dynamic Header

Post by Jan »

Hi,thank you for the guide.

Jan
If you find Phoca extensions useful, please support the project
Post Reply