Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Custom Header Syntax Error  (Read 6841 times)

0 Members and 1 Guest are viewing this topic.

blueberg

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 48
Custom Header Syntax Error
« on: January 21, 2010, 05:38:04 am »

I was attempting to set up a custom header into my Gallery http://birdmarks.com/coppermine

I went to your FAQ's and found the one with the proper syntax to make a custom header> I copied this code directly from your FAQ.
<?php
echo <<<EOT 
Enter your header/footer content here.  What you enter here will be displayedat the top of my page if it is a header and at the bottom of my page if it is a footer. 
EOT;
?>


I pasted this code into a text editor and I substituted the material I wanted displayed in the header into this file and saved it as custom_header.php. Here is the code I ended up with:
<?php
echo <<<EOT 
<table border="0" width="480" height="124">
  <tr>
    <td align="center"><font size="5"><b><font color="#00FF00">
   <img border="0" src="http://www.birdmarks.com/coppermine/themes/natsel/images/headermerged.jpg" width="750" height="90"><br>
   Natural
      Selection<sup>®</sup></font></b><sup><font size="5" color="#00FF00"> </font></sup><font color="#FF9900"><b>Nature
      Photography </b></font></td>
  </tr>
</table> 
EOT;
?>

I uploaded this file into my coppermine root directory http://birdmarks.com/coppermine
I went into my configuration panel and made the relative path to the file  custom_header.php

I then tried to get into my gallery http://birdmarks.com/coppermine to see if I had succeded. Well, I hadn't. Instead I was greeted with the following error message:  Parse error: syntax error, unexpected T_SL in /home/content/b/i/r/birdmarks/html/coppermine/custom_header.php on line 2

But now I can't even get past this error message to get into my configuration panel in order to turn the custom header off.

I am certain that the problem lies within my custom_header.php file, but I don't know how to fix it. Can you please help me fix the custom_header.php file to not only let me get back into my gallery, but also to show the things i wanted to show in my header.

Thansk.

PS. Sorry about the Godaddy banner ad on my site. It is a temporary freebie site I am using until i get the kinks worked out
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Custom Header Syntax Error
« Reply #1 on: January 21, 2010, 07:50:40 am »

There are several issues with this:
  • You probably used an editor that is not fit for editing PHP content. MS Frontpage or MS Word or MS Wordpad fall into the category "not suitable for editing PHP files". Use notepad.exe or one of the surrogate editors discussed in Tools recommended by the devs.
  • On this forum, use the bbcode tag [code] to wrap code block like the one you posted above. This makes your postings better readable and might help us solve your issues - this way, we might have been able to see issues with what you did.
  • There might be issues with white space before or after the closing EOT; command in your code block.
  • Don't use the custom code block at all just to add static HTML to each page. Edit themes/yourtheme/template.html with a plain text editor and add your custom HTML there.
  • Your HTML markup is completely and utterly outdated and deprecated:
    • The <font> tag is deprecated and bad. Use CSS instead
    • The align attribute should not be used. Use CSS instead
    • You can't assign height to a table
    • Always assign an alt attribute to the <img>-tag
    • Always end tags that don't have a closing tag with a slash (<br /> instead of <br> and <img ... /> instead of <img... >)
    • Don't put stuff into a one-cell table; that's of course nonsense. Use a div container instead
    • How should a 750 by 90 pixel image fit into a table that is only 480 by 124 pixels? That's of course nonsense! Create code that makes at least sense in logical terms, or you'll end up with the browser doing "strange" things trying to resolve your logic mistakes.
    • The tag nesting inside the table cell is invalid! Review the structure of HTML
    • The <b>-tag is deprecated. Use <strong> instead or use CSS
  • To fix your issue, delete your custom header file, create an emtpy file with the same name and upload it without editing it. This should make sure that your gallery no longer crashes because of improper PHP coding. Then turn custom headers off in coppermine's config and apply the change to themes/yourtheme/template instead.


Code: [Select]
<table border="0" width="480" height="124">
  <tr>
    <td align="center"><font size="5"><b><font color="#00FF00">
   <img border="0" src="http://www.birdmarks.com/coppermine/themes/natsel/images/headermerged.jpg" width="750" height="90"><br>
   Natural
      Selection<sup>®</sup></font></b><sup><font size="5" color="#00FF00"> </font></sup><font color="#FF9900"><b>Nature
      Photography </b></font></td>
  </tr>
</table>
should become something like
Code: [Select]
<div style="font-size:1.3em;color:green;font-weight:bold;">
    <img src="http://www.birdmarks.com/coppermine/themes/natsel/images/headermerged.jpg" width="750" height="90" border="0" alt="" /><br />
    Natural Selection<sup>&reg;</sup>
    <span style="font-weight:bold;">Nature Photography</span>
</div>
Logged

blueberg

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 48
Re: Custom Header Syntax Error
« Reply #2 on: January 21, 2010, 09:06:20 pm »

Thanks
Logged

blueberg

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 48
Re: Custom Header Syntax Error
« Reply #3 on: January 21, 2010, 10:33:32 pm »

I had relied on Frontpage to make the HTML code. That's where that all came from. But I've been using notepad to do all the other editing.
I appreciate the help. I will avoid the custom header and footer until I know more about PHP. I can edit the template to take care of biz for now. Thanks
Logged

blueberg

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 48
Re: Custom Header Syntax Error
« Reply #4 on: January 21, 2010, 10:35:41 pm »

I'll be using Web Expression 3 for future HTML editing. Maybe that will help bring my HTML out of the stone ages
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Custom Header Syntax Error
« Reply #5 on: January 22, 2010, 08:29:33 am »

I'll be using Web Expression 3 for future HTML editing.
That's MS Frontpage (and for marketing purposes renamed) in disguise. Not a suitable nor recommended editor. I have already posted reference to the editors we recommend in this thread.
Don't trust WYSIWYG editors. You need to know HTML and CSS to use a WYSIWYG editor to iron out the mistakes that those editors make inevitably by manual edits in plain text mode. Good WYSIWYG editors (like DreamWeaver) can be told to leave PHP alone and not try to "beautify" the code if you know your way around, so that editor is not suitable for newbies neither, as you need to know what all of it's options do and subsequently which options to disable in DreamWeaver's config to make it a valid editor for coppermine and similar apps. To name another commercial editor that can be used as well: UltraEdit ($$!) is a fine tool. For a more complete list of free tools that the devs recommend, you're welcome to take a look at "Tools recommended by the devs -> Text editors" from the preliminary documentation for cpg1.5.x that applies in this aspect as well.
Since you don't seem to have the needed HTML skills to perform that last step (ironing out the mistakes) you should not use WYSIWYG editors in the first place, as you don't learn anything when using them: your skills don't improve and you'll be coming up with crappy markup endlessly.

Please resolve your thread.
Logged

blueberg

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 48
Re: Custom Header Syntax Error
« Reply #6 on: January 22, 2010, 11:21:19 am »

Tis true. I've been using Frontpage for a long time. I am not a programmer, so I haven't had to keep up with the changes. I used FP because it was fast and an OK tool at the time. I only use Notepad for anything other than HTNL pages. I figured that would be a safe thing to use. I have bookmarked the page you referenced and I will check out the Dev recommended tools. Thanks for your help
Logged
Pages: [1]   Go Up
 

Page created in 0.028 seconds with 19 queries.