forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Themes/Skins/Templates => Topic started by: francesca on July 29, 2004, 04:33:01 pm

Title: HTML comments in theme.php
Post by: francesca on July 29, 2004, 04:33:01 pm
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.
Title: Re: HTML comments in theme.php
Post by: poubao on July 29, 2004, 10:09:19 pm
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
Title: Re: HTML comments in theme.php
Post by: Joachim Müller on July 30, 2004, 08:50:02 am
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
Code: [Select]
<!-- 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
Title: Re: HTML comments in theme.php
Post by: aaalexxx on August 11, 2004, 11:59:57 pm
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

Code: [Select]
// Eval a template (substitute vars with values)
function template_eval(&$template, &$vars)

Below you'll find the following:

Code: [Select]
{
        return strtr($template, $vars);
}

Change it to:

Code: [Select]
{
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?
Title: Re: HTML comments in theme.php
Post by: Joachim Müller on August 12, 2004, 05:51:58 am
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
Title: Re: HTML comments in theme.php
Post by: aaalexxx on August 13, 2004, 02:27:24 pm
Quote
Replacing 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.