Archive for June, 2011

How to Remove Home in the Title of New Coppermine Gallery

June 30th, 2011 No comments

Edit include/

Find the function and modify as follows

function theme_page_title($section)
global $CONFIG;
$return = strip_tags(bb_decode($section)) . ' - ' . $CONFIG['gallery_name']; // original code
$return = $CONFIG['gallery_name']; // Section removed
return $return;

this change works for cpg1.5.x

Categories: Coding Tips, PHP Tags:

Using Perl for Complex Edits

June 24th, 2011 No comments

All I use Vim 99% of the time whenever I want to do a really complex multiple edit I tend to use Perl.

So what’s the script doing ? It reads in one text file line by line and then operates on certain lines , and then writes out each line to an output file. You are only limited by your imagination as to what you do in the loop.

With a Perl script you can use Perl variables for counts, you can use a hash to store all the text and loop through it as often as required.

# description : Use for complex edits on a single file, adapt as required
# this trivial example is just incrementing a count
# zzapper
# v1.0
if ($#ARGV >= 0) { $file = $ARGV[0]; }
print "enter file:"; $file=;
chomp $file;
open (R,"$file") or die ("could not open $file ($!)");
$out = "c:/aaa/out.txt";
$out = "$file.txt";

open (W,">$out") or die ("could not open $out ($!)",__LINE__);
for $l ()
$l=~s/david1/david$cnt/gi; # do what you want here
print W $l;
close W; close R;
print "\nOutput in cnt: $cnt :: $out\n";

Categories: Coding Tips, vim Tags: