Zend Framework css image just url with cotroller but not with the action

MarcUU

New Member
I'm learning Zend Framework... having this problem...If I go to the URL www.mydomain.com/Index will work FINEbut 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 FINEbut 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:\[code\]<?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();?>\[/code\]And in public/index.php I have:\[code\]$config = new Zend_Config_Ini( APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);$baseUrl = $config->baseHttp;define('BASE_URL', $baseUrl);\[/code\]And for example an image in layout.phtml:\[code\]<img src="http://stackoverflow.com/questions/7646129/<?= BASE_URL ?>immagini/footer_info.png" alt="info" />\[/code\]What's wrong?Maybe the problem is the .htaccess or those stuff... So I tell you more...My hosting have the public root: public_htmlInside 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.phpinclude 'public/index.php';
  • .htaccessSetEnv APPLICATION_ENV developmentRewriteEngine OnRewriteRule .* index.php
In public_html/Project1/public I have:
  • CSS folder
  • images folder
  • js folder
  • .htaccessSetEnv APPLICATION_ENV developmentRewriteEngine OnRewriteCond %{REQUEST_FILENAME} -s [OR]RewriteCond %{REQUEST_FILENAME} -l [OR]RewriteCond %{REQUEST_FILENAME} -dRewriteRule ^.$ - [NC,L]RewriteRule ^.$ index.php [NC,L]
  • index.php ( another one )// Define path to application directorydefined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(FILE) . '/../application'));// Define application environmentdefined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));// Ensure library/ is on include_pathset_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
 
Top