Template Parse Error SMF - php

I'm trying to add wikiplayer to my SMF Forum but I'm having a little trouble.. I'm trying to put this in my index.template.php:
<!-- Wikplayer http://www.wikplayer.com -->
<script type="text/javascript" src="http://www.wikplayer.com/code.js"
data-config="{'skin':'skins/wikfull/plainBlack/skin.css','volume':50,'autoplay':true,'shuffle':true,'repeat':1,'showcomment':false,'marqueetexton':true,'placement':'bottom','showplaylist':false,'playlist':[{'title':'It%27s%20The%20Most%20Wonderful%20Time%20Of%20The%20Year','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DgFtb3EtjEic'},{'title':'All%20I%20Want%20For%20Christmas%20Is%20You','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DyXQViqx6GMY'},{'title':'Let%20It%20Snow','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DmN7LW0Y00kE'},{'title':'Jingle%20Bell%20Rock','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DitcMLwMEeMQ%23t%3D36'},{'title':'Driving%20Home%20For%20Christmas','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DczhZbqpyBm8%23t%3D27'},{'title':'Merry%20Christmas%20Everybody','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D0A8KT365wlA'},{'title':'Winter%20Wonderland','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DSHE0Jo82_34%23t%3D56'},{'title':'Santa%20Baby','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dg7T0IK99ELs'},{'title':'It%27s%20Beginning%20To%20Look%20Alot%20Like%20Christmas','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DcHh7pW29Fy8'},{'title':'Christmas','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D5aw2yuYAKoE'},{'title':'Jingle%20Bells','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DVKtOBLvPs5Q'},{'title':'Run%20Run%20Rudolph','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dl849CulLhGQ'},{'title':'Baby%20It%27s%20Cold%20Outside','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D2Rhvtzzmq-Y'},{'title':'Rocking%20Around%20The%20Christmas%20Tree','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DbnIqLlBwzrc%23t%3D15'},{'title':'Silent%20Night','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DPGjByOI9Iqw'},{'title':'Holly%20Jolly%20Christmas','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DKjiMMDZoKmY'},{'title':'Have%20Yourself%20A%20Merry%20Little%20Christmas','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DnZ6yQgBvuoI'},{'title':'Santa%20Claus%20Is%20Coming%20To%20Town','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DSnA52s7qceM'},{'title':'Last%20Christmas','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DE8gmARGvPlI'},{'title':'Merry%20Christmas%20Everyone','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D5PkUWkxGWj0'},{'title':'Shake%20Up%20Christmas','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJ-8VCL4uSUc'},{'title':'Deck%20The%20Halls','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D3-ykZUb3AEE'},{'title':'Carol%20Of%20The%20Bells%20(Pentatonix)','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DVOGByYObUqE'},{'title':'Rudolph%20The%20Red%20Nose%20Reindeer','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D0byH9h1ClBY'},{'title':'The%20Christmas%20Song','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DSOszvL9lgSs'},{'title':'I%20Wish%20It%20Could%20Be%20Christmas%20Everyday','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DZoxQ4Ul_DME'},{'title':'Do%20They%20Know%20It%27s%20Christmas','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1AcD7hho9fs'},{'title':'Feliz%20Navidad','url':'http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQ6ziiLE92Zg'}]}" ></script>
<!-- Wikplayer code end -->
But I'm getting this parse error all the time:
Template Parse Error!
There was a problem loading the /Themes/zone99/index.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.
You may want to try to refresh this page or use the default theme.
syntax error, unexpected T_STRING, expecting ',' or ';'
If I add this code outside the ?> right at the end it will work but then all the forum fonts seem bigger, too big... Can anyone guide me in simple terms to solve this problem? Thank you!
Also I will include my index.template.php # https://www.mediafire.com/?vj0jpbn7cae9of0

As you are getting parse error. That means you are missing colon ; or apostrophe ' somewhere. look for these if the problem persists try writing the script inside an echo statement.
echo '<script> your script here</script>'

Related

How to debug errors in Laravel like unexpected ';'

