popup the guestbook form

Creating and modifying plugins.
Post Reply
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

popup the guestbook form

Post by Timbalu »

Hi everybody

Someone asked for changing the appearance and creating a popup form inside the guestbook plugin.

Please remember
Problems with pop-ups

The common faults with pop-up windows are:

* If scripting is disabled, or if the browser does not support JavaScript, the pop-up will not work
* Search engines cannot follow links to pop-up windows (scripted elements are ignored)
* Pop-ups present accessibility problems
* Site management tools (e.g. DreamWeaver) cannot update links to pop-ups if you move the destination page to another section of your site
* Many people have pop-up killers running that close the window the moment they are opened
* In many browsers, the default option is now to stop pop-ups opening in the first place

If you know what you do, you can now edit serendipity_event_guestbook.php
beginning at page 594

This is a basic example without a real popup window. But if you really want it to popup, use the functions for the serendipty comment popups. Perhaps Garvin may give us a hint how to use it here. ;-)

Code: Select all

	    /* call the entries page output function */
            $this->generate_EntriesPage();

            /* call the form page output function */
            $this->generate_FormPage();

            echo '</div> <!-- serendipity_entry_body -->' . "\n";
            echo '</div> <!-- serendipity_entry -->' . "\n";

            echo '</div> <!-- serendipity_Entry_Date -->';
        }
    } // generate_Page end

    /* make guestbook form */
    function generate_FormPage() {

change it to something like this

Code: Select all

            /* call the form page output function */
            $this->generate_FormPopupPage();

            /* call the entries page output function */
            $this->generate_EntriesPage();

            echo '</div> <!-- serendipity_entry_body -->' . "\n";
            echo '</div> <!-- serendipity_entry -->' . "\n";

            echo '</div> <!-- serendipity_Entry_Date -->';
        }
    } // generate_Page end

    /* make guestbook popup form */
    function generate_FormPopupPage() {
	    
        $is_guestbook_path = $this->get_config('pageurl');

        if ($serendipity['rewrite'] != 'none') {
            $append = '?';
        } else {
            $append = '&';
        }

	if($_GET['serendipity']['popup'] == 1) { 
	    /* call the form page output function */
            $this->generate_FormPage();

	} else { 
	
		$url = $is_guestbook_path . $append . 'serendipity[popup]=1';
		/* make this behave like you want it to appear */
		echo '<div align="center"><a href="' . $url . '">' . TEXT_POPUPFORM . '</a></div><br />';
		
	}
	    
    }
    /* make guestbook form */
    function generate_FormPage() {
do not forget to put something like this to your lang files

Code: Select all

  
	@define('TEXT_POPUPFORM', 'guestbook entry form');
Ian
Post Reply