Gossamer Forum
Home : Products : Links 2.0 : Customization :

Need a count of how many e-mail subscribers

Quote Reply
Need a count of how many e-mail subscribers
Need a count of how many e-mail subscribers when selecting the newsletter option.
I thought I had a way, but it doesn't seem to be using arrays to store the addresses.

Thanks,
Derek
Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
I figured it out. If anybody wants it, just post here.
Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
Post away, I am not ready to mail any letters yet but I think it will be useful. If it is not trouble, please post the mod/code.

Thanks
Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
Ok, here it is:

In admin_html.pl in sub html_mail_update
right after
# Figure out who we are mailing to.
Type:

Code:
$numemail=0;
open(LIST,"$db_email_name");
@addresses=<LIST>;
close(LIST);
$numemail = push(@addresses);

than in the same sub a little lower where it
says
Code:
<p><$font>Mail to subscribers:<br>$subscribers</font></p>
Change to:
Code:
<p><$font>Mail to <font color="Red"><b>$numemail</b></font> subscribers:<br>$subscribers</font></p>
It doesn't have to go there or look like that, but you get the idea.
Any questions, just post here.
Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
Hi,
Cool! Works great!

It is slightly different in version 2, so if anybody is using that and can't work out how to add this mod, reply and I'll stick it here Smile

------------------

Robbo
www.Tobia.com
Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
It is slightly different in version 2.
========
Robbo,

Let's see it (I am using 2.0)

Thanks
Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
This is for 2.0, I have never had 1.0 so I don't know if it works there or not.

Derek
Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
 
Quote:
$numemail = push(@addresses);

According to my perl book, this will return the number of items in an array, so the push shouldn't be necessary:

Quote:
$numemail = @addresses;

If my book is incorrect, would someone please let me know. The book is "Using Perl 5 for Web Programming, Special Edition".
Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
Yes that works too. I'm just a novice with Perl and it worked, and you know what they say "if it works, don't fix it".

Derek
Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
Thanks everyone.
Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
it worked after i changed the code to what bobsie said.
Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
Great mod.

BTW:

Quote:
"if it works, don't fix it".

is inaccurate.

It should be

"If it ain't broke, why fix it."

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited July 18, 1999).]

[This message has been edited by Eliot (edited July 18, 1999).]
Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
it's not working for me. i do not see the total# anywhere. i send an e-mail and still do not see it. i'm not getting any error either
Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
Hey Guy,

You must have misstyped something somewhere.
I just tried it and it works fine for me.

You should see how many there are when you click the "Newsletter" link in your admin page.

Chet

------------------
Webmasters get a sponsor for your website. Over 350 to choose from.
cbrzez.hypermart.net

Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
Hi!

I tried it and it works great (the Bobsie way).

Is it possible to make this number also appear in the MAIN Admin page, so when you enter you have an idea of how many people added themselves to the mailing list?

Also a question: how does the updates list exactly work? How often contents sent to members are changed/removed? Each day? Every time u build pages?

Thanks!


------------------
Alex Tutusaus
Atyc WebDesigns
http://www.webcamworld.com/
Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
What's with "the Bobsie way". It works the exact same way. The only thing missing is push() it still works if you add it, and if it doesn't, than you did something wrong. It's just an extra step that is not needed.

Anyway, if you want to add the count right on the admin page do this.
Find this in admin_html.pl
Code:
sub html_navigation {
# --------------------------------------------------------
# Prints the navigation links.
#

# add this code
$numemail=0;
open(LIST,"$db_email_name");
@addresses=<LIST>;
close(LIST);
$numemail = @addresses;


Than find this a little lower
Code:
<a href="$db_script_url?db=links&html_mail_update=1">Newsletter</a><br>

and replace it with this
Code:
<a href="$db_script_url?db=links&html_mail_update=1">Newsletter</a>[<font color="Red">$numemail</font>]<br>

That'll do it. One less click to find out how many subscribers now. Smile

Derek
Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
may be on your server, both ways worked but on my server it only worked when i did the bobsie way
Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
I just posted a quirk with perl5xxxx (don't remember it all)

But I had the same line of code evaluated two different places in two different ways.

Remember, the more exact you make it, and the less equivocal, the better (usually).

@array when evaluated in a scaler context:

$array_size = @array

will evaluate to the number of elements in @array

That's the simplest, most correct 'perl-ish' way of doing it, since that's the data type definition.

FWIW ....


Quote Reply
Re: Need a count of how many e-mail subscribers In reply to
Hey Predator!

Thanks! WOrked great!

Keeprollin'!


------------------
Alex Tutusaus
Atyc WebDesigns
http://www.webcamworld.com/