|
|||
|
Hello,
I use my company logo for the web, place it in the pub/images/logo.jpg My directory structure: - app (controllers (indexController.php (indexAction, testAction)), models, views) - lib - pub (images, scripts, styles) - file .htaccess - file index.php in the file app/views/index.tpl.php (which is rendered by indexAction, I put the image src like this: pub/images/logo.jpg. When I opened mytestweb.com , the image is displayed perfectly. I saw in the source that the image scr path is the same as above (pub/images/logo.jpg) Now, I click the Test link in the main page that goes to http://mytestweb.com/index/test. that testAction also renders the same tpl file (index.tpl.php). The page loads perfectly only without the image displayed. I viewed source and see the image scr path is: pub/images/logo.jpg So far my solution for this, is I created a static path in my config.ini file, load it, then use that path for the image scr path. so my image scr path in index.tpl.php looks like this: Code:
<img src="<?php echo $this->siteName;?>/pub/images/logo.jpg"> So my question is, are there any different and better solution? Thanks Last edited by Tommy1402 : 05-22-2007 at 04:39 AM. |
|
||||
|
Hello,
I personally using rewrited rules for routes. URL's will look like this: http://www.domain.com/url-_in-a-diff...ile-under-root
__________________
Zend Framework Tutorials | Zend Framework Forums | Zend Framework IRC Channel | | Zend Framework Resources | CoreShifter |
|
|||
|
Quote:
Code:
RewriteEngine on RewriteRule .* index.php php_flag magic_quotes_gpc off php_flag register_globals off |
|
||||
|
No, I guess your format is ok for what you need.
MY routes are defined in a .ini file and i am using a format customized, derived from this format: routes.sa.route = ":controller_:action_ aram1" ...........
__________________
Zend Framework Tutorials | Zend Framework Forums | Zend Framework IRC Channel | | Zend Framework Resources | CoreShifter |
|
||||
|
this is a slightly nicer rewrite rule
RewriteEngine on RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 I'm not exactly sure what your problem is, but I am under the impression that you have trouble with the image path? Wouldn't something like <?php echo $this->baseURL;?>/pub/foo/bar.jpg work for you? Perhaps being lazy and just set everything relative to root /pub/foo/bar.jpg
__________________
Zym Framework - A Zend Framework extension library w/ demo app SpotSec Blog: http://spotsec.com/blog |
|
|||
|
Quote:
btw, thx for the .htaccess suggestion |
![]() |
| Thread Tools | |
| Display Modes | |
|
|