No announcement yet.

Plugin Help; How-to

  • Filter
  • Time
  • Show
Clear All
new posts

  • Plugin Help; How-to

    Right now, I'm basically trying to get the forum software wrapped in the template used for the rest of the site. This template includes a few php scripts that bring in dynamic content. I've been creating plugins, but they just don't seem to be working.

    The plugin I'm currently working on does the following:

    1. Set two variables, $display and $zone.
    a. These variables do, in fact, set. After setting them, I have used echo $display; and it outputs the correct data.

    2. include a php script. This script calls a switch statement based on the value of $display. Once called it sets a few more variables and then includes a Javascript and image tag, which is saved as a string, $ad. The switch case ends with an echo of the saved string, $ad.

    This is where I'm running into problems. In the plugin, I echo the path to the included file, and it returns the correct path. However, inside the switch statement, the echos are not working. I've tried echoing the variables I set just to make sure it's actually setting them with no output. It also does not output the resulting string saved at the end of the switch statement.

    my plugin is as follows:

    $display = 'topleader';
    $zone = 'homepage';
    $includeTopAdPHP = ob_get_contents();
    The included file is as follows:

    switch ($display) {
        case 'topleader':
            $width = '728';
            $height = '90';
            $thisTile = get_next_ad_tile();
            $widthXheight = $width . "x" . $height;
            $ord = time();
            $ad = '
                <!-- begin ad tag  (tile='.$thisTile.') -->
                <script language="JavaScript" src="'.$zone.';pos='.$display.';tile='.$thisTile_ctr.';sz='.$widthXheight.';ord='.$ord.'?" type="text/javascript"></script>
                <noscript><a href="'.$zone.';pos='.$display.';tile='.$thisTile.';sz='.$widthXheight.';ord='.$ord.'?" target="_blank"><img src="'.$zone.';pos='.$display.';tile='.$thisTile.';sz='.$widthXheight.';ord='.$ord.'?" width="'.$width.'" height="'.$height.'" border="0" alt=""></a></noscript>
                <!-- End ad tag (tile = '.$thisTile.')-->';
            echo $ad;
    I've tried ending the output buffer and starting it just before the $ad string is set. At this point, I'm out of ideas, and very frustrated. Please help, and thanks in advance!!

    Disgusted in DC

  • #2
    Your code looks correct. My post in this thread has similar instructions. You may want to consult with my code.

    Make sure you are using an appropriate hook location or the variable might end up out of scope so that it doesn't work in the template. The global_start hook is within scope of the major templates like header and footer.


    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.