HTML comments in theme.php HTML comments in theme.php
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

HTML comments in theme.php

Started by francesca, July 29, 2004, 04:33:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

francesca

Hello everyone  :)

I'm doing some changes in theme.php of the classic theme.
I'd like not to show the default HTML comments like

<!-- BEGIN header -->
<!-- END header -->
<!-- BEGIN thumb_cell -->


but if I delete them, I get errors like:

Failed to find block 'thumb_cell'(#(<!-- BEGIN thumb_cell -->)(.*?)(<!-- END thumb_cell -->)#s)

Is it possible to hide them in some way?

thanx.

poubao

Bonjour,
you don't deléte in red
<!-- BEGIN album_list -->
                <a href="{ALB_LIST_TGT}" title="{ALB_LIST_TITLE}">{ALB_LIST_LNK}</a>
                       <img src="themes/water_drop/images/orange_carret.gif" width="8" height="8" border="0" alt="" />
<!-- END album_list -->

search in the board i have find it ,but i don't remenber where (may be in théme.php) :P
L'incohérence de ceux qui nous dirigent, l'incompétence de ceux qui nous commandent,sont un vibrant hommage pour ceux qui exécutent.
                                          **Général Patton**

Joachim Müller

don't delete the html comments, coppermine will need it. Instead, comment out the stuff that actually displays things. In above example, change it to<!-- BEGIN album_list -->
                 <!--<a href="{ALB_LIST_TGT}" title="{ALB_LIST_TITLE}">{ALB_LIST_LNK}</a>
                        <img src="themes/water_drop/images/orange_carret.gif" width="8" height="8" border="0" alt="" />-->
<!-- END album_list -->


GauGau

aaalexxx

As far as I understand your post you want to get rid of the comments in the output. As you have experienced already this can't be done by removing the comments from the theme file, since Coppermine needs them. What I did in Coppermine 1-2 is, I edited the routine where the template is evaluated.

Open the file /include/functions.inc.php with an editor, look for

// Eval a template (substitute vars with values)
function template_eval(&$template, &$vars)


Below you'll find the following:

{
        return strtr($template, $vars);
}


Change it to:

{
return ereg_replace("<!--([^-]*([^-]|-([^-]|-[^>])))*-->", "", strtr($template, $vars));
}


HTH,
Aleks

PS. Just a suggestion for the developers: How about adding this to the package? Preferreably  with the option to turn it on/off for debugging?

Joachim Müller

that's not what I was suggesting. The comment markers are used by the coppermine theme engine internally. The dev team recommends commenting out links to items the users don't want to appear on their pages (e.g. menu items). Replacing things when the theme get's parsed will even lead to more confusion.

GauGau

aaalexxx

QuoteReplacing things when the theme get's parsed will even lead to more confusion.
That's why I thought of making it optional, but you're probably right anyway ;D

Aleks.