Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8600803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:41:52+00:00 2026-06-12T01:41:52+00:00

Question In the ‘default’ layout for my Lithium install I have the following code:

  • 0

Question

In the 'default' layout for my Lithium install I have the following code:

<?php echo $this->html->script(array('jquery-1.7.1-dev.js')); ?>

For all normal requests (e.g. /path/to/framework/users/login, where Users is a model and there is a UsersController::login method) this is rendered correctly as:

<script type="text/javascript" src="/path/to/framework/js/jquery-1.7.1-dev.js"></script>` 

However, in views that are rendered by my error handling code the /path/to/framework is omitted and it is rendered as:

<script type="text/javascript" src="/js/jquery-1.7.1-dev.js"></script>

Why is the helper not rendering the path correctly in this case?


Error-handling approach

My error handling approach is based on a number of online tutorials. In config/bootstrap/errors.php I have:

$exampleConditions = array('type' => 'Exception');
ErrorHandler::apply('lithium\action\Dispatcher::run', $exampleConditions, function($info, $params) {
    return ErrlogsController::handleError($info, $params);
});
ErrorHandler::run();

In the ErrlogsController class I have:

public static function handleError($info, $params) {
    // (Code to save error info to DB omitted from example)
    $view = new View(array(
        'paths' => array(
            'template' => '{:library}/views/{:controller}/{:template}.{:type}.php',
            'layout'   => '{:library}/views/layouts/{:layout}.{:type}.php'
        )
    ));
    return $view->render('all', array(), array(
        'template' => '404',
        'controller' => 'errlogs',
        'layout' => 'default',
        'type' => 'html'
    ));
}

I have code dived as deep as lithium\template\view\Renderer::applyHandler and the File adapter which do the actual rendering to try and understand this behaviour, and I have also tried adding an 'elements' key to the 'paths' array for $view but I am a bit stuck. Any suggestions or help is much appreciated.


Background

The below two links show how to use ErrorHandler::apply function (as in above code) and also ErrorHandler::config. Both use the same approach as in the above code to render a view, and the first is also tangentially interesting to this post though because it also shows how to handle different types of errors differently.

  • Example one – masom
  • Example two – Lithium wiki – shows how to use the ErrorHandler::apply function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T01:41:53+00:00Added an answer on June 12, 2026 at 1:41 am

    Components of the framework get their application base path information from the Request object, which the View class delegates to its helpers, unless of course it hasn’t received it itself.

    In your case, you could either pass it in the 'request' key to View‘s constructor, or update to a more modern version of error handling code, as per this: https://github.com/UnionOfRAD/framework/blob/master/app/config/bootstrap/errors.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Question: I receive the following error for the code below, does anyone know why?
Question for the video tag, the following code works for every browsers expect opera
Question when running the following code: X509Certificate2 cert = new X509Certificate2(@C:\file.p12, password, X509KeyStorageFlags.Exportable); RSACryptoServiceProvider
Question: Can someone help me fix the following piece of code to meet the
Question: Have I got this example backwards? Is the reason to return Interface so
Question is already been asked in title. Here is a code: (function($){ var filter
Question in title pretty much sums it up. I have some resource object defined
Question is similar to this one How to write a MySQL query that returns
Question should be self explanatory. I have a datagridview which has a column whose
Question How can I remove empty xml tags in PHP? Example: $value1 = 2;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.