Web Hosting Forum | Lunarpages

Author Topic: Advanced Guestbook Dropdown (Add links and url's)  (Read 40147 times)

Offline StephanieŽ

  • Master Jedi
  • *****
  • Posts: 1094
Advanced Guestbook Dropdown (Add links and url's)
« on: February 02, 2004, 03:36:24 AM »
Here's a handy little modification so you can make your guestbook dropdown list go to other sites and pages.

Please make sure you backup your files before attempting this
I dont want people shouting at me  :wink:

Open gb.class.php and find the lines:
Code: [Select]

function generate_JumpMenu() {

        $menu_array[] = "<select name=\"entry\" class=\"select\">";

        $menu_array[] = "<option value=\"0\" selected>".$this->db->LANG["FormSelect"]."</option>";

        if ($this->db->VARS["entries_per_page"] < $this->total) {

            $remain = $this->total % $this->db->VARS["entries_per_page"];

            $i = $this->total-$remain;

            while ($i > 0) {

                $num_max = $i;

                $num_min = $num_max-$this->db->VARS["entries_per_page"];

                $num_min++;

                $menu_array[] = "<option value=\"$remain\">$num_min-$num_max</option>";

                $i = $num_min-1;

                $remain += $this->db->VARS["entries_per_page"];

           }

        }

        $menu_array[] = "</select>";

        $menu_array[] = "<input type=\"submit\" value=\"".$this->db->LANG["FormButton"]."\" class=\"input\">";

        return $menu_array;


Replace this with:

Code: [Select]
function generate_JumpMenu() {
        $menu_array[] = "<select name=\"entry\" onChange=\"urlJump('self',this)\" class=\"select\">";
        $menu_array[] = "<option value=\"http://www.mydomain.com/\" class=\"select\">My site</option>";
        $menu_array[] = "<option value=\"0\" selected>".$this->db->LANG["FormSelect"]."</option>";
        if ($this->db->VARS["entries_per_page"] < $this->total) {
            $remain = $this->total % $this->db->VARS["entries_per_page"];
            $i = $this->total-$remain;
            while ($i > 0) {
                $num_max = $i;
                $num_min = $num_max-$this->db->VARS["entries_per_page"];
                $num_min++;
                $menu_array[] = "<option value=\"$remain\">$num_min-$num_max</option>";
                $i = $num_min-1;
                $remain += $this->db->VARS["entries_per_page"];
           }
        }
        $menu_array[] = "</select>";
        $menu_array[] = "<input type=\"submit\" value=\"".$this->db->LANG["FormButton"]."\" class=\"input\">";
        return $menu_array;
   


Change domain.com with the url you wish it to go to, and change My site with the name you wish to be displayed on the dropdown.

Then open header.php and add this just under </head>
Code: [Select]

<script language="Javascript">
<!--
function urlJump(target,selObj) {
var optionValue = selObj.options[selObj.selectedIndex].value;
var isURL = /http:/;
var regMatch = isURL.test(optionValue);
if(regMatch == true) {
eval(target+".location='"+selObj.options[selObj.selectedIndex].value+"'");
}
}
// -->
</script>

</head>
<body bgcolor="$VARS[pbgcolor]" link="$VARS[link_color]" vlink="$VARS[link_color]">


Add more menu arrays in gb.class.php
Code: [Select]
$menu_array[] = "<option value=\"http://www.mydomain.com/\" class=\"select\">My site</option>"; to add more lines/url's to your dropdown.

I've done an example here:
http://stephtest.lunarpages.com/guestbook/index.php
hope you like it  :P

Offline TWebMan

  • Quantum Encyclopedia Writer
  • *****
  • Posts: 3054
    • Take charge of your site
Advanced Guestbook Dropdown (Add links and url's)
« Reply #1 on: February 11, 2004, 06:41:25 PM »
:yey:   Woohoo  StephanieŽ
"Computers cause people to make more mistakes than any other invention in history, with the possible exception of handguns and tequila."  - Unknown
"Liberty of any kind is seldom lost all at once." - D. Hume
Every day is an Ode to Joy
The planet will be fine... and so will your site

Offline losgallos

  • Pong! (the videogame) Master
  • *****
  • Posts: 20
    • http://www.losgallosmusic.com
Re: Advanced Guestbook Dropdown (Add links and url's)
« Reply #2 on: February 15, 2004, 12:55:00 AM »
Where is the gb.class.php  located....   I have look at Guestbook Templates but it is not there...

Offline StephanieŽ

  • Master Jedi
  • *****
  • Posts: 1094
Advanced Guestbook Dropdown (Add links and url's)
« Reply #3 on: February 15, 2004, 01:33:01 AM »
Hi,

It's in the lib folder /public_html/guestbook/lib/gb.class.php

Thanks Tweb  :love:

Offline losgallos

  • Pong! (the videogame) Master
  • *****
  • Posts: 20
    • http://www.losgallosmusic.com
Advanced Guestbook Dropdown (Add links and url's)
« Reply #4 on: February 15, 2004, 02:01:57 AM »
Thank You

Offline Rodent

  • Space Explorer
  • ***
  • Posts: 9
Advanced Guestbook Dropdown (Add links and url's)
« Reply #5 on: March 15, 2004, 08:33:58 AM »
Wow. Thank you so much for this Stephanie.  I was just about to ask about how to do this, and decided to do a search through the forums first.  This was a great help and worked perfectly.

For those who like myself, are new to PHP and the whole, guestbook application, the tips and help found in these forums are beyond my appreciation.  :thumb:

Thank you.

Rodent
http://www.gapingmaws.com

Offline StephanieŽ

  • Master Jedi
  • *****
  • Posts: 1094
Advanced Guestbook Dropdown (Add links and url's)
« Reply #6 on: April 15, 2004, 10:56:28 AM »
You're very welcome Rodent  :P
Sorry I missed your reply and took so long to post this one back to you.
I'm really glad it helped you, I'll have a word with amy who runs the forum about opening a hacks/modifications forum for people to post their new ideas.  8-)

Offline jukeyard

  • Spaceship Captain
  • *****
  • Posts: 104
    • http://www.thejukeyard.com
Advanced Guestbook Dropdown (Add links and url's)
« Reply #7 on: August 25, 2004, 04:55:06 AM »
I don't get it http://orion.lunarpages.com/~perltest/guestbook/index.php it does.nt look like it works from here  :(
If it's to loud your to old! Rock on!

Offline Pete

  • Alien Anomaly
  • Senior Moderator
  • Professor in Nanotechnology
  • *****
  • Posts: 4258
    • X-Visions Website Design
Advanced Guestbook Dropdown (Add links and url's)
« Reply #8 on: August 25, 2004, 05:48:39 AM »
Hi jukeyard,
I THINK you will find PHP wont work on a temporary address  :cry:
x-visions.com


As I'm always saying.. (But nobody listens)
"Take a step back.. Take a deep breath and see if there a simple solution there, thats hiding" lol  :DLunarpages Web Hosting   Lunarpages Forums  Lunarpages Affiliate Program

Offline StephanieŽ

  • Master Jedi
  • *****
  • Posts: 1094
Advanced Guestbook Dropdown (Add links and url's)
« Reply #9 on: August 25, 2004, 06:01:13 AM »
Sorry,

Try this URL instead, the rules changed for php I forgot to update it :P
I edited the one in my first post too:

http://stephtest.lunarpages.com/guestbook/index.php

 

Share |