Question

I try to create a CakePHP application based on themes. I using the latest version CakePHP 2.0.0

My application consists from that files

/app/Controller/AppController.php

class AppController extends Controller
{
    public $helpers = array('Html', 'Session', 'Form');

    public function beforeFilter()
    {
        $this->setupTheme();
    }

    private function setupTheme()
    {
        $this->viewClass = 'Theme';
        $this->theme = 'Mars';
        $this->layout = 'admin';
    }
}

/app/Controller/LanguagesController.php

class LanguagesController extends AppController
{
    public $name = "Languages";

    public function index()
    {}
}

/app/View/Themed/Mars/Languages/index.php

// Currently Empty

/app/View/Themed/Mars/Layouts/admin.ctp

<?php echo $this->Html->docType('xhtml-strict'); ?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <?php echo $this->Html->charset(); ?>
    <meta name="author" content="Nikos Merianos" />

<title><?php echo $title_for_layout; ?></title>

    <?php
        echo $this->Html->meta('icon');
        echo $this->Html->css('amdin.css');
?>
</head>

<body>
    <?php 
        echo $this->Session->flash(); 
        echo $content_for_layout;
        echo $this->element('sql_dump');
        echo $scripts_for_layout;
    ?>
</body>
</html>

/app/View/Themed/Mars/webroot/css/admin.css

body
{
    background: #FA0;
}

My problem now

Why the code into admin.ctp under Layout folder in line 11 (echo $this->Html->css('amdin.css');) return the following result :

<link rel="stylesheet" type="text/css" href="/mars/css/amdin.css" />

The problem is that link is incorect. The CSS file is not loaded because does not exists into that path. Any idea please ?

Was it helpful?

Solution

admin should be admin, not amdin

Edit: like Farray said.

OTHER TIPS

Check your spelling...

/app/View/Themed/Mars/webroot/css/admin.css

<link rel="stylesheet" type="text/css" href="/mars/css/amdin.css" />

You have letters in 'admin' transposed when you include your CSS file...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top