Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

Adding a stylesheet

edited February 2014 in Apps

Adding a stylesheet gives an error if there are no *.html files in layouts/*/*.html:

ErrorException: Invalid argument supplied for foreach()
Debugger::handle_error (2, "Invalid argument supplied for foreach()", "/path/to/apps/designer/handlers/add/stylesheet.php", 30, array(13))

30 /path/to/apps/designer/handlers/add/stylesheet.php

28.     $o->layouts[] = basename ($layout, '.html');
29. }
30. foreach (glob ('layouts/*/*.html') as $layout) {
31.     $o->layouts[] = basename ($layout, '.html');
32. }

Adding a check for the layouts fixes it, and I was about to submit a pull request, but then I started to wonder why the stylesheet handler was looking for layouts at all. Is it supposed to be like that, or should it be looking for stylesheets in css/*.css instead of layouts in layouts/*.html?

Comments

  • I just added a fix for this. It should be checking that glob() returns an array.

    The reason it's pulling the list of templates is for the layouts dropdown list in the CSS editor, so you can choose which template to preview the CSS with.

Sign In or Register to comment.