We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Problems with parameters and self-created plug-in

Development and Programming

McKracken's avatar
McKracken
2 posts
17 years ago
McKracken's avatar McKracken

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.

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
17 years ago
Ingmar Greil's avatar Ingmar Greil

You probably want to escape your quotes. addslashes() might be a quick way of doing that.

       
Mogra's avatar
Mogra
19 posts
17 years ago
Mogra's avatar Mogra

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&#40;"pdf/".$pdf_filename.".pdf",'r'&#41; == FALSE&#41; //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&gtClicca">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…

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.