I have started learning Laravel from last few days and during the course I keep getting errors like
unexpected ';'
below is the detailed error
FatalErrorException in
home/ubuntu/workspace/storage/framework/views/d54ff8380f369dc8c9bc785ef2c17d66e0f399b3.php line 10: syntax error,
unexpected ';'
Though I was able to find the cause of the error,
which was again because of one typographical mistake in one of my view file i.e. create.blade.php .
My question is how to debug similar kind of error in large projects as error don't points out the exact file-name where syntax error was happening though the line number mentioned was the correct one ?
Please do let me know if I am not clear in my above question.
P.S. I checked the logs as well and it says the same thing.
Thanks in advance,
Sambhav
Well, this error is difficult to find when you are starting with laravel, or even worst, when you have kilometers in laravel but have a tons of view compiled at the same layout.
Generally this errors comes when you put a semicolon in blade syntax like this:
#if($something == true)
// code here
#endif;
See the semicolon at endif? well, that breaks laravel's view. Another classic is:
#lang('app.hello');
or
#endforeach;
You need to review in that keywords if it has semicolon at the end. What I do sometimes is to call the views individually to isolate the error, it is easiest to find the error when you find the view in concrete. Why laravel does not display the current line number in the view where the errors is jumping? This is because laravel at first place compile blade syntax into html file, this file is cached to increase response's speed. So, laravel will compile even types like these exists;

(PHP,xampp) syntax error in every code I test

I get a " Parse error: syntax error, unexpected" error for whatever I print.
The error "Parse error: syntax error, unexpected '"test"' (T_CONSTANT_ENCAPSED_STRING) in C:\xampp\htdocs\firstfile\test.php on line 3"
The code I tested
<?php
 echo 'test';
 
?>
A basic code, but the error persist.
How to solve this problem?
Could it be that what you posted is not the actual file that is executed? Certainly that file is fine syntactically, so there must be some stupid mistake somewhere. I see that the faulty file is inside a folder firstfile. You are really sure this posted file is that file inside the folder?
What is especially outstanding here are the double quote chars in the error message which simply are not present in the file you posted.
When an error like this remains unchanged whatever you do, then typically you edit the wrong file.

Syntax error in printing image pointing to a link in php

The following line is supposed to print a list item which is a variable picture that points to a variable link
echo '<li><a href='http://www.twitter.com/'".$person."'>
<img src ="'.$person.'.jpg'.'"/></a></li>';
I am getting the following error though
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';'
I am pretty sure I've screwed up the syntax in the a href part as I'm not quite sure how to handle the variables in the URLs...
Help is appreciated....Thanks!
Just use variable interpolation there.
echo "<li><a href='http://www.twitter.com/$person'><img src='$person.jpg'/></a></li>";
Why did you change the quote lol
echo "<li>
<a href='http://www.twitter.com/'".$person."'>
<img src ="'.$person.'.jpg'.'"/>
</a>
</li>";
Try using printf/sprintf; these two functions will make it a lot easier to deal with modifications to your code in the future as well as make it so that you're not "jumping in" and "jumping out" of quote sections a lot. It's a great way to avoid these kind of syntax problems with inline variables in double-quoted strings.
EDIT: The doc pages:
http://us3.php.net/manual/en/function.sprintf.php
http://us3.php.net/manual/en/function.printf.php

Issue with dynamically generated javascript link with PHP

example link
returns PHP error:
syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';'
Any ideas? (Hope this question makes sense. I'm trying to fix someone else's code.)
Check that there's not a "<?" or "<?php" at the beginning of the file. This code assumes you're not already within a PHP block. If you are, then you'll have to adjust (remove it). Or, you'll need to add close ?> somewhere before this html, and a <?php after it...
Sorry about that guys, the problem was <?php echo val;?> instead of <?php echo $val;?>. Sometimes the eyes betray the mind...

T_STRING error on line that just says <?php

So I'm writing a script in codeigniter, and I get the following error message:
Parse error: syntax error, unexpected T_STRING in /home/globalar/public_html/givinghusband.com/system/application/controllers/sizes.php on line 1
the only problem: the only thing on that line is this:
<?php
So I'm quite mysterified as to what's going on here? Have I typed PHP wrong or what?
There could be a problem with your editor when it updated the file. I just had this problem and the editor removed all line breaks.
If you are uncertain try opening your php file in another editor or use the Cpanel file manager to take a peak.
Or you may have an unterminated quote or statement on some previous line without an ending semicolon (;) . Check all files that are included before this one.
a bare <?php in the file leads to a parse error in php (don't ask). Try adding a whitespace or a newline after it
Sorry.A bit late but might helpful for others.Just looked at your question.Just use
<?
?>
instead of :
<?php
?>
and remove whitespaces/line breaks between your php open tag and class name .It will resolve this conflict.Ta

Categories