Upgrade broke my template Upgrade broke my template
 

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]

Main Menu

Upgrade broke my template

Started by BrianKessler, January 04, 2006, 01:28:54 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BrianKessler

I just upgraded to 1.4.3...  now whenever I (or presumably anyone) cliicks a thumbnail, they see:

Quote
Template error
Failed to find block 'report_file_button'(#(<!-- BEGIN report_file_button -->)(.*?)(<!-- END report_file_button -->)#s) in :

        <tr>
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{THUMB_TGT}" class="navmenu_pic" title="{THUMB_TITLE}"><img src="images/folder.gif" width="16" height="16" align="absmiddle" border="0" alt="{THUMB_TITLE}" /></a>
                </td>
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="javascript:;" onClick="blocking('picinfo','yes', 'block'); return false;" title="{PIC_INFO_TITLE}"><img src="images/info.gif" width="16" height="16" border="0" align="absmiddle" alt="{PIC_INFO_TITLE}" /></a>
                </td>
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{SLIDESHOW_TGT}" title="{SLIDESHOW_TITLE}"><img src="images/slideshow.gif" width="16" height="16" border="0" align="absmiddle" alt="{SLIDESHOW_TITLE}" /></a>
                </td>
                <td align="center" valign="middle" class="navmenu" witdh="100%">
                        {PIC_POS}
                </td>
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{ECARD_TGT}" title="{ECARD_TITLE}"><img src="images/ecard.gif" width="16" height="16" border="0" align="absmiddle" alt="{ECARD_TITLE}"></a>
                </td>
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{PREV_TGT}" class="navmenu_pic" title="{PREV_TITLE}"><img src="images/prev.gif" width="16" height="16" border="0" align="absmiddle" alt="{PREV_TITLE}" /></a>
                </td>
                <td align="center" valign="middle" class="navmenu" width="48">
                        <a href="{NEXT_TGT}" class="navmenu_pic" title="{NEXT_TITLE}"><img src="images/next.gif" width="16" height="16" border="0" align="absmiddle" alt="{NEXT_TITLE}" /></a>
                </td>
        </tr>





Any relatively simple fixes?  Or do I need to scrap my template?

Thanks

-Brian.

Paver

You must have overridden $template_img_navbar in your theme.php but did not include the report_file_button block.  Go to the sample theme's theme.php and look for this block.  Add the block to your theme in the appropriate place.  If you don't want to show any "report file" button, just don't put anything between the BEGIN and END comment tags, but make sure to include those comment tags (for Coppermine's sake).

BrianKessler

Thank you for your response.

Unfortunately, I really don't know much about how the template is supposed to work. 

Can you please tell me how to identify the block I'm looking for and where the appropriate place will be?

And if I do want to show a report file button, what would I put between the BEGIN and END?


Thanks in advance for your help,

-Brian.

Paver

In the documentation, there is a detailed page on how to upgrade your template to 1.4.x.  Click on the documentation button (in the admin menu) and go to the section on upgrading your theme files. 

Did you create your template?  I assumed you had purposefully overridden $template_img_navbar.  In you haven't, I don't have a simple answer without looking at your theme file.  The sample theme has all the functions & variables you can override in its theme.php file.  You don't have to override everything.  Just override what you want to customize for your theme.

BrianKessler

Thanks... will try to figure this out when I get hoime from work.

My theme is somewhat customized... but it is mostly a minor hack of either a template that was included or which I found, when I had more time and energy to play with such things.

If you don't mind taking a look at the files, I could zip them up and upload them somewhere or e-mail them to you...


More  thanks in advance,

-Brian.

Paver

This thread is related to your problem: http://forum.coppermine-gallery.net/index.php?topic=25197.0.

Basically, Coppermine is looking for two tags that define the report_file_button block (the tags are <!-- BEGIN report_file_button --> and <!-- END report_file_button -->) so it can place the report_file_button block in the correct place when it outputs a web page.  If you don't override the variable $template_img_navbar in your theme.php, then the default $template_img_navbar is used which includes these tags and the default report_file_button block.  If you override $template_img_navbar but don't include these 2 tags, then Coppermine chokes on the vacuum you created.  As mentioned in the thread above, if you don't want this block on your web pages, just leave the place between the 2 tags blank; Coppermine will see the tags and realize you don't want any report_file_button block.

The sample theme has a theme.php which includes every variable and function you can override in your theme.  So whenever you have a theme question, check out the sample theme (it is not meant to be used as a display theme - only an example theme for you to copy from).  Search for the part in question, in this case <!-- BEGIN report_file_button --> since your error message mentions that.  Then compare the section in the sample theme to your theme.php.  Understanding what Coppermine is looking for (well discussed in the thread above) is the baseline you need to solve theme problems.  In your case, you probably have $template_img_navbar in your theme.php but are missing the report_file_button block.  I would copy the whole $template_img_navbar definition from the sample theme into your theme.php, then modify it according to your current $template_img_navbar definition.  After modifying it, remove the previous $template_img_navbar definition so you only have one in your theme.php.

