Author Topic: [Fix] Vote(s), Page(s), Image(s), User(s) & Guest(s) fix  (Read 18279 times)

0 Members and 1 Guest are viewing this topic.

Offline MrWante

  • Newbie
  • *
  • Posts: 11
    • View Profile
[Fix] Vote(s), Page(s), Image(s), User(s) & Guest(s) fix
« on: February 06, 2003, 06:39:16 AM »
Hi everyone,

I got irritated with vote(s), so I wrote this little simple modification...
When there is only 1 vote it says "1 vote", when there is 0 or 2 and more it says "x votes"... (x being 0, 2 or higher)
This was quite easy to do, but I am a novice in PHP so, if you find any mistakes here, please let me know, so I can correct it!

(update)

Then after getting a suggestion I changed image(s) and page(s) too... Now it says 1 page 1 image, and if 2 it says 2 pages and 2 images.

Finally after thinking about it I fixed Currently active users so that it says 1 guest and 1 user, otherwise it says guests and users...

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

This mod changes the following:

/includes/functions.php
includes/paging.php
includes/sessions.php
/lang/<yourlanguage>/main.php
/templates/<yourtemplate>/details.html
top.php

----------------------------
---- FIXING VOTE(S)----
----------------------------

Open functions.php and find:

Code: [Select]
   $allow_download = 1;
  }

 
add after:

Code: [Select]
   if ($image_row['image_votes'] == "1"){$votes=$lang['vote'];}
    else {$votes=$lang['votes'];}


I don't know if above can be put somewhere else, but this works for me...

find:

Code: [Select]
   "image_votes" => $image_row['image_votes'],
   
add after:

Code: [Select]
   "votes" => $votes,

Save and close functions.php
----------------------------
Open main.php in the lang/(your language) folder and find:

Code: [Select]
$lang['votes'] = "Vote(s)";
replace this with:

Code: [Select]
$lang['votes'] = "Votes";
$lang['vote'] = "Vote";


Save but keep main.php open!
----------------------------
Open details.html located in your templete folder...

Find:

Code: [Select]
                           <td valign="top" class="row2">{image_rating} ({image_votes} {lang_votes})</td>
                           
Replace with:

Code: [Select]
                           <td valign="top" class="row1">{image_rating} ({image_votes} {votes})</td>

Save and close details.html
----------------------------
Open top.php and find:

Code: [Select]
$register_array['image_rating_number_'.$i] = "<b>".$top_list[$i]['image_rating']."</b> (".$top_list[$i]['image_votes']." ".$lang['votes'].")";

Replace with:

Code: [Select]
   if ($top_list[$i]['image_votes'] == "1") {$votes=$lang['vote'];}
    else {$votes=$lang['votes'];}
    $register_array['image_rating_number_'.$i] = "<b>".$top_list[$i]['image_rating']."</b> (".$top_list[$i]['image_votes']." ".$votes.")";


Now find:

Code: [Select]
  $register_array['image_votes_number_'.$i] = "<b>".$top_list[$i]['image_rating']."</b> (".$top_list[$i]['image_votes']." ".$lang['votes'].")";
   
Replace with:

Code: [Select]
   if ($top_list[$i]['image_votes'] == "1") {$votes=$lang['vote'];}
    else {$votes=$lang['votes'];}
    $register_array['image_votes_number_'.$i] = "<b>".$top_list[$i]['image_rating']."</b> (".$top_list[$i]['image_votes']." ".$votes.")";

   
Now save and close top.php


------------------------------------------------
----- FIXING PAGE(S) and IMAGE(S) ------
------------------------------------------------

open includes/paging.php

find:

Code: [Select]
 var $first,$last,$total_pages,$config,$desc,$next,$back;
 
change to:

Code: [Select]
 var $first,$last,$total_pages,$config,$desc,$next,$back,$pages,$images;  
find:

Code: [Select]
   $this->range = $config['paging_range'];
   
add after:

