Web Hosting Forum | Lunarpages
News: July 14, 2008 - New Contest! - Submit Your WordPress Theme Designs, Win BIG!
August 25, 2008 - Time to Vote for the August 2008 Site of the Month!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
August 30, 2008, 05:49:33 AM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: Advanced Guestbook Dropdown (Add links and url's)  (Read 15883 times)
StephanieŽ
Administrator
Master Jedi
*****
Offline Offline

Posts: 1080



« 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:

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:
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:

<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:
$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  Razz
Logged

TWebMan
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3112



WWW
« Reply #1 on: February 11, 2004, 06:41:25 PM »

Applause   Woohoo  StephanieŽ
Logged

"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
losgallos
Pong! (the videogame) Master
*****
Offline Offline

Posts: 20


WWW
« 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...
Logged
StephanieŽ
Administrator
Master Jedi
*****
Offline Offline

Posts: 1080



« 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  Luff Ya
Logged

losgallos
Pong! (the videogame) Master
*****
Offline Offline

Posts: 20


WWW
« Reply #4 on: February 15, 2004, 02:01:57 AM »

Thank You
Logged
Rodent
Space Explorer
***
Offline Offline

Posts: 9



« 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.  Thumbs Up

Thank you.

Rodent
http://www.gapingmaws.com
Logged
StephanieŽ
Administrator
Master Jedi
*****
Offline Offline

Posts: 1080



« Reply #6 on: April 15, 2004, 11:56:28 AM »

You're very welcome Rodent  Razz
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.  Cool
Logged

jukeyard
Spaceship Captain
*****
Offline Offline

Posts: 124


WWW
« Reply #7 on: August 25, 2004, 05: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  Sad
Logged

If it's to loud your to old! Rock on!
Pete
Alien Anomaly
Professor in Nanotechnology
*****
Offline Offline

Posts: 4222



WWW
« Reply #8 on: August 25, 2004, 06:48:39 AM »

Hi jukeyard,
I THINK you will find PHP wont work on a temporary address  Crying or Very sad
Logged

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  Very HappyLunarpages Web Hosting   Lunarpages Forums   Lunarpages Affiliate Program
StephanieŽ
Administrator
Master Jedi
*****
Offline Offline

Posts: 1080



« Reply #9 on: August 25, 2004, 07:01:13 AM »

Sorry,

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

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

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM