Differences

This shows you the differences between two versions of the page.

Link to this comparison view

glfusion:tipstricks [2011/05/20 02:36] (current)
Mark created
Line 1: Line 1:
 +====== glFusion Tips & Tricks ======
  
 +This is a collection of tips and tricks from the glFusion forums. There is a forum dedicated to glFusion customizations and modifications, you should also look there for more ideas and options. Our goal with this page is not to re-create all the forum posts, but to consolidate some of the tips that came out of general support requests.
 +
 +===== Template Customizations =====
 +
 +glFusion allows you to customize the theme template (.thtml) and css files without actually modifying the original files. This allows you to make your customizations with confidence that they will not be overwritten during an upgrade. glFusion does this by including a folder named custom in every directory where there are .thtml or .css files. The template engine will first look in these custom directories for files, then in their regular locations, when building the page.
 +
 +To customize a template or css file, first copy it into the custom folder in the same directory, then make your modifications to that newly copied file.
 +
 +To customize a template or css file that resides in the directory:
 +
 +private/plugins/<plugin_name>/templates/
 +copy the .thtml or .css file into its /custom folder, or to create a theme specific version of that plugin file, copy it into the
 +  
 +  public_html/layout/<theme_name>/plugins/<plugin_name>/ 
 +  
 +directory.
 +
 +New with glFusion v1.1.3 is a config option to Include Template Comments in Page Source. When enabled, the {# and #} template comments will become <!-- --> HTML comments and will be included in the output to the browser. Also, the beginning and end of each template, along with it's physical location on the server, will be included in the output. This feature is useful if you are trying to determine which template controls a specific display item, or when developing a new theme.
 +
 +<note important>When you do upgrade your glFusion site, be sure and check the [[glfusion:template_changes|Template Changes]] page and make any necessary updates to your custom templates.</note>
 +
 +
 +===== Language Customizations =====
 +There may be times where you would like to use different text strings than what is provided by glFusion.  For example, you might want to change the menu entry for Media Gallery to Gallery.  glFusion provides a very flexible customization system that allows you to make language customizations and make sure your changes are not overwritten during upgrades. 
 +
 +The process is very simple, you simply create a custom language file with **just** the items you want to override.  For example, to change the Media Gallery prompt to Gallery, you would create the following override file:
 +
 +Create private/plugins/mediagallery/language/custom/english_utf-8.php (or whatever your language name is).
 +
 +Place the following in the custom file:
 +
 +<code>
 +<?php
 +
 +$LANG_MG00['menulabel'] = 'Gallery';
 +
 +?>
 +</code>
 +This will override the default $LANG_MG00['menulabel'] entry in the stock language file.
 +
 +**Important Notes**
 +
 +Language file overrides **only** work when there is a corresponding language file in the actual language/ directory.  For example, if you wanted to have your Media Gallery display in 'piglatin_utf-8.php', you must first have a 'piglatin_utf-8.php' file in the private/plugins/mediagallery/language/ directory.  Since Pig Latin is not a language that is included with Media Gallery, you really don't need to have an override file.  In this example, we (the glFusion Team) would appreciate you sending us the Pig Latin translation so we could include it in future releases.
 +
 +
 +
 +
 +===== Custom Read More =====
 +The goal of this tip is to replace the standard **Read More** link with a customized link that is included in the body of the story.  We also want to make sure it does not display when the full article is displayed.  Finally, we want to remove the extra line break between the intro text and the body text when displaying the full article.
 +
 +We're going to use the [file:395 AutoTags Plugin] to help accomplish this goal.
 +
 +Go to the AutoTags admin screen, create a new autotag, let's call it **more**. Check the **PHPfn** box and save. Now we need to put the PHP function to drive this one in the private/system/lib-custom.php file (anywhere near the bottom before the ?>).
 +
 +<code>
 +function phpautotag_more($p1, $p2, $fulltag)
 +{
 +    global $_CONF;
 +
 +    $retval = '';
 +    $attr = array();
 +
 +    $currentURL = COM_getCurrentURL();
 +
 +    // if we are displaying the full article, simply return and do not replace the txt
 +    if ( strstr($currentURL,'article.php') ) {
 +        return $retval;
 +    }
 +    if (!empty($p1)) {
 +        $url = $_CONF['site_url'].'/article.php?story='.trim($p1);
 +        $retval = COM_createLink( '>>>Keep Reading', $url, $attr );
 +    }
 +    return $retval;
 +}
 +</code> 
 +
 +You can change the **>>>Keep Reading** text to suit your needs.
 +
 +Basically what this will do is only show the Keep Reading prompt when the article is shown on the main page. It will not show the link when viewing the full article.
 +
 +Next, we want to make a few minor customizations to 2 templates:
 +
 +  * featuredstorytext.thtml
 +  * storytext.thtml
 +
 +We'll make the same changes to both. First, we want to take care of that extra space between the intro / body text. Look for this line:
 +
 +<code>
 +        {story_anchortag_and_image}{story_introtext}
 +
 +</code>
 +We want to replace **story_introtext** with **story_text_no_br**. This will remove the extra line break between the intro and body text.
 +
 +Next, we want to comment out the old standard Read more link, so look for:
 +
 +<code>
 +        <p>{readmore_link}</p>
 +</code>
 +Remove this line.
 +
 +Now save both of these files in the layout/nouveau/custom/ directory, this way we don't overwrite the original and these changes will stay in place even after future upgrades.
 +
 +That should do it, now edit your story and put your new <nowiki>[more:story_id]</nowiki> autotag in place and let's see if it works.
 +
 +===== List Plugins in a new Block on Admin Home Page =====
 +**By: Katwork**
 +
 +For whatever reason I have a hard time quickly finding the link I want on the Command & Control (Admin Home) page. When I go to the page I know that I want to access either a core glFusion item or a plugin so I figured it would be easier for me to find what I wanted if the plugins were displayed in a new block. It turned out to be really easy so I thought I'd share. Whether or not I did this correctly is another story, but it works for me. 
 +
 +For the full details (and updates) see the [forum:29961  List plugins in a new block on the Admin Home page] post in the glFusion support forums.
 +
 +===== Using stopforumspam.com to block registration by spammers =====
 +**By lgarner**
 +
 +Despite the CAPTCHA, I occasionally (though not often) get spammers signing up. I ran across a Wordpress plugin that uses stopforumspam.com to validate email and IP addresses. I started out to create a similar plugin, but then thought it makes sense to extend the SpamX plugin.
 +
 +For the full details see the [forum:32652 Using stopforumspam.com to block registration by spammers] post in the glFusion support forums.
glfusion/tipstricks.txt · Last modified: 2011/05/20 02:36 by Mark
 
Except where otherwise noted, content on this wiki is licensed under the following license: GNU Free Documentation License 1.3