Page 1 of 1
PDF Dynamic Header
Posted: 06 Jun 2015, 00:07
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!
Re: PDF Dynamic Header
Posted: 10 Jun 2015, 00:55
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
Jan
Re: PDF Dynamic Header
Posted: 16 Jun 2015, 15:16
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}
Re: PDF Dynamic Header
Posted: 16 Jun 2015, 23:22
by jmes91
Cheers Kiran, you should work with us on our site at some point! SCW could do with someone like you ha
Re: PDF Dynamic Header
Posted: 22 Jun 2015, 00:07
by Jan
Hi,thank you for the guide.
Jan