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

  • SEARCH
  • Home
  • 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 8358737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:53:48+00:00 2026-06-09T10:53:48+00:00

I want to use a css parser that uses namespaces. I put the files

  • 0

I want to use a css parser that uses namespaces. I put the files in vendors and app imported it. but the script itself does not seem to find its classes

At the top of my class I import the file:

App::import('Vendor', 'Sabberworm', array('file' => 'Sabberworm/CSS/Parser.php'));

which is in /root/vendors/Sabberworm/CSS/ (all files are in this namespace)

Inside my class method I create a new instance:

public function parse($content) {
    $oParser = new Sabberworm\CSS\Parser($content);
    ...
}

So far so good. But if I now want to call $oCss = $oParser->parse(); it fatal errors:

"Fatal error: Class 'Sabberworm\CSS\CSSList\Document'"

it fails then because it requires the other files (which should be loaded using namespaces). the root vendors folder is in the include path and the foreign script seems to set the namespace to “namespace Sabberworm\CSS;”. what am I missing? I am kinda new to namespaces.

  • 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-09T10:53:49+00:00Added an answer on June 9, 2026 at 10:53 am

    Add this to bootstrap

    spl_autoload_register(function($class) {
        foreach(App::path('Vendor') as $base) {
            $path = $base . str_replace('\\', DS, $class) . '.php';
            if (file_exists($path)) {
                return include $path;
            }
        }
    });
    

    Or just this inside the function:

    $path = APP . 'Vendor' . DS . str_replace('\\', DS, $class) . '.php';
    if (file_exists($path)) {
        include $path;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I realize that the CSS parser that GWT uses will only handle CSS2, but
I have some html files with their own css. I want to use them
dont want to use css frameworks like 960 cause that will lock the width.
I want to use CSS to format my GridView rows. I've set up my
I want to use conditional css in my datatable. Here is my code. <ui:repeat
I want to use rounded border in my site. So, I use the CSS
I want to use the filter CSS property for both a gradient and an
I want to use YUI Compressor to combine and compress my css and js
I'm trying to use the CSS word-wrap property with break-word value. I want to
I want to add an external css sheet and I use this JS code:

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.