Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 08-05-2004, 09:35 AM   #1
Groove
Confirmed User
 
Join Date: Jan 2003
Posts: 3,852
Programmers, how can I do this?

I want to use CityDesk, a desktop content management program:

http://www.fogcreek.com/CityDesk/

to manage some static HTML freesites.

However CityDesk adds a metatag to all pages which I want to get rid of.

I could publish the pages locally, do a search and replace, then upload to the servers. But it would be MUCH more efficient to do an automated search and replace on the servers.

Would it be difficult to write a server-side script that deletes the metatag from all pages, bearing in mind that these pages will published across multiple domains and multiple virtual hosts? Also please note that I'd prefer to run the script on demand rather than as a CRON job.

If this is something that you could write for me, please describe your proposed solution and provide a ballpark cost.
Groove is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-05-2004, 06:13 PM   #2
Groove
Confirmed User
 
Join Date: Jan 2003
Posts: 3,852
Bump
Groove is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-05-2004, 06:50 PM   #3
grumpy
Too lazy to set a custom title
 
grumpy's Avatar
 
Join Date: Jan 2002
Location: Holland
Posts: 9,870
download the stuff...multifile replace and upload the stuff.
But arent those pages generated on the fly...meaning they would have to modify there script?
__________________
Don't let greediness blur your vision | You gotta let some shit slide
icq - 441-456-888
grumpy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-05-2004, 06:51 PM   #4
grumpy
Too lazy to set a custom title
 
grumpy's Avatar
 
Join Date: Jan 2002
Location: Holland
Posts: 9,870
im downloading the demo now to see what the options are.
__________________
Don't let greediness blur your vision | You gotta let some shit slide
icq - 441-456-888
grumpy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-05-2004, 06:56 PM   #5
grumpy
Too lazy to set a custom title
 
grumpy's Avatar
 
Join Date: Jan 2002
Location: Holland
Posts: 9,870
see what you mean
__________________
Don't let greediness blur your vision | You gotta let some shit slide
icq - 441-456-888
grumpy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-05-2004, 10:07 PM   #6
Intrigue
Confirmed User
 
Join Date: Feb 2004
Location: Ohio, US
Posts: 662
Your best bet's probably a perl script you can run via cgi, to go through the files, and use a regex on each one. If you want me to do it, you'll have to get ahold of our sales guy:

AIM: Avanteguard
MSN: matt [ at ] imadigan.com
Email: matt [ at ] imadigan.com
ICQ: 314942262

and he'll take care of you.
Intrigue is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-05-2004, 10:45 PM   #7
Betray
Confirmed User
 
Join Date: Oct 2002
Location: Toronto
Posts: 346
^^^ exactly what he said, this would be your best bet.. but you would still have to run the script everytime you want to update it. unless you put the script on a timer ;)
Betray is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-05-2004, 10:48 PM   #8
Varius
Confirmed User
 
Industry Role:
Join Date: Jun 2004
Location: New York, NY
Posts: 6,890
If you're in UNIX, you can just have a script using "rep" on files you upload.

If Windows, I dunno maybe a .bat file?
__________________
Skype variuscr - Email varius AT gmail
Varius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-06-2004, 12:07 AM   #9
Groove
Confirmed User
 
Join Date: Jan 2003
Posts: 3,852
Quote:
Originally posted by Varius
If you're in UNIX, you can just have a script using "rep" on files you upload.

If Windows, I dunno maybe a .bat file?
All servers will be Unix of some description.
Groove is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-06-2004, 12:11 AM   #10
Varius
Confirmed User
 
Industry Role:
Join Date: Jun 2004
Location: New York, NY
Posts: 6,890
Quote:
Originally posted by Groove
All servers will be Unix of some description.
Ok, so you have few options:

1 - crontab script, but you said you wanted to avoid that

2 - get your server to execute a script whenever 'x' is uploaded. Probably the most complicated as you have to hack some sources and recompile stuff.

3 - have script you run manually. Just make a super easy shell script that will execute rep.

ie.

#!/bin/sh

