ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

PHP Errors in our Sidebar navigation

August 08, 2012 4:10pm

Subscribe [1]
  • #1 / Aug 08, 2012 4:10pm

    BVUUF_MSC

    22 posts

    This is an error that has been showing up on our site (http://bvuuf.org) for at least 8 months, but since I work part-time I haven’t been able to address. We might be switching away from EE soon so I’m not sure how much this will matter, but if we can fix it I would like to since it could take several months before we fix everything on our website.

    On various pages I get variations of this error. It is always in the sidebar on a second level of navigation, showing up underneath the link to the page you are on, a seen in the image here: http://bvuuf.org/PHPerror.PNG (The page in the screencap is Board of Officers and Trustees, as indicated by the text above the error).

    Notice: Undefined variable: next_results in /nfs/c09/h01/mnt/128082/domains/bvuuf.org/html/syst3m102/core/core.functions.php(634) : eval()‘d code on line 4

    Here’s another one:

    Parse error: syntax error, unexpected T_ENDIF in /nfs/c09/h01/mnt/128082/domains/bvuuf.org/html/syst3m102/core/core.functions.php(634) : eval()‘d code on line 4

    I don’t understand PHP so when I looked in the core.functions document I didn’t know what I could change and what I couldn’t to try and fix this.

    Any ideas on what could stop this from showing up?

    Our EE build, etc. is in my signature.

    Thank you so much for any help!

  • #2 / Aug 09, 2012 11:13am

    Lisa Wess

    20502 posts

    Hi, Thambos!

    I am sorry that you are running into this.  The errors that you are showing us indicate that there are some template coding issues.  Can you post the code for the visited template, around line 634 of that template? That does include embeds.

    Thank you!

  • #3 / Aug 09, 2012 12:36pm

    BVUUF_MSC

    22 posts

    I’m not sure which template that specific part is occurring on, and none that I can identify have anywhere near 600 lines.

    The sidebar pulls into a “content_page” template via this code:

    {embed="site/right-col" weblog_name="{segment_1}"}

    “right-col” is long, here that is (sorry I don’t have an account anywhere to post longer chunks of code):

    {exp:weblog:info weblog="{embed:weblog_name}"}
     <div id="rightCol"> 
     
     <?php
      $timestamp = time();
     ?>
     {random_photo}?t=<?=$timestamp?>
       
     <h1 class="afterPhoto">{blog_title}</h1>
     
     <div id="subNav">
     <ul>
     {if embed:weblog_name=="news-events"}
     <li class="page_item"><a href="http://{sitepath}/news-and-events?php">News & Events List</a></li>
    <li class="page_item"><a href="http://{sitepath}/ministers-musings?php">Ministers Musings</a></li>
     {/if}
     {exp:weblog:categories weblog="{embed:weblog_name}" style="linear" parent_only="yes" show_empty="no" disable="category_fields"}
     <li class="page_item"><a href="http://{sitepath}/{embed:weblog_name}/{category_url_title}">{category_name}</a>
      {if segment_2 == category_url_title}
        <? $count=0; 
    $results = FALSE; ?>
       {exp:query sql="SELECT cat_name, cat_url_title, cat_id FROM exp_categories WHERE parent_id={category_id} ORDER BY cat_order ASC"}
        <? $count++; ?>
        {exp:weblog:entries weblog="{embed:weblog_name}" category="{cat_id}" status="open" disable="category_fields|member_data|pagination|trackbacks" rdf="off" dynamic="off"}
        <?php
        if($count == 1){
         $results = TRUE;
        ?>
        <ul><!--subpage-->
        <?php } ?>
        <li class="page_item"><a href="http://{sitepath}/{embed:weblog_name}/{category_url_title}/{cat_url_title}" class="section-select">{cat_name}</a>
        {if segment_3 == cat_url_title}
         {embed="site/fourth_level" this_cat="{cat_id}"}
        {/if}
        </li>
        {/exp:weblog:entries}
        {/exp:query}
        <?php
        if($results){ ?>
        </ul><!--subpage-->
        <?php } ?>
      {/if}
     </li>
     {/exp:weblog:categories}
    {if embed:weblog_name=="sunday-services"}
     <li class="page_item"><a href="http://{sitepath}/sermons-archive?php">Sermons Archive</a></li>
     {/if}
     </ul>
    </div><!--section-nav-->
     </div><!--/rightCol-->
    {/exp:weblog:info}

    And lastly fourth_level:

    <?php $next_count=0; ?>
    {exp:query sql="SELECT cat_name as next_cat_name, cat_url_title as next_cat_url_title, cat_id as next_cat_id FROM exp_categories WHERE parent_id='{embed:this_cat}' ORDER BY cat_order ASC"}
     <? $next_count++;
    $next_results = FALSE; ?>
     {exp:weblog:entries weblog="{segment_1}" category="{next_cat_id}" status="open" disable="category_fields|member_data|pagination|trackbacks" rdf="off" dynamic="off"}
     <?php
     if($next_count == 1){
      $next_results = TRUE;
     ?>
     <ul><!--subpage-->
     <?php } ?>
     <li class="page_item"><a href="http://{sitepath}/{segment_1}/{segment_2}/{segment_3}/{next_cat_url_title}" class="section-select">{next_cat_name}</a></li>
     {/exp:weblog:entries}
    {/exp:query}
    <?php
    if($next_results){ ?>
    </ul><!--subpage-->
    <?php } ?>

    Thanks!

  • #4 / Aug 09, 2012 12:41pm

    Lisa Wess

    20502 posts

    Hi, Kyle,

    The line nmber includes all of the embeds.

    So, the bad news - that is a heck of a complicated template.

    The best way to figure this out will be to separate your template into its own test template, then add one piece of that code.  Test it and make sure it works - then slowly build up the template until you reach the piece of the code that is throwing that error.

    It is tedious, but reduction and isolation is going to be the only way to identify what is going on.  You’ll want to make sure that you’re hard-coding variables rather than passing them as embeds while doing this testing.

    Does that make sense and give you a start into troubleshooting your template?

  • #5 / Aug 09, 2012 12:45pm

    BVUUF_MSC

    22 posts

    I don’t actually know how to do that. These were all set up several people before me.

    Would I do “new template” and then be able to do a new page via Publish > (whatever category)? Or is there a different process to make a page with a new template?

    EDIT: And it would mean multiple pages to make the menu show up, I think. Does that sound right?

    Thanks.

  • #6 / Aug 09, 2012 1:09pm

    Lisa Wess

    20502 posts

    Hi, Kyle,

    Ah, you are new to ExpressionEngine.  This is a ... more complicated area to jump into, honestly.  It’s not where I would prefer to start myself.

    What you’ll need to do is copy your sidebar code into a new template so that you can break it without impacting your live site.  You then need to remove anything that has {embed:??} and hard-code that value.  From there, you need to break the code into small, functional chunks that work then slowly build up that template back to the original until you find what is triggering the error.

    Does that make sense?

    It is a complicated template - it is going to be very difficult for someone new to EE to troubleshoot that successfully.  But we’re here and will do our best to help you out along the way.

  • #7 / Aug 09, 2012 1:23pm

    BVUUF_MSC

    22 posts

    Actually this project is going to have to be passed on to someone else (I just found out about 10 minutes ago), so I won’t be able to go in and do that. Thank you though for the help and I have really appreciated all the assistance I got on here!

  • #8 / Aug 09, 2012 2:03pm

    Lisa Wess

    20502 posts

    Hi, Kyle!  No worries.  If anything else comes up, please do let us know and we will do our best.  Thank you!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases