Hi to all! I’ve a problem with my plug-in. I made a plug-in to create pdf file from text stored as weblog:entries. Now, the problem arise when i have some <a> tag into my text. The usage of my plugin is: {exp:create_pdf title="{title}” text=”{content}” author=”{author}”}
Then, if my {content} has <a> tags, when expeng passes it as parameter to the plugin, it passes only the text until the first , then stop it. So a text like:__
"Bla bla bla bla bla bla bla <a href="">bla bla</a> bla bla one two three bla"
results to be, after the “passing”:
""Bla bla bla bla bla bla bla <a href="">"
And this cause me some problem. I can i solve this? Thank you
Moderators note: Moved to Plugins.
You probably want to escape your quotes. addslashes() might be a quick way of doing that.
Hi…i’m always mckracken…i found problem posting replies in this forum section, so i asked a friend’s account to do it. Ok, the problem are the quotes, but even using addslashes() i’m not able to solve it. Then, i post my code, hoping someone can help me.
<
pre>function Create_pdf()
{
global $TMPL;</p>
<pre><code> //recuper il titolo dell'articolo, il test, l'autore e il nome con cui chiamare il file
$pdf_title = $TMPL->fetch_param('titolo');
$pdf_text_html = addslashes($TMPL->fetch_param('text'));
$pdf_author = $TMPL->fetch_param('author');
$pdf_filename = $TMPL->fetch_param('filename');
require('fpdf/html2pdf.php');
if(@fopen("pdf/".$pdf_filename.".pdf",'r') == FALSE) //provo ad aprire il file .pdf. Se non esiste, lo creo
{
$pdf=new PDF();
$pdf->SetCreator("HTML2PDF");
$pdf->SetTitle($pdf_title);
$pdf->SetAuthor($pdf_author);
$pdf->AddPage();
$pdf->SetFont('Arial','B',22);
$pdf->MultiCell(0,9,$pdf_title,0,1);
$pdf->SetFont('Arial','',16);
//if(ini_get('magic_quotes_gpc')=='1')
//$pdf_text = stripslashes($pdf_text_html);
$pdf->WriteHTML($pdf_text_html);
$pdf->SetFont('Arial','I',16);
$pdf->Cell(0,6,$pdf_author,0,0,'R');
$pdf->Output('pdf/'.$pdf_filename.'.pdf','F');
header('Location: '.$pdf_filename.'.pdf');
exit;
}
$this->return_data = "<a href="http://example.com%22>Clicca">four</a> five six seven
Then, i have to think that when it is passed to the php, expeng add the quotes and it becomes
"One two three <a href="http://example.com">four</a> five six seven"
then you can see the error that occurs…and addslashes in that point of code doesn’t help me…
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.