Code: [Select]
   if ($this->total_pages == "1") {$this->pages=$lang['page'];}
    else $this->pages=$lang['pages'];
    if ($this->num_rows_all == "1") {$this->images=$lang['image'];}
    else $this->images=$lang['images'];

   
find:

Code: [Select]
     "/".$site_template->start."last_page".$site_template->end."/iU"

change to:

Code: [Select]
     "/".$site_template->start."last_page".$site_template->end."/iU",
      "/".$site_template->start."images".$site_template->end."/iU",
      "/".$site_template->start."pages".$site_template->end."/iU"

     
find:

Code: [Select]
   $replace_array = array(
      $this->num_rows_all,
      $this->total_pages,
      $this->first,
      $this->last

     
change to:

Code: [Select]
   $replace_array = array(
      $this->num_rows_all,
      $this->total_pages,
      $this->first,
      $this->last,
      $this->images,
      $this->pages

     
Save and close paging.php
----------------------------

Go back to main.php

find:

Code: [Select]
$lang['paging_stats'] = "Found: {total_cat_images} image(s) on {total_pages} page(s). Displayed: image {first_page} to {last_page}.";

change to:

Code: [Select]
$lang['paging_stats'] = "Found: {total_cat_images} {images} on {total_pages} {pages}. Displayed: image {first_page} to {last_page}.";
$lang['page'] = "page";
$lang['pages'] = "pages";
$lang['image'] = "image";
$lang['images'] = "images";


Save but keep main.php open!

---------------------------------------------------
------ FIXING USER(S) and GUEST(S) -------
---------------------------------------------------

First open includes/sessions.php

Find:

Code: [Select]
 $num_total_online = $num_registered_online + $num_guests_online;

add after:

Code: [Select]
 if ($num_registered_online == 1){$reg_online=$lang['member_online'];}
  else $reg_online=$lang['members_online'];
  if ($num_guests_online == 1){$guest_online=$lang['guest_online'];}
  else $guest_online=$lang['guests_online'];

 
A little further down find:

Code: [Select]
   "user_online_list" => $user_online_list
   
change to:

Code: [Select]
   "user_online_list" => $user_online_list,
    "reg_online" => $reg_online,
    "guest_online" => $guest_online

   
Save and close sessions.php
----------------------------
Go back to main.php

Find:

Code: [Select]
$lang['user_online_detail'] = "There are currently <b>{num_registered_online}</b> registered user(s) ({num_invisible_online} among them invisible) and <b>{num_guests_online}</b> guest(s) online.";        
Replace with:

Code: [Select]
$lang['user_online_detail'] = "There are currently <b>{num_registered_online}</b> registered {reg_online} ({num_invisible_online} among them invisible) and <b>{num_guests_online}</b> {guest_online} online.";
$lang['member_online'] = "user";
$lang['members_online'] = "users";
$lang['guest_online'] = "guest";
$lang['guests_online'] = "guests";


Finally close main.php
----------------------------

All done! As you can see, it's quite a simple mod, and if your language requires more alternatives, you can easily add those conditions...
If you have any questions how to do this, I am sure I or someone more skilled than I can help out...

By the way, there is one condition that I will not fix and that is if you have only one category and one image in your gallery...
If you have that, well, it wouldn¨t be much of a gallery, would it. So, I will not fix it... I think that would be overkill... Or am I wrong?

Cheers!

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Fix] Vote(s), Page(s), Image(s), User(s) & Guest(s) fix
« Reply #1 on: February 07, 2003, 08:53:58 PM »
imho, more or less useless in most languages. at least, in russian it's not that simple...
and "vote(s)" - not the only case, you have to modify a lot then...

Offline MrWante

  • Newbie
  • *
  • Posts: 11
    • View Profile
Yeah! Well, I expanded it!
« Reply #2 on: February 07, 2003, 09:16:17 PM »
I wasn't trying to impress anyone...

I was only doing this for myself... but I though maybe there was someone else, who wanted it too...

And, yes, I know it's not that easy ín Russian, but it's very easy to change and add more conditions... if you like that..

Yeah, I have updated the mod now, so it fixes all the other places too!
And if you need help to fix more condition, we would be happy to help you!

In another version of this "fix" this could maybe be easier to accomplish with arrays, but for now... this is what I could do.

Offline Jasondavis

  • Full Member
  • ***
  • Posts: 157
    • View Profile
[Fix] Vote(s), Page(s), Image(s), User(s) & Guest(s) fix
« Reply #3 on: February 07, 2003, 09:32:59 PM »
I really like this mod...I have been wanting one similar to it that will change the page(s) to page if theres 1 page if more than 1 page have pages....anyone know how I can do that?

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Fix] Vote(s), Page(s), Image(s), User(s) & Guest(s) fix
« Reply #4 on: February 07, 2003, 09:33:51 PM »
Quote from: MrWante
I wasn't trying to impress anyone...

