Debugging A Template Error

Discussion in 'Commonly Asked Questions and Their Solutions' started by renlok, Jun 24, 2012.

Thread Status:
Not open for further replies.
  1. renlok

    renlok Administrator Staff Member

    Joined:
    Oct 20, 2008
    Messages:
    2,858
    Likes Received:
    330
    This is a quick guide of how to debug the incredably unhelpful template compliler errors.

    If you don't know what I mean heres an example
    Parse error: parse error in C:\wamp\www\webid\includes\template.php(166) : eval()'d code on line 69
    View attachment 781

    Now the only helpful part of this is 69 which is the line in the cache file that contains the error

    If you dont know what template file has the error open the page you are on in your fravorite text editor and search for
    PHP:
    $template->set_filenames(array(
    it will look something like
    PHP:
    $template->set_filenames(array(
            
    'body' => 'newfaq.tpl'
            
    ));
    where newfaq.tpl is the template file.

    Now you can either open the template file now and look through to find the error or look in the cache file to get a more accurate idea of whats wrong (recommended on large files).

    If you choose the cache route open the cache folder in your WeBid root and the file your looking for will be named something like tpl_defaultadmin_newfaq.tpl or tpl_default_newfaq.tpl where default is the name of your theme and newfaq.tpl is the name of the theme file. If the theme file is for the admin backend it will have admin directly after the theme name like the first example.

    Now once you've found the correct file now open it up and go to the line indecated by the initial error (in this example 69) this should help you unerstand what wrong. Then fix it in your theme file.

    If you dont know any php I'd recommend DBGP Plugin for NotePad++ to help debuging
     
    BabyDunk likes this.
Thread Status:
Not open for further replies.

Share This Page