Here's the relevant code from the sample theme to your situation:
// HTML template for the image navigation bar
$template_img_navbar = <<<EOT

        <tr>
                <td align="center" valign="middle" class="navmenu" width="48px"><a name="top_display_media"></a>
                        <a href="{THUMB_TGT}" class="navmenu_pic" title="{THUMB_TITLE}"><img src="{LOCATION}images/thumbnails.gif" align="middle" border="0px" alt="{THUMB_TITLE}" /></a>
                </td>
                <td align="center" valign="middle" class="navmenu" width="48px">
                        <a href="javascript:;" class="navmenu_pic" onclick="blocking('picinfo','yes', 'block'); return false;" title="{PIC_INFO_TITLE}"><img src="{LOCATION}images/info.gif" border="0px" align="middle" alt="{PIC_INFO_TITLE}" /></a>
                </td>
                <td align="center" valign="middle" class="navmenu" width="48px">
                        <a href="{SLIDESHOW_TGT}" class="navmenu_pic" title="{SLIDESHOW_TITLE}"><img src="{LOCATION}images/slideshow.gif" border="0px" align="middle" alt="{SLIDESHOW_TITLE}" /></a>
                </td>
                <td align="center" valign="middle" class="navmenu" width="100%">
                        {PIC_POS}
                </td>
<!-- BEGIN report_file_button -->
                <td align="center" valign="middle" class="navmenu" width="48px">
                        <a href="{REPORT_TGT}" class="navmenu_pic" title="{REPORT_TITLE}"><img src="{LOCATION}images/report.gif" border="0" align="middle" alt="{REPORT_TITLE}" /></a>
                </td>
<!-- END report_file_button -->
<!-- BEGIN ecard_button -->
                <td align="center" valign="middle" class="navmenu" width="48px">
                        <a href="{ECARD_TGT}" class="navmenu_pic" title="{ECARD_TITLE}"><img src="{LOCATION}images/ecard.gif"  border="0px" align="middle" alt="{ECARD_TITLE}" /></a>
                </td>
<!-- END ecard_button -->
                <td align="center" valign="middle" class="navmenu" width="48px">
                        <a href="{PREV_TGT}" class="navmenu_pic" title="{PREV_TITLE}"><img src="{LOCATION}images/prev.gif"  border="0px" align="middle" alt="{PREV_TITLE}" /></a>
                </td>
                <td align="center" valign="middle" class="navmenu" width="48px">
                        <a href="{NEXT_TGT}" class="navmenu_pic" title="{NEXT_TITLE}"><img src="{LOCATION}images/next.gif"  border="0px" align="middle" alt="{NEXT_TITLE}" /></a>
                </td>
        </tr>

EOT;


Finally, you might run into more issues related to using an old theme in the current version of Coppermine.  It is strongly recommended that you read the "upgrading your theme" section in the Coppermine documentation (conveniently located in your Coppermine installation, linked from the "Documentation" button in your admin toolbar).

Teach a person to fish . . .

Paver

Reading through your posts in the past (there's a link on your profile page), I see you mentioned in 2004 where you found your template.  I also see you haven't tried to upgrade your 1.3 theme to 1.4 yet.  I assumed you had already read the upgrade documentation (at least briefly) and had this specific question. 

Please take the time to read the upgrade documentation.  1.4 is a very important improvement to the Coppermine system which is well worth the time to upgrade.  Things are much more extensible once you are running in 1.4, as Nibbler mentioned in one of your other threads.

BrianKessler

Thanks for all your responses...  will try to make sense of it all shortly.


As for the fishing metaphor...  I like doing for myself when I'm not dead exhausted, busy with other things, or hoping to find more time to be busy for other things.

Presently I just wanted to upgrade the software running on my website just in case there were any critical vulnerabilities since my last upgrade.


-Brian.

Paver

Understood.  And you're welcome.  We all find ourselves in such situations from time to time.  Unfortunately in this case, you really just have to put the time in to upgrade your theme.  A temporary fix would be to select a default theme like the classic theme.  You'd get the benefits of the new version, a working site, and a reprieve to get some sleep!

BrianKessler

I tried just dropping the suggeeted code onto the theme.php... but that didn't seem to be enough to fix it (end result seemed exactly the same -- I don't know if that will surprise anyone)... which means I'm definately too tired to figure this out right now.

I think I'm going to take your suggestion and revert to the classic... at least until I find a theme that is 1.4 ready that I want to use or canabalize.

But I am glad I took a second to at least look at the code... I know a bit of PHP, but I never saw the "$template_img_navbar = <<<" ...  "EOT;" before...  seems llike a useful tactic to know that I'll need to remember and learn how to use for the future.  SAMS completely left that out of their 24 Hour book.


-Brian.





Paver

Well, a "proper" PHP book would tell you to avoid "echo" like the plague since you can "easily drop in and out of PHP code to include HTML" (paraphrasing).  That's where you usually find the <<< EOT a.k.a. "heredoc syntax".  I'm used to it from Perl which is all about outputting text quickly & easily.

kegobeer

No, a proper PHP book would not tell you to avoid using echo statements.  Heredoc is good for certain circumstances, but it is inefficient to constantly jump in and out of the PHP parser.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

Paver

Hmm, ok.  Good to know.  I kept seeing the "echo" warning, and didn't think to question it.  I'm still learning PHP.  Coming from a Perl background, I had no qualms with echo statements.