sermon
(Mat Bl)
August 19, 2010, 9:06am
1
Hi All.
While i was configuring the UrlManager, i saw that he is deleting my pics.
if i use:
'urlManager'=>array(
'urlFormat'=>'path',
All my pictures are away and i see only a little broke symbol. If i comment out this line everything works fine.
What is this?
Do i have do configure more?
Y11
(Y!!)
August 19, 2010, 9:17am
2
What you mean with pics? Pictures you serve by a controller-action?
sermon
(Mat Bl)
August 19, 2010, 9:26am
3
For example the header.
got this:
<div id="header">
<div id="logo"><?php echo CHtml::link(CHtml::image('images/stbg-logo-de.gif'), Yii::app()->request->baseUrl); ?></div>
</div><!-- header -->
while using the url format this is delete. i just only see the location. where it should be. but the image is not shown.
Y11
(Y!!)
August 19, 2010, 9:30am
4
Then check out the source of the rendered html and see what output it produces (url of the images).
Also usually it’s best to put a slash before the relative image path:
/images/stbg-logo-de.gif
sermon
(Mat Bl)
August 19, 2010, 9:41am
5
<div id="header">
<div id="logo"><a href="/yii/stueh"><img src="/images/stbg-logo-de.gif" alt="" /></a></div>
</div><!-- header -->
This is the sourcecode out of the HMTL. And it’s correct.
But the / before. Nothing happened. Still the failure, Can’t find Object.
Y11
(Y!!)
August 19, 2010, 9:47am
6
Strange, and what if you rightclick on the broken image and select "display image"? Then it shows I guess??
sermon
(Mat Bl)
August 19, 2010, 9:57am
7
I haven’t got the menupoint “display image”
if i try to open in new tab i get an 404 error.
do i also have to create actions for images?
andy_s
(Arekandrei)
August 19, 2010, 10:02am
8
Check your .htaccess:
# If a directory or a file exists, use it directly.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php.
RewriteRule . index.php
RewriteCond is mandatory.
sermon
(Mat Bl)
August 19, 2010, 10:12am
9
Ok. Also have read something like this. but isn’t this also necessaray fo:
'showScriptName' => false,
And. Guys. Wehre the hell is the .htaccess or better, where do i have to put it.
DocumentRoot. OK. But where the hell is it?
my Directories look like that:
D:\xampp\htdocs\yii\porject1
and my projects went so on. project2 project3 etc.
so where i must put the .htaccess???
andy_s
(Arekandrei)
August 19, 2010, 11:37am
10
sermon:
Ok. Also have read something like this. but isn’t this also necessaray fo:
'showScriptName' => false,
And. Guys. Wehre the hell is the .htaccess or better, where do i have to put it.
DocumentRoot. OK. But where the hell is it?
my Directories look like that:
D:\xampp\htdocs\yii\porject1
and my projects went so on. project2 project3 etc.
so where i must put the .htaccess???
The hell advises to put it where your index.php resides.
andy_s
(Arekandrei)
August 19, 2010, 12:51pm
12
sermon:
nothing changed.
.htaccess should look like:
Options +FollowSymLinks
IndexIgnore */*
<IfModule mod_rewrite.c>
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
</IfModule
And, of course, Apache’s mod_rewrite should be enabled.
zaccaria
(Matteo Falsitta)
August 19, 2010, 2:05pm
13
Maybe you need the base url.
If you entry script is something like localhost/yiiapp/index.php you have to explicity this base url with:
CHtml::link(CHtml::image( Yii::app()->request->baseUrl.'images/stbg-logo-de.gif')
sermon
(Mat Bl)
August 19, 2010, 2:20pm
14
Mine:
<?php echo CHtml::link(CHtml::image('/images/stbg-logo-de.gif'), Yii::app()->request->baseUrl); ?>
What’s the difference
The Module is on. Shall i change anything in my vhost conf?
andy_s
(Arekandrei)
August 19, 2010, 4:33pm
15
First, check if rewrite module really works. Add some rules, e.g.:
RewriteRule ^test$ test.php
and then access http://site/test
sermon
(Mat Bl)
August 20, 2010, 6:03am
16
Doesn’t work.
Btw i got an apache in xampp.
Shall i change anything in my view pages? work with CHttpRequest?
andy_s
(Arekandrei)
August 20, 2010, 9:19am
17
So your rewrite engine doesn’t work. I’m not familiar with xampp, so it’s the first link from Google: http://rudyegenias.wordpress.com/2006/08/21/enabling-mod-rewrite-in-xampp/
sermon
(Mat Bl)
August 20, 2010, 9:47am
18
the modul was enabled. but the other point not. i have changed it. and suprise?!
nothing changed.
mikl
(Mike)
August 20, 2010, 9:47am
19
It’s possible that your .htaccess files are not used. It requires the AllowOverride setting in Apache for this directory to be set. You can also google this for more details.
sermon
(Mat Bl)
August 20, 2010, 9:49am
20
looking for it.
found this:
<Directory "D:/xampp/cgi-bin">
AllowOverride All
Options None
Order allow,deny
Allow from all
</Directory>
and this:
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
nothin’ changed