View Full Version : Plug-in Error
August 22nd, 2012, 11:42 AM
I added a plug-in and now get an error:
Parse error: syntax error, unexpected $end in /home/stevessg/domains/sirstevesguide.com/public_html/photos/showphoto.php(1569) : eval()'d code on line 1
SDCC - SirStevesGuide.com Photo Gallery (http://photos.sirstevesguide.com/underground-toys/p43243-sdcc.html)
August 22nd, 2012, 11:54 AM
Have you read the plugin tutorial?
I highly suspect you have not followed that you have a parse error in your code.
Your must either escape your quotes like so \" or use ' in your html
You can post in a code box what your trying to do and I will give a comment but overall we do not support code mods.
Your error though clearly shows me you have a parse error in the code your entering.
August 22nd, 2012, 12:38 PM
I provided detailed examples and even sample blocks in the tutorial but lets discuss this so I can get your issue resolved.
Here is a sample block where I use single qoutes in my html so there is no need to escape double qoutes.
$pphook['sidebar_top'] .= "<div class='photoinfo' style='align:center; width:100%'>
<table class='tableborders' border='0' cellpadding='6' cellspacing='1' width='100%' align='center'>
<td width='100%' align='center'>
<div style='font-size:10pt; text-align:left;'>New Plugin</div>
<li>Testing Plugin System</li>
Now here is the same block with the html double quotes escaped
$pphook['sidebar_top'] .= "<div class=\"photoinfo\" style=\"align:center; width:100%\">
<table class=\"tableborders\" border=\"0\" cellpadding=\"6\" cellspacing=\"1\" width=\"100%\" align=\"center\">
<td width=\"100%\" align=\"center\">
<div style=\"font-size:10pt; text-align:left;\">New Plugin</div>
<li>Testing Plugin System</li>
Both are valid and parse fine and are totally XHTML valid.
If you continue to have an issue then post your code here and I will take a quick look at what your doing.
August 22nd, 2012, 02:55 PM
I will try but all I added in the HTML section was "test" (without quotes) so I guess I have to add the:
$pphook['sidebar_top'] .= "...";
August 22nd, 2012, 02:57 PM
August 22nd, 2012, 03:01 PM
BTW - the plug-in system is a great idea and this will save me time from having to deal with the "custom sidebar templates". I would think those would go away soon... ?
August 22nd, 2012, 03:26 PM
The custom pals are an old options correct. No decision has been made on those things.
Actually what got the ball rolling on this was someone requested the ability to add banner ads so I was playing around with things investigated how vb did it and invested a little time.
I posted in my tutorial a couple same blocks although they are based in the standalone html format. It gives you an idea how things are done.
The following would be an example of a sideblock in vb format. I use single quotes in the html so you do not need to escape quotes but here you go.
$newvar = "Testing Plugin System";
$pphook['sidebar_top'] .= "<div class='blockcontainer gshad'>
<div class='sbox collapse'>
<h2 align='left' class='boxhead'><span class='boxtitle'>New Block</span></h2>
<div class='box-body' align='center' id='pp_sideblock1'>
<table class='gridtable hidegrid' align='center' border='0' cellpadding='4' cellspacing='1' width='100%'>
<td valign='top' align='left' width='100%'>
<div class='' style='align:center; width:100%;'>
<table cellpadding='2' cellspacing='1' width='100%' class='tborder'>
<td class='blockrow' align='left'>$newvar</td>
That should give you a jump start in the basics
August 22nd, 2012, 10:49 PM
It's a good start... hopefully you fix it so we don't have to deal with the escaping or apostrophes.
August 23rd, 2012, 08:13 AM
Obviously I can only assume you are kidding!
You must not have looked at a vbulletin plugin or PHP to you make such a comment. If you deal with html in output within PHP you must esacape double quotes. That is not a maybe that is a must. That is one of the first things a newbie learns when trying to code up hacks.
Now the tutorial I posted shows you an alternative to having to escape double quotes in your html by using single quotes.
August 23rd, 2012, 09:27 AM
Not kidding... I know they have to be escaped but I also know I use a number of plug-in on vb where I don't have to do it from my end... ;)
August 23rd, 2012, 10:03 AM
I have written vb plugins any double quotes in html output has to be double escaped that is a PHP law. There is no getting around that. vb plugin sytem works the same way. In fact the very vb plugin tutorials cover the very same point I do. Any html must be escaped or you are in error with PHP.
If I enter a plugin in vb without escaping quotes I get the same error you get on your site trying to enter invalid code. works exactly the same way.
The tutorial is placed in our FAQ forum here for a reason. I am not going to bore people with a long discussion on php law but I do explain the basics there.
vBulletin® v3.8.1, Copyright ©2000-2014, Jelsoft Enterprises Ltd.