Noboby blaming you, huh?  :lol:
Any ideas, emprovements appreciated here, that's this forum created for

Offline MrWante

  • Newbie
  • *
  • Posts: 11
    • View Profile
[Fix] Vote(s), Page(s), Image(s), User(s) & Guest(s) fix
« Reply #5 on: February 07, 2003, 09:47:49 PM »
Quote from: Jasondavis
I really like this mod...I have been wanting one similar to it that will change the page(s) to page if theres 1 page if more than 1 page have pages....anyone know how I can do that?


I will look into it... I would like that too! Shouldn't be too hard... well, for me it might, cause I am such a novice...

But I will try this very night, and if I can get it to work, with Page and Pages, I will post it here...

Thanx... :)

Offline Jasondavis

  • Full Member
  • ***
  • Posts: 157
    • View Profile
[Fix] Vote(s), Page(s), Image(s), User(s) & Guest(s) fix
« Reply #6 on: February 07, 2003, 09:50:46 PM »
thanks that would be really cool...you said the vote vote(s) was annoying you...well the page(s) has been driving me nuts since I got the gallery!

Offline Jasondavis

  • Full Member
  • ***
  • Posts: 157
    • View Profile
[Fix] Vote(s), Page(s), Image(s), User(s) & Guest(s) fix
« Reply #7 on: February 08, 2003, 09:03:06 PM »
Hi thanks worked pretty good...the guest and user one I didnt do but the otheres are great thanks

Offline MrWante

  • Newbie
  • *
  • Posts: 11
    • View Profile
[Fix] Vote(s), Page(s), Image(s), User(s) & Guest(s) fix
« Reply #8 on: February 09, 2003, 12:18:42 AM »
You are welcome...

But it should work.. I've tested this on a clean install of 4images, using copy and paste from the post I made, so you must have made some errors, when doing the last modification. Try again, and I am sure it will work...

Offline www.girls-on-bikes.com

  • Full Member
  • ***
  • Posts: 145
    • View Profile
    • http://www.girls-on-bikes.com/
[Fix] Vote(s), Page(s), Image(s), User(s) & Guest(s) fix
« Reply #9 on: June 02, 2003, 11:26:10 PM »
There is one bug...
Code: [Select]
<td valign="top" class="row2">{image_rating} ({image_votes} {lang_votes})</td>

Code: [Select]
<td valign="top" class="row1">{image_rating} ({image_votes} {votes})</td>

Notice how you change the class?  It changes the color of the background as well.  Just something to edit, then it's perfect ;)

Offline supastoked

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • ThoseDudes
Re: [Fix] Vote(s), Page(s), Image(s), User(s) & Guest(s) fix
« Reply #10 on: July 19, 2005, 03:46:18 AM »
MrWante,
Thanks alot for this - its a simple mod, but for a perfectionist its the little things that drive you crazy!!!  :D
Any ideas on how to make it show (xx) admin or (xx) admins online? I have been trying to find where to add it but am not having any joy  :?
Thanks again!!
Chris