rep -R 'metag tag line' '' /dir/*
__________________
Skype variuscr - Email varius AT gmail
Varius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-06-2004, 12:14 AM   #11
Groove
Confirmed User
 
Join Date: Jan 2003
Posts: 3,852
Quote:
Originally posted by Betray
....but you would still have to run the script everytime you want to update it. unless you put the script on a timer ;)
Actually giving it a bit more thought... a CRON job may not be such a bad idea. It could be configured to run hourly, but only process files added since the last run.
Groove is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-06-2004, 12:19 AM   #12
iwantu
Confirmed User
 
Join Date: Aug 2004
Location: IwantU.com
Posts: 570
Use this script

You owe me NOTHING!



sub replace;

$recursive = 0;

sub Printmenu {
print "Usage is: recureplace [option] 'find text' 'replace text' file1 file2 ... \n\n";
print " Replace the specified text in the specified files.\n\n";
print " options are:\n";
print " -e file_extension to replace word only in files matching the\n";
print " extension\n";
print " -R Recursive Perform recursively the replacement on all the\n";
print " files of all directories\n";

exit;
}


while ($ARGV[0] =~ /^-/) {
if ($ARGV[0] eq "-R") { $recursive = 1;}
elsif ($ARGV[0] eq "-e") { shift; $extension = $ARGV[0];}

shift;
}
if (($ARGV[0] eq "") ||
($ARGV[1] eq "")) { &Printmenu;}

$find_txt = $ARGV[0]; shift;
$replace_txt = $ARGV[0]; shift;

&find('.');

[zeus@baileys (Aug 06 - 3:17am) - /home/zeus] ls -la /usr/local/bin/rep
-rwxr-xr-x 1 root wheel 2386 Jul 1 2002 /usr/local/bin/rep
[zeus@baileys (Aug 06 - 3:17am) - /home/zeus] more /usr/local/bin/rep
#!/usr/bin/perl

sub replace;

$recursive = 0;

sub Printmenu {
print "Usage is: recureplace [option] 'find text' 'replace text' file1 file2 ... \n\n";
print " Replace the specified text in the specified files.\n\n";
print " options are:\n";
print " -e file_extension to replace word only in files matching the\n";
print " extension\n";
print " -R Recursive Perform recursively the replacement on all the\n";
print " files of all directories\n";

exit;
}


while ($ARGV[0] =~ /^-/) {
if ($ARGV[0] eq "-R") { $recursive = 1;}
elsif ($ARGV[0] eq "-e") { shift; $extension = $ARGV[0];}

shift;
}
if (($ARGV[0] eq "") ||
($ARGV[1] eq "")) { &Printmenu;}

$find_txt = $ARGV[0]; shift;
$replace_txt = $ARGV[0]; shift;

&find('.');

sub find {
local($dir,$nlink) = @_;
local($dev,$ino,$mode,$subcount);

($dev,$ino,$mode,$nlink) = stat ('.') unless $nlink;

opendir(DIR,'.')|| die "Can't open $dir";
local(@filenames)= readdir(DIR);
closedir(DIR);

if (!($recursive)) {
@filenames = @ARGV;
}

$subcount = $nlink - 1;
for (@filenames) {
next if $_ eq '.';
next if $_ eq '..';

$name= $_;

if (!(-d $name)){
if ($extension ne '') {
next if (!(m/.*\.$extension$/i))
}
replace($name);
}
next if $subcount hahahaha0;

($dev,$ino,$mode,$nlink) = lstat($_);
next unless -d _;

if ($recursive) {
print "\nDirectory: $dir/$name\n";
chdir $_ || die "Can't cd to $name";
&find($name,$nlink);
chdir '..';
--$subcount;
}
}

}


sub replace {
local ($filename)= @_;

if ((-r $filename) && (-w $filename) && (-s $filename)) {
$size = (-s $filename);

print "Replacing $find_txt by $replace_txt in $filename ($size)\n";

open(FILE,"<$filename");
read(FILE, $file_text, $size, 0);
close(FILE);

$file_text =~ s/$find_txt/$replace_txt/g;

open(FILE,">$filename") || die "Could not create $filename\n";
print FILE $file_text;
close(FILE);
}
else {
print "I have no right to modify $filename";
}
}
__________________


$100 PPS Promotion



--------
Michael M
ICQ: 551-376
http://affiliate.IwantU.com
Our members get laid, our affiliates get paid
iwantu is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-06-2004, 01:58 AM   #13
Groove
Confirmed User
 
Join Date: Jan 2003
Posts: 3,852
Quote:
Originally posted by iwantu
Use this script

You owe me NOTHING!


Many thanks!

Any chance of a brief description of what it does?
And installation/configuration requirements?
Groove is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-06-2004, 04:58 AM   #14
arachnO
Confirmed User
 
arachnO's Avatar
 
Industry Role:
Join Date: Jan 2004
Location: Cyprus
Posts: 1,327
Quote:
Originally posted by Groove
And installation/configuration requirements?
I think you don't need anything to use this script cause Perl is standart application for all *nixes.
arachnO is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-06-2004, 06:56 AM   #15
grumpy
Too lazy to set a custom title
 
grumpy's Avatar
 
Join Date: Jan 2002
Location: Holland
Posts: 9,870
http://discuss.fogcreek.com/citydesk...68&ixReplies=1

I just asked them... there is your answer. So next time i think ist easier when you ask their support :-)
__________________
Don't let greediness blur your vision | You gotta let some shit slide
icq - 441-456-888
grumpy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-06-2004, 08:23 AM   #16
Groove
Confirmed User
 
Join Date: Jan 2003
Posts: 3,852
Quote:
Originally posted by grumpy
http://discuss.fogcreek.com/citydesk...68&ixReplies=1

I just asked them... there is your answer. So next time i think ist easier when you ask their support :-)
Many thanks for posting the question

But I DID ask Fog Creek support prior to posting on GFY and they replied:

Quote:
That tag is not merely cosmetic, it serves a purpose:

http://www.fogcreek.com/CityDesk/kb/...EveryFile.html

You would need to remove it from the published files
The response to your question (which I suspect was posted by a user) is a little more helpful than the one Fog Creek gave me. But it doesn't tell me how to "post-process your output HTML files before they're uploaded to the server". So I've posted a follow-up question.

Last edited by Groove; 08-06-2004 at 08:24 AM..
Groove is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.