Fatal error uncaught smarty unable to load template file header tpl

Hi everyone,
    • 44800

    • 6 Posts
    • Send PM

    Hi everyone,

    I’ve just installed MODX and very new to it. I followed the setup as per the instructions and managed to reach the «Congratulations!» page. However, when I click the «Go To Manager» button, I get the following error:

    Fatal error: Uncaught —> Smarty: Unable to load template file ‘header.tpl’ <— thrown in /Applications/XAMPP/xamppfiles/htdocs/modx/core/model/smarty/sysplugins/smarty_internal_template.php on line 219

    Since I am not 100% familiar with the structure or layout of the CMS, is there something I may have missed?

    Thanks in advance
    Michael

      • 3749

      • 24,544 Posts
      • Send PM

      The first thing to do is to see if that file is there.

      You could also try re-running setup.

      Also, it’s possible that file/folder permissions or ownership issues prevented the file from being written.

        • 44800

        • 6 Posts
        • Send PM

        Quote from: BobRay at Nov 21, 2016, 09:32 PM

        The first thing to do is to see if that file is there.

        You could also try re-running setup.

        Also, it’s possible that file/folder permissions or ownership issues prevented the file from being written.

        The file is definitely there, what permissions should be on the file? The installation is on my local host, if that makes a difference?

        • discuss.answer

          • 44800

          • 6 Posts
          • Send PM

          I ended up downloading the zip file from the website instead of installing via command line, and that seemed to do the trick.

            • 3749

            • 24,544 Posts
            • Send PM

            I’m glad you got it sorted. smiley

              • 36931

              • 206 Posts
              • Send PM

              Quote from: memerson at Nov 22, 2016, 11:37 AM

              I ended up downloading the zip file from the website instead of installing via command line, and that seemed to do the trick.

              Dear memerson,
              Are you still around because I have the same problem? Could you let me know how you solve step by step your issue?

              I ma abit anxious, because I already have a web application with MOdx and I do not want to loose resource, setting, etc. I unzip my MODx zip on local and I upload my file to the web server and then I run the installation from /setup/.

              As I already have a database, I do not know I can reinstall my MODx and preserving the resources etc..
              But if I could solve my issue by a simpler way, it would be great!!

              Thank

                • 44800

                • 6 Posts
                • Send PM

                Quote from: pierrot1010 at Oct 17, 2018, 05:13 PM

                Quote from: memerson at Nov 22, 2016, 11:37 AM

                I ended up downloading the zip file from the website instead of installing via command line, and that seemed to do the trick.

                Dear memerson,
                Are you still around because I have the same problem? Could you let me know how you solve step by step your issue?

                I ma abit anxious, because I already have a web application with MOdx and I do not want to loose resource, setting, etc. I unzip my MODx zip on local and I upload my file to the web server and then I run the installation from /setup/.

                As I already have a database, I do not know I can reinstall my MODx and preserving the resources etc..
                But if I could solve my issue by a simpler way, it would be great!!

                Thank

                Hi, sorry — this was posted years ago! I don’t use ModX anymore, I prefer using frameworks such as Laravel and Symfony now to do my projects. I’d recommend opening a new post so it’s fresh for others to reply to.

                За последние 24 часа нас посетили 11474 программиста и 1168 роботов. Сейчас ищут 302 программиста …


                1. AlexsaiL

                  AlexsaiL
                  Активный пользователь

                  С нами с:
                  23 дек 2016
                  Сообщения:
                  327
                  Симпатии:
                  23

                  подскажите пожалуйста, почему в шаблонизаторе Smarty файл c расширением tpl не подключается внутри файла tpl?

                  Вылетает ошибка:

                  Fatal error: Uncaught —> Smarty: Unable to load template ‘file:header.tpl’ in ‘template/index.tpl’ <— thrown in C:OpenServerdomainsnew.Smartylibssyspluginssmarty_internal_template.php on line 163

                  Хотя оба файла находятся в одной папке, но стоит только вытащить файл в корень, он его сразу видит и подключает.
                  в index.tpl не могу подключить {include file=’header.tpl’}

                  p.s. не нашел на форуме подходящего раздела по Smarty, решил написать в текущий.

                2. Может путь не полный?

                  {include file=’template/header.tpl’}


                3. AlexsaiL

                  AlexsaiL
                  Активный пользователь

                  С нами с:
                  23 дек 2016
                  Сообщения:
                  327
                  Симпатии:
                  23

                  пробовал разные пути прописывать, что то не хочет


                4. coder1

                  С нами с:
                  29 июн 2021
                  Сообщения:
                  4
                  Симпатии:
                  1

                  Здравствуйте, у меня была точно такая же ошибка, и я решил её так:

                  1. {include file=»templates/header.tpl»}

                I have a smarty-test02 project, in the php/test.php file:

                <?php
                
                require($_SERVER['DOCUMENT_ROOT'] . '/smartyHeader.php');
                require_once($_SERVER['DOCUMENT_ROOT'] . '/test/test01.php');
                
                $msg = 'hello world, this is my first Smarty!';
                $title = 'Smarty Title';
                
                $smarty->assign('title', $title);
                $smarty->assign('message', $msg);
                
                $movies_arr = array('A'=>'a film', 'B' => 'b file', 'C' => 'c film');
                
                $smarty->assign('movie_arr', $movies_arr);
                
                $smarty->assign('v', ['a', 'b', 'c']);
                
                $extraTemplateVariables = array();
                
                $extraTemplateVariables['test_list'] = ['a', 'b', 'c', 'd'];
                $extraTemplateVariables['selected_product'] = '';  
                
                $smarty->assign('extraTemplateVariables', $extraTemplateVariables);
                
                $smarty->display('test.tpl');
                

                and its template is templates/test.tpl :

                <html>
                    <head>
                        <title>{$title}</title>
                    </head>
                    <body>
                        {*{$title}*}
                    </body>
                {literal}
                    <script lang="javascript">
                        function fun(){
                            alert('asd');// there I want to alert the $title)
                        }
                        fun();
                    </script>
                {/literal}
                
                </html>
                

                but when I access the test.php by http://localhost:63342/smarty-test02/php/test.php I get bellow error:

                Fatal error: Uncaught —> Smarty: Unable to load template ‘file:test.tpl’ <— thrown in /Users/sof/Desktop/TestPHP/smarty-test02/libs/sysplugins/smarty_internal_template.php on line 187


                EDIT-1

                In my smartyHeaders.php:

                <?php
                
                require_once($_SERVER['DOCUMENT_ROOT'] . '/libs/Smarty.class.php');
                
                $smarty = new Smarty();
                $smarty->caching = true;
                $smarty->cache_lifetime = 120;
                $smarty->template_dir = './templates';
                $smarty->compile_dir = './templates_c';
                

                EDIT-2

                The directory structure:

                $ tree .
                .
                ├── addon
                │   └── test01_addon.php
                ├── cache
                │   └── a521c2377356a0c5c1792bcb5adcde857b3c48e3.test.tpl.php
                ├── composer.phar
                ├── libs
                │   ├── Autoloader.php
                │   ├── Smarty.class.php
                │   ├── SmartyBC.class.php
                │   ├── bootstrap.php
                │   ├── debug.tpl
                │   ├── libs - Verknu�210pfung.lnk
                │   ├── plugins
                │   │   ├── block.textformat.php
                      ...
                │       ├── smarty_variable.php
                │       ├── smartycompilerexception.php
                │       └── smartyexception.php
                ├── php
                │   └── test.php
                ├── smartyHeader.php
                ├── templates
                │   ├── child.tpl
                │   ├── parent.tpl
                │   ├── php
                │   │   └── test.tpl
                │   ├── test01.tpl
                │   └── test02.tpl
                ├── templates_c
                │   ├── 3963a63f17ac1e915beafe6a28decb3ece4b8a7a_0.file.test01.tpl.cache.php
                └── test
                    └── test01.php
                

                View previous topic :: View next topic  
                Author Message
                ihabzy
                Smarty Rookie

                Joined: 27 Jul 2012
                Posts: 9

                PostPosted: Fri Jul 27, 2012 4:33 am    Post subject: Managing subdirectories Reply with quote

                Hello,

                I need to make certain file to be in a sub directory in the form «company/about.php»

                The file about.php code is

                Code:

                <?php

                require(‘includes/smarty/SmartyBC.class.php’);

                $smarty = new SmartyBC;

                $smarty->assign(«tmpdir», «templates»);

                include (‘config.php’);

                $page = array(

                         ‘title’ => ‘Al Debeiky Pharma | About Company’,

                         ‘description’ => ‘Leading integrated global Pharmaceutical Company engaged in the development, Manufacturing Marketing and sales of pharmaceutical, Herbal Brands, food supplements, cosmetics and Veterinary Products’,

                         ‘keywords’ => ‘DBK, Pharmaceutical, medical, Al Debeiky’,

                         ‘nav’ => ‘home’,

                      );

                $smarty->assign(«page», $page);

                $smarty->display(‘header.tpl’);

                $smarty->display(‘about.tpl’);

                $smarty->display(‘footer.tpl’);

                ?>

                but when I go to company/about.php I got a blank page.

                I am not very advanced in Smarty so, detailed instruction would be very helpful

                Thanks a lor

                Back to top

                View user's profile Send private message

                mohrt
                Administrator

                Joined: 16 Apr 2003
                Posts: 7368
                Location: Lincoln Nebraska, USA

                PostPosted: Fri Jul 27, 2012 2:43 pm    Post subject: Reply with quote

                check your php error log anytime you get blank pages.
                Back to top

                View user's profile Send private message Visit poster's website

                ihabzy
                Smarty Rookie

                Joined: 27 Jul 2012
                Posts: 9

                PostPosted: Fri Jul 27, 2012 10:10 pm    Post subject: Error Log file Reply with quote

                I checked my PHP error log which found to be empty of errors
                Back to top

                View user's profile Send private message

                ihabzy
                Smarty Rookie

                Joined: 27 Jul 2012
                Posts: 9

                PostPosted: Fri Jul 27, 2012 10:26 pm    Post subject: I checked again Reply with quote

                i got this error when I enable display errors in PHP

                Code:

                Fatal error: Uncaught exception ‘SmartyException’ with message ‘Unable to load template file ‘header.tpl» in D:wampwwwdbkincludessmartysyspluginssmarty_internal_templatebase.php on line 127

                ( ! ) SmartyException: Unable to load template file ‘header.tpl’ in D:wampwwwdbkincludessmartysyspluginssmarty_internal_templatebase.php on line 127

                Call Stack

                #   Time   Memory   Function   Location

                1   0.0004   327128   {main}( )   ..about.php:0

                2   0.0170   1667760   Smarty_Internal_TemplateBase->display( )   ..about.php:15

                3   0.0170   1667888   Smarty_Internal_TemplateBase->fetch( )   ..smarty_internal_templatebase.php:374

                Back to top

                View user's profile Send private message

                mohrt
                Administrator

                Joined: 16 Apr 2003
                Posts: 7368
                Location: Lincoln Nebraska, USA

                PostPosted: Sat Jul 28, 2012 12:20 am    Post subject: Reply with quote

                so a template can’t be loaded, try to test:

                $smarty->testInstall();

                Back to top

                View user's profile Send private message Visit poster's website

                ihabzy
                Smarty Rookie

                Joined: 27 Jul 2012
                Posts: 9

                PostPosted: Sat Jul 28, 2012 12:27 am    Post subject: Reply with quote

                Where should I have to put this code

                Code:
                $smarty->testInstall();

                Back to top

                View user's profile Send private message

                mohrt
                Administrator

                Joined: 16 Apr 2003
                Posts: 7368
                Location: Lincoln Nebraska, USA

                PostPosted: Sat Jul 28, 2012 1:54 am    Post subject: Reply with quote

                right after you get smarty instantiated and dirs all setup. then run this test and exit.
                Back to top

                View user's profile Send private message Visit poster's website

                ihabzy
                Smarty Rookie

                Joined: 27 Jul 2012
                Posts: 9

                PostPosted: Sat Jul 28, 2012 4:30 am    Post subject: Reply with quote

                Here are the test result

                Code:

                Smarty Installation test…

                Testing template directory…

                FAILED: .templates does not exist.

                Testing compile directory…

                D:wampwwwdbkcompanytemplates_c is OK.

                Testing plugins directory…

                D:wampwwwdbkincludessmartyplugins is OK.

                Testing cache directory…

                FAILED: .cache does not exist.

                Testing configs directory…

                FAILED: .configs does not exist.

                Testing sysplugin files…

                … OK

                Testing plugin files…

                … OK

                Tests complete.

                Back to top

                View user's profile Send private message

                U.Tews
                Administrator

                Joined: 22 Nov 2006
                Posts: 5068
                Location: Hamburg / Germany

                PostPosted: Sat Jul 28, 2012 8:33 am    Post subject: Reply with quote

                See in the test results. The template sourc directory was not set with the location of you template file.

                Call

                $smarty->setTemlateDir(….); with the path to your template files

                Back to top

                View user's profile Send private message

                ihabzy
                Smarty Rookie

                Joined: 27 Jul 2012
                Posts: 9

                PostPosted: Sat Jul 28, 2012 8:42 am    Post subject: Reply with quote

                Thanks for your reply

                I added the code and it got fixed. The only problem is that I had to make a new copy of header.tpl which I made it header2.tpl to change the stylesheet directory from ./{$tmpdir}/css/style.css to ../{$tmpdir}/css/style.css

                Is there any other way to correct the template directory to work the same for all files.

                Back to top

                View user's profile Send private message

                U.Tews
                Administrator

                Joined: 22 Nov 2006
                Posts: 5068
                Location: Hamburg / Germany

                PostPosted: Sat Jul 28, 2012 9:00 am    Post subject: Reply with quote

                Add the ‘./’ or ‘../’ to your $temdir variable and use in your header {$tmpdir}/css/style.css
                Back to top

                View user's profile Send private message

                ihabzy
                Smarty Rookie

                Joined: 27 Jul 2012
                Posts: 9

                PostPosted: Sat Jul 28, 2012 5:57 pm    Post subject: Reply with quote

                I appreciate the long interval support. It helped me a lot

                A big thank you

                Back to top

                View user's profile Send private message

                Display posts from previous:   

                You cannot post new topics in this forum
                You cannot reply to topics in this forum
                You cannot edit your posts in this forum
                You cannot delete your posts in this forum
                You cannot vote in polls in this forum

                New issue

                Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

                By clicking “Sign up for GitHub”, you agree to our terms of service and
                privacy statement. We’ll occasionally send you account related emails.

                Already on GitHub?
                Sign in
                to your account


                Closed

                sakshi083 opened this issue

                Jun 29, 2016

                · 17 comments


                Closed

                MODX missing lexicon values

                #13058

                sakshi083 opened this issue

                Jun 29, 2016

                · 17 comments

                Comments

                @sakshi083

                I am new to MODX. I have installed MODX Revolution 2.2.0-pl2 (traditional) on a windows shared server.
                PHP version 5.6.
                After installation lexicon values are missing. No entries found under system->lexicon management.
                This results in improper website back-end and front-end. I also googled the issue but I found nothing helpful.Need help.

                @Mark-H

                MODX 2.2.0-pl2? That’s pretty old, any reason you didn’t install the latest stable version?

                @sakshi083

                I am moving a site from another server. And, the existing site is in MODX 2.2.0-pl2. Don’t want to mess up with newer version.

                @Jako

                I suppose it is a PHP version issue. What version do you have on the old host, what version on your local host?

                @sakshi083

                On old host version is PHP 5.3 and on new host (Provided by network solutions) its 5.6.
                Everything was working good on old server. On local server froent end works but back end has a very different UI. No lexicon values being fetched. Can you tell me where we code to include lexicon files?

                @Jako

                Could you downgrade your windows shared server to PHP 5.3 to test, if it works with that version?

                If not: Maybe something is misconfigured in MODX. If the backend is showing issues, deactivate compress_js/compress_css with in modx_system_settings table and clear the cache folder after this.

                @sakshi083

                No, I cannot downgrade PHP Version becuse it is windows server.
                And, I already deactivated compress_js/compress_css with in modx_system_settings table.
                Also, cleared cache folder. but nothing works.

                @Jako

                Is it a live site? Otherwise you should try an update to 2.5 (maybe with a few version stops between: 2.2 -> 2.3 -> 2.4 -> 2.5).

                @sakshi083

                @Jako

                @sakshi083

                I have created a local copy with PHP 5.2.9 and everything is working fine there.

                @sakshi083

                I cannot downgrade PHP version from 5.6 to 5.3 on new hosting as it is a shared server. Please help.

                @Mark-H

                My guess is that if you can’t downgrade PHP, you’ll need to upgrade MODX. While I can’t guarantee it solves this issue, it will resolve tons of bugs that have been fixed since 2.2, including several security related ones.

                @Jako

                You could upgrade the local copy to 2.5 and upload this to a different host (i.e. a subdomain) on the shared server …

                @sakshi083

                I upgraded local copy to 2.5 also upgraded PHP version on local to 5.6.21. Everything works fine on local.
                So, I upgraded MODX to version 2.5 on Server. Now when I run setup I get this error:
                Fatal error: Uncaught —> Smarty: Unable to load template file ‘header.tpl’ <— thrown in wwwcoremodelsmartysyspluginssmarty_internal_template.php on line 219

                Unable to run setup.Please help.

                @OptimusCrime

                Does this happen when you try to run the setup? Missing files might suggest something has gone wrong while uploading/moving the files. I can not reproduce this at this end. Also, it might be smart to open individual issues dealing with different things.

                @wuuti

                @sakshi083 Did you manage to upgrade your old site?

                I think this issue can be closed.

                @pixelchutes

                Agreed. Please move this conversation to Slack or the forums if you are seeking further support.

                Понравилась статья? Поделить с друзьями:

                Читайте также:

              • Fatal error uncaught exception error table
              • Fatal error uncaught exception error could not load model
              • Fatal error uncaught error undefined constant
              • Fatal error uncaught error operator not supported for strings in
              • Fatal error uncaught error function name must be a string in

              • 0 0 голоса
                Рейтинг статьи
                Подписаться
                Уведомить о
                guest

                0 комментариев
                Старые
                Новые Популярные
                Межтекстовые Отзывы
                Посмотреть все комментарии