/    Sign up×
Community /Pin to ProfileBookmark

unexpected $ with fpdf

Hi there guys, i got the following problem. Maybe you can help me:

I’d like to write a PDF with some HTML & PHP code. So i figured i’d use fpdf. Here is a a little example of the code:


—————————————————-

<?

$html=””;
$html=<<<PDF_BODY
<table border=”0″ cellspacing=”0″ cellpadding=”0″ width=”600″>
<tr>
<td>
<table border=”0″ cellspacing=”0″ cellpadding=”10″ width=”100%”>
<tr>
<td width=”100%” valign=”top”>
<table cellpadding=”0″ cellspacing=”0″ border=”0″ width=”100%”>
<tr>
<td class=”title”><font class=”title”>{$productlang[‘name’]}</font><td>
</tr>
<tr>
<td height=”10″></td>
</tr>
<tr>
<td>{$description}</td>
</tr>
PDF_BODY;
if ($properties&&{$product[‘has_properties’]}){
$html.=<<<PDF_BODY
<tr>
<td>
<table border=”0″ cellpadding=”0″ cellspacing=”0″ width=”100%”>
<tr>
<td nowrap><font>{$_TEXT[‘techdata’]}:</font></td>
</tr>
<tr>
<td>
<table cellspacing=”0″ cellpadding=”0″ width=”100%” align=”center” border=”0″>
<tr>
<td><img src=”_
images/spacer.gif” border=”0″ width=”1″ height=”5″></td>
</tr>
PDF_BODY;

// create pdf
$pdf=new PDF();
$pdf->AddPage();
$pdf->SetMargins(20,20,20,20);
$pdf->SetFont(‘Arial’,”, 10);
$pdf->SetTextColor(0,0,0);
$pdf->SetXY(20,50);
$pdf->Ln(35);
$pdf->WriteHtml($html);
$pdf->Ln(25);

$pdf->Output();

?>

The actual script is bigger but it’s too long to post it here. Anyway. Everytimer i try to run the script i get this msg:

Parse error: parse error, unexpected $ in /web/www/eyemedia_ch/clients/public_html/candyhoover.ch/modules/mo_products_print.php on line 177

with line 177 being the last line of the script.

Now i know that this error usually describes a missing { or } or whatever but i double and triple checked the code. Did anyone expirience this problem before?

Thanks in advance for any help

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@artoAug 24.2005 — This one is not closed: [CODE]if ($properties&&{$product['has_properties']})[B]{[/B][/CODE]Also, don't put { } around variables in [I]if[/I] expression. So: [CODE]if ($properties && $product['has_properties']) {
...
}[/CODE]
Arto
Copy linkTweet thisAlerts:
@gnarf32authorAug 24.2005 — thanks for the response. the if clause in the original script is closed. it was just a snipped. anyway. the matter is resolved now. forgot to set some "body_pdf;"s. thanks anyway

cheers

close thread
×

Success!

Help @gnarf32 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...