Small php problem

Discussion in 'PHP' started by GReddy4u, Mar 12, 2010.

  1. #1
    *Problem Fixed*
    I'm receiving this error,
    located at the top of this code....
    function myPosts()
        {
            // get length
            function myLength($len)
                {
                    global $abm;
                    if ($abm['feat_len'] != '')
                        {
                            return $abm['feat_len'];
                        }
                    else
                        {
                            return 20;
                        }
                }
            add_filter('excerpt_length', 'myLength');
            
            global $abm;    
            echo '<div class="widget">';
            echo '<h1>'.$abm['feat_title'].'</h1><ul>';
            $my_query = new WP_Query('showposts='.$abm['feat_no']);
              while ($my_query->have_posts()) : $my_query->the_post();
              $do_not_duplicate = $post->ID;
    ?>
            <li>
                <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                <?php the_excerpt(); ?>
            </li>
    <?php
            endwhile;
            echo '</ul></div>';
        }
        
    // register widget
    register_sidebar_widget(array('Enhanced Recent Posts (AB)', 'widgets'), 'myPosts');
    PHP:
    I believe it is attempting to restart my leftside bar due to the reason it says "loading quotes" above the error, due to the reason I have a quote widget at the top of my left sidebar.

    All help is appreciated! I'm stumped.
     
    Last edited: Mar 12, 2010
    GReddy4u, Mar 12, 2010 IP
  2. skywebsol

    skywebsol Well-Known Member

    Messages:
    161
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #2
    i think you are declare same function name ( myLength ) again that why it is showing error to you my friend.
     
    skywebsol, Mar 12, 2010 IP
  3. GReddy4u

    GReddy4u Active Member

    Messages:
    442
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Problem Fixed!
     
    Last edited: Mar 12, 2010
    GReddy4u, Mar 12, 2010 IP