|
Joined: Oct 2000
Posts: 290
Member
|
Member
Joined: Oct 2000
Posts: 290 |
I have been trying to add another icon to the string with the ProfileString and EmailString area, and I have successfully added all the support code. I have a Control Panel area where I can enter the username and a number that corresponds with that user's scrapbook number. The data is entered in the control panel as pipe!!pipe and is written to a file. All that works. Each entry I make is added to a new line in the file and saved. I'm having a problem getting it called up right. Here is the code I use to call the variable ThisScrap:
If you please have a look you will notice that the 4th message has the blue folder for the scrapbook, and he is configured in the control panel. So that one worked. But the following messages ALSO have the blue folder, they ARE NOT configured in the control panel, and the fly-over text belongs to message number 4. Currently, the above code is included in the same area where ThisTitle variable is assigned...but I have tried to place it in ubb_llibrary2.pl with the same results
Please check out the problem HERE!
------------------ Tony (Vipermad) Rickard Viper Club UBB Admin
This message has been edited by Vipermad on January 06, 2001 at 09:29 AM
|
|
|
|
Joined: Feb 2000
Posts: 4,625
Member
|
Member
Joined: Feb 2000
Posts: 4,625 |
HI Viper! You'd probly get more help in the "Perl" forum. ------------------  Modification Developer of the Ultimate Bulletin Board Due to time limitation, I do not offer support Via. E-mail, ICQ or AIM. Regards, MasterMind
|
|
|
|
Joined: May 2000
Posts: 243
Member
|
Member
Joined: May 2000
Posts: 243 |
Ah, here's your problem. THe script runs through the first few posts. It doesn't find the scrap book. THen on the forth post it does! now $ThisScrap is defined. The next post. It Doesn't find the scrap book. BUT $ThisScrap still has the same data. So you'll either want an } else { or before the if statement put $ThisScrap = ''; ![[Linked Image]](https://ubbdev.com/ubb/smilies/smile.gif) ------------------ Powered by ZCom Bulletin Boards
|
|
|
|
Joined: Oct 2000
Posts: 290
Member
|
Member
Joined: Oct 2000
Posts: 290 |
THANK YOU Zanardi! That cleaned up THAT problem. Though I had to add $ThisScrap = ""; before the if statment to get it to work. It no longer displays errant scrapbooks like it did....now, it only displays the last entry in the list. If you go back to the page listed above, you'll see there is only one user with a blue folder. Well, ALL users have an entry in scraps-list.file The one showing is the most recent addition. Here is the new code I used: --------------- # Check for Scrapbook my @scrapbook = &OpenFile("$MembersPath/scrap-list.file"); foreach $thisline(@scrapbook) { my @scraps = split(/|!!|/, $thisline); chomp($scraps[1]); $ThisScrap = ""; if ($thisprofile[0] eq "$scraps[0]") { $ThisScrap = qq(
![Check out $thisline[2]'s Prowler ScrapBook!!!]($NonCGIURL/scrap.gif) ); } } ------------------ Thank you so very much, it was nice to make some progress...thanks to you! Personally, I think it is that IF statement that is wrong in some way..maybe an UNLESS would be better? So far, I am getting the variable assigned, and to the right person...but it isn't doing the whole list, which is why I think the IF statement is the problem. ------------------ Tony (Vipermad) Rickard Viper Club UBB Admin This message has been edited by Vipermad on January 06, 2001 at 09:38 AM
|
|
|
|
Joined: May 2000
Posts: 243
Member
|
Member
Joined: May 2000
Posts: 243 |
Hmm, im not really sure what you mean by they are configured in the control panel. Could you explain that a little be to me? ------------------ Powered by ZCom Bulletin Boards
|
|
|
|
Joined: Oct 2000
Posts: 290
Member
|
Member
Joined: Oct 2000
Posts: 290 |
OK here goes. Another hack gave me the idea as to how to accomplish what I want to do. I have a control panel area that lets me configure who is assigned a scrapbook. Basically, the scrapbooks are already in another part of the board, so all I wanted was to put a link (as I have) for each user who has a scrapbook. It is a up to me to configure a username for a scrapbook in the control panel. What I do is go into the control panel area I created, and I can insert a username and a corresponding scrapbook number. Not everyone has a scrapbook, so I needed to be able to assign a number based on manually entering the data for a username. The info is entered as |!!|, and it is here that the scrap-list file is created. This works...it works for the original hack (which is used by Admin only to assign a custom title, or custom titles based on post counts). Anyway, that part of the hack works as I have checked the members folder for the scrap-list.file and the proper entries. I did not want to add this to the profile, I only want it controlled by Admin.
So, I enter the data for a username, one per line, and it is written to the scrap-list.file (my little database), then it is called by the above bit of code and should give each configured user a blue folder with the proper scrapbook number.
Did any of that make sense?? ![[Linked Image]](https://ubbdev.com/ubb/smilies/smile.gif)
For the original hack, written by Jimbo (make sure credit given where due), I enter a username in the format described above and the title I want. You notice that it works because all the titles on the page listed above are assigned by that hack. So I figured the same thing should happen with my little addition. Here is the whole sub-routine including what I added. This sub is called by ubb_library2.pl where $ThisStatus is assigned:
sub ParseUserTitles{ # Check for Post Count titles my @posttitles = &OpenFile("$MembersPath/title-list2.file");
foreach $thisline(@posttitles) { my @postnumtitles = split(/|!!|/, $thisline); chomp($postnumtitles[1]);
if ($thisprofile[7] > $postnumtitles[0]) { $ThisStatus = "$postnumtitles[1]"; } }
# Check for Admin / Moderator Titles if ($thisprofile[8] eq "Administrator") { $ThisStatus = "$AdminTitle"; } elsif ($thisprofile[8] eq "Moderator") { $ThisStatus = "$ModeratorTitle"; }
# Check for Username Specific Titles my @spectitles = &OpenFile("$MembersPath/title-list.file");
foreach $thisline(@spectitles) { my @titles = split(/|!!|/, $thisline); chomp($titles[1]);
if ($thisprofile[0] eq "$titles[0]") { $ThisStatus = "$titles[1]"; } }
# Check for Scrapbook my @scrapbook = &OpenFile("$MembersPath/scrap-list.file");
foreach $thisline(@scrapbook) { my @scraps = split(/|!!|/, $thisline); chomp($scraps[1]); $ThisScrap = ""; if ($thisprofile[0] eq "$scraps[0]") { $ThisScrap = qq(
); } } } # end smart title parsing routine
Zanardi, I am very happy to have your expertise, and I think you, more than I can put into words here, for your help
------------------ Tony (Vipermad) Rickard Viper Club UBB Admin
|
|
|
|
Joined: May 2000
Posts: 243
Member
|
Member
Joined: May 2000
Posts: 243 |
Replace your foreach loop with this and tell me if it works: LINE: for (@scrapbook) { chomp($_); my @scraps = split(/|!!|/,$_); $ThisScrap = ""; if ($thisprofile[0] eq "$scraps[0]") { $ThisScrap = qq( ![Check out $thisline[2]'s Prowler ScrapBook!!!]($NonCGIURL/scrap.gif) ); last LINE; } } ------------------ Powered by ZCom Bulletin Boards
|
|
|
|
Joined: Oct 2000
Posts: 290
Member
|
Member
Joined: Oct 2000
Posts: 290 |
Zanardi, you are a STAR! Between the two of us, it works! I replaced the foreach as you said, but it did not work...so I had a closer look and realized this line was wrong: my @scraps = split(/|!!|/,$_);I replaced that one line with basically the same thing, only escaping each of the |!!| like this: And it worked like a charm! I'm off to do further testing on it, but initial tests say it is a go! BTW, I looked at my original code and those escapes aren't there either, so I tried my original code with the escapes in place and it did not work (frown). Thank you very much for the PERL lesson...care to give a brief explanation here or by e-mail? Thanks again!!! ------------------ Tony (Vipermad) Rickard Viper Club UBB Admin This message has been edited by Vipermad on January 07, 2001 at 02:05 PM
|
|
|
|
Joined: May 2000
Posts: 243
Member
|
Member
Joined: May 2000
Posts: 243 |
duh, I could've sworn I put those esacpes in there ![[Linked Image]](https://ubbdev.com/ubb/smilies/biggrin.gif) But im glad to here it works But I could not find anything wrong with your above code besides the fact it didn't do what you wanted to ![[Linked Image]](https://ubbdev.com/ubb/smilies/smile.gif) ------------------ Powered by ZCom Bulletin Boards
|
|
|
|
Joined: Oct 2000
Posts: 290
Member
|
Member
Joined: Oct 2000
Posts: 290 |
Yeah, I am still testing the original coding to see what the heck is going on...but it works so I'm happy!! Kinda frustrating when you can look at something, know it should work, and it doesn't! Thanks again! I might call on your expertise in the future if thats OK!?!?!?! ------------------ Tony (Vipermad) Rickard Viper Club UBB Admin
|
|
|
|
Joined: May 2000
Posts: 243
Member
|
Member
Joined: May 2000
Posts: 243 |
Any time ![[Linked Image]](https://ubbdev.com/ubb/smilies/smile.gif) ------------------ Powered by ZCom Bulletin Boards
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 87
Joined: December 2001
|
|
Forums63
Topics37,575
Posts293,931
Members13,824
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|