JavascriptgpEasy currently uses jquery and some custom JavaScript for site functions, but if you're looking to do a little more, JavaScript can be added to gpEasy sites multiple ways. Adding to a FileJavascript can be added directly to a file in gpEasy. This is the best option for users wanting to add scripting to just a few pages. To add <script> tags, start editing your page by clicking the "Edit" button and then click "Source" in the editor once it has loaded. Here you'll be able to see all the HTML of your file and you can add your <script> content as needed. Note: gpEasy uses HTML Tidy when available to clean the html of your pages. To keep HTML Tidy from removing your <script> content, don't add it as the first part of your document. HTML Tidy prefers, for some reason, to have some HTML before Javascript. Adding to template.phpAdding <script> tags to the template.php file will be most familiar to anyone who has experience with javascript. The template.php file is essentially an html file with some php calls like <?php gpOutput::GetHead() ?>. Here's what an example of a simple template.php file. So taking that simple template.php example, all we need to do to add some more javascript is add a <script> tag to the <head> section of the template.php file. <head> <?php gpOutput::GetHead(); ?> <script> alert('hello world'); </script> </head> Adding to $page->headIf you're designing a plugin for gpEasy, you won't have access to the template.php. You can add javascript by using the $page->head variable. While using this method, be sure to append to the $page->head variable. $page->head .= '<script>alert("hello world")</script>'; Adding to Addon.iniThe html_head configuration option is available in Addon.ini files as of version 1.6RC3. Very similarly to $page->head, this option can be used to add strings of text to gpEasy pages. The primary difference between this option and $page->head is that any text added to html_head will be included in all pages once the plugin is installed. ;used to add css/js/feed elements to the installation html_head = '<link rel="alternate" type="application/atom+xml" href="../data/_addondata/{$addon}/feed.atom" />' ColorBoxgpEasy also comes installed with support for colorbox. Colorbox can be used to display elements (like images, forms, messages, etc) as an overlay. Functionscommon::AddColorBox(); Add the above php code before gpOutput::GetHead();
|
|