I have been racing my brain trying to figure out the error in this code..I have gone through line 91 multiple times...including the code before to ensure it wasn't causing the line 91 error. I used multiple php error tools but cannot work out the bugs. I could really use some help with this. I appreciate any insight.
PHP Code:
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ // +----------------------------------------------------------------------+ // | PHP version 4/5 | // +----------------------------------------------------------------------+ // | This source file is a part of iScripts Multicart | // +----------------------------------------------------------------------+ // | Authors: Programmer<programmer@armia.com> | // +----------------------------------------------------------------------+ // | Copyrights Armia Systems, Inc and iScripts.com � 2005 | // | All rights reserved | // +----------------------------------------------------------------------+ // | This script may not be distributed, sold, given away for free to | // | third party, or used as a part of any internet services such as | // | webdesign etc. | // +----------------------------------------------------------------------+ $Current_page = basename($_SERVER['PHP_SELF']);
Doesn't say much does it. You've seen those magic words and typed those and only those. You need to paste the actual complete error for us to help you properly.
One thing I will say, is that you are missing a few ; symbols - especially before your closing ?> tags.
This is one here:
<?php echo SITE_URL?>
Should be:
<?php echo SITE_URL; ?>
Note that there must be a space between ; and ?>. In other words it must be ; ?> and NOT ;?>
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
Thank you for the info. The error says an unexpected "." on line 91.. In looking at the code in dreamweaver it seems to be the same error for multiple parts in the code. This is where it is showing the first error
Look at the end of that line:
;?>
I told you that you need spaces there. In your text editor, use the replace function to replace:
;?>
with
; ?>
I think thats fairly simple no?
As for the rest.. your use of file_get_contents() is wrong. Look at the double quotes you're using:
file_get_contents(""../themes/".$active_template[4]")
Your quotes are messed up.
,'.subheading'))[2])[1],0,strlen(explode("background-color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]")
Again, bad quotes.
Your code is full of errors like that. You're using two double quotes where there should only be one (and realistically they should be single quotes) and then not using them where you should.
When you write a function call, you should be doing it like this:
file_get_contents();
Then fill in the information inside it - start with quote marks:
file_get_contents("");
Now do the rest:
file_get_contents("../themes/{$active_template[4]}");
Why do it like that? Because it ensures that you put in a beginning AND end ( and ), " and ", ' and ' etc. Then you go back into the middle and put in the rest of your information such as the file path. If you don't use this technique, you'll forget to terminate strings and functions properly.
Also you have one very long line of confusing php code there. You shouldn't mix php into html and css like that. It's messy, confusing and hard to debug (as you've found out). You should be keeping your php seperate and at the very least, at the top of your html / css before the <head> tag. Process your data and then put it into your html.
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
Single line PHP code doesn't require the semi-colon at the end. The space at the end also won't make a difference. Come to think of it, the semi-colon isn't required on the last instruction in PHP at all. Although I'd recommend consistently using it.
That is a disastrous block of PHP code. You can write a function for it, but you'll need to normalize the structure in some way. The calls you have here are fairly consistent for the offsets accessed, but not always consistent which is a pity. If you could make it consistent, separating it out into a function of its own will make the calling code a lot more simple to read. Assuming that the template doesn't change either, you can use a static variable within your function to effectively cache the result from a previous lookup (no need to keep checking the file for data that hasn't changed).
Single line PHP code doesn't require the semi-colon at the end. The space at the end also won't make a difference. Come to think of it, the semi-colon isn't required on the last instruction in PHP at all. Although I'd recommend consistently using it.
Hmm I thought the space did make a difference? I'm sure I had problems with it in the past. I know at the front / beginning end it does and had assumed it was the same at the end too
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
Beginning definitely needs the space, but best I know the end has never required it.
Soon we'll be able to use the inline echo with <?= regardless of the short_open_tags directive (as of 5.4). These typically don't use semi colons at all: <?=$var?> is how I usually see them. Personally, I hate them. Lol.
I used to love short tags until I had a project which needed a rss feed to be generated by php in the .xml file. Then I realised why some people hate it.. the opening <? for the xml caused me a serious headache until I turned off short tags
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.