Help popup

From Sohowiki
(Difference between revisions)
Jump to: navigation, search
(Notes)
(Basic Syntax)
Line 4: Line 4:
  
 
===Basic Syntax===
 
===Basic Syntax===
help_popup("popup-id-name", "title text", "My html content" [,additional inline css]);
+
help_popup("popup-id-name", "title text", "My html content" [,additional inline css] [,other array]);
  
 
===Quick Example===
 
===Quick Example===

Revision as of 13:21, 18 July 2008

Within the Soholaunch product architecture there is a php function called help_popup. It standardizes the creation of popup layers that can be used to include help text or even config options.

Contents

How to create a help popup within you plugin's php code

Basic Syntax

help_popup("popup-id-name", "title text", "My html content" [,additional inline css] [,other array]);

Quick Example

<?php
$popupHTML = "<p>This is my help pop-up. It explains stuff.</p>"
$popupHTML .= "<p>And also explains some other stuff.</p>";

echo help_popup("pophelp-explain-stuff", "My Help Popup Explains Stuff", %popupHTML, "top: 10%;");
?>

<span class="help_link" onlick="showid('pophelp-explain-stuff');">[?] Launch help popup</span>

HTML Explained

The example above includes some html code to launch the popup layer.

<span class="help_link" onlick="showid('pophelp-explain-stuff');">[?] Launch help popup</span>

Here are some things to remember about that...

help_link 
This is a special css class available globally in Soholaunch. You should use it on any help link. Traditionally this will give your link the standard "help orange" formatting and ensure that if the global style for such links changes in the future your link will stay current.
showid() 
This is a javascript function also available globally throughout the Soholaunch code (because it is included in js_functions.php as well as site_javascript.php). All it does is toggle the visibility of a layer. It has a sister function, hideid() which "closes" (hides) the layer).

Naming conventions

Generally, we have a convention for prefixing the id name of the popup layer.

Preferred ID name prefixes...

pophelp- 
Use for most help popups, if it contains purely information.
popconfig- 
Use if popup contains config form.

We may eventually use these to further style the popup. For example, we may add a question mark watermark for help popups and a gear watermark for configuration popups. And right now the only way to tell these apart is with this prefix naming convention. So use it.

Notes

  • You can use it anywhere. The help_popup() function is included in shared_functions.php and is therefore available globally in both the Soholaunch admin tool window as well as on the client (website) side.
  • Position it. Use the inline style argument when you call the function to control the top/left positioning.
Personal tools