I'm learning Zend Framework... having this problem...
If I go to the URL www.mydomain.com/Index will work FINE but I go to the URL www.mydomain.com/Index/index the CSS and IMAGE will NOT WORK...
OR for example:
If I go to the URL www.mydomain.com/Faq will work FINE but I go to the URL www.mydomain.com/Faq/test the CSS and IMAGE will NOT WORK...
I don't understand why it work only if you specify the Controller and not Action...
In my layout.phtml I have:
<?php
$this->headLink()->appendStylesheet(BASE_URL . 'css/style.css');
$this->headLink()->appendStylesheet(BASE_URL . '/css/header.css');
$this->headLink()->appendStylesheet(BASE_URL . 'css/footer.css');
echo $this->headLink();
?>
And in public/index.php I have:
$config = new Zend_Config_Ini(
APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
$baseUrl = $config->baseHttp;
define('BASE_URL', $baseUrl);
And for example an image in layout.phtml:
<img src="<?= BASE_URL ?>immagini/footer_info.png" alt="info" />
What's wrong?
Maybe the problem is the .htaccess or those stuff... So I tell you more...
My hosting have the public root: public_html
Inside public_html I have different project folder. Example: Project1 and Project2 ( both with Zend Framework ).
In public_html/Project1 folder I have:
- Application
- Public
- ....
index.php
include 'public/index.php';
.htaccess
SetEnv APPLICATION_ENV development RewriteEngine On RewriteRule .* index.php
In public_html/Project1/public I have:
- CSS folder
- images folder
- js folder
.htaccess
SetEnv APPLICATION_ENV development RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.$ - [NC,L] RewriteRule ^.$ index.php [NC,L]
index.php ( another one )
// Define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(FILE) . '/../application'));
// Define application environment defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array( realpath(APPLICATION_PATH . '/../library'), get_include_path(), )));
/** Zend_Application */ require_once 'Zend/Application.php';
// Create application, bootstrap, and run $application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' );
$config = new Zend_Config_Ini( APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV); $baseUrl = $config->baseHttp; define('BASE_URL', $baseUrl);
$application->bootstrap() ->run();
Thanks again...
Samuele
$config->baseHttp
set to? And what does the output HTML look like for the CSS and img paths in the working and non-working pages? – ChrisA