apprentice (77) [Avatar] Offline
#1
When you check the source code in a web browser:
http://localhost/zfia/ch04/places/public/index.php/

Should the css and the images be showing?
Is the books intention that I should fix this myself in order to see them or will later chapters fix this for me?

I'm still not comfortable enough with all the inner workings of MVC to see where the problem is located. So I have a hard time tracking what I'm doing wrong.
If this chapter's intention isn't to show working CSS and images then I can move on with a clear concious. But if not then I have a problem Houston, help!
noma (5) [Avatar] Offline
#2
Re: Chapter 4 - I'm confused
Hi, iam not sure about your problem, but from your words i think that you are using wrong URL, thats all. Try this:
http://localhost/zfia/ch04/places/public/
apprentice (77) [Avatar] Offline
#3
Re: Chapter 4 - I'm confused
Nah that's not the problem I tried your link also. Besides both of those links points to the same file. Something else is wrong.

I also checked the other Chapters to see if I could see the CSS and Images but the same problem there.
Something isn't connected right but what?

http://localhost/zfia/ch04/places/public/index.php
http://localhost/zfia/ch05/places/public/index.php
http://localhost/zfia/ch06/places/public/index.php
http://localhost/zfia/ch07/places/public/index.php
http://localhost/zfia/ch08/places/public/index.php
http://localhost/zfia/ch09/places/public/index.php
http://localhost/zfia/ch15/places/public/index.php
akrabat (479) [Avatar] Offline
#4
Re: Chapter 4 - I'm confused
Can you see the reference to the CSS file in the source view?

Regards,

Rob...
apprentice (77) [Avatar] Offline
#5
Re: Chapter 4 - I'm confused
SECOND TRIAL:


Hi Rob I'm not really sure what the "source view" is? But I downloaded your pdf guide:
http://akrabat.com/zend-framework-tutorial/

1.
And tried to fix things by following your CSS tutorial.
According to that tutorial I don't have this file so I created it along with the example code:

http://localhost/zfia/ch04/places/application/views/helpers/BaseUrl.php
----------------------------------------------------------------

<?php <br />
class Zend_View_Helper_BaseUrl
{
function baseUrl()
{
$fc = Zend_Controller_Front::getInstance();
return $fc->getBaseUrl();
}
}

----------------------------------------------------------------


2.
Also this file was missing this complete line so I typed in the missing words:

http://localhost/zfia/ch04/places/application/views/layouts/layout.phtml
----------------------------------------------------------------

<?php echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/site.css'); ?>

----------------------------------------------------------------


Still I cannot get any images and CSS on the Chapter 4 example site.
apprentice (77) [Avatar] Offline
#6
Re: Chapter 4 - I'm confused
THIRD TRIAL:


1.)
OK lets forget everything I did above and RESET our watches again. It wasn't the missing BaseUrl.php file that caused the problems.

Long story short, I suspect that after some testing the problem has to do with my .htaccess file.
http://pastebin.com/m741c4714



2.)
Previously I tested the example codes from here where:

* DocRoot = C: yadda yadda htdocs
Csmilierogram FilesApache Software FoundationApache2.2htdocszfiach04placespublic

Now I test things from here where:

* DocRoot = C:Websitesplacespublic
C:Websitesplacespublic



3.)
You can see how I setup my virtualhosts from these 2 files:

Csmilierogram FilesApache Software FoundationApache2.2confextrahttpd-vhosts.conf
http://pastebin.com/m3243703


C:WindowsSystem32driversetchosts
_____________________
127.0.0.1 localhost
::1 localhost

127.0.0.1 test1.local
127.0.0.1 test2.local
127.0.0.1 test3.local
127.0.0.1 ch04.local
_____________________



4.)

SO WHAT'S YOUR QUESTION THEN?

So after all this lengthy explanation what is my questions then?
When I type this I get CSS and Images:

smilie
http://ch04.local/iDoNotExists

But when I type these then either I get 403 Forbidden or only Text without CSS and Images:

smilie
http://ch04.local/
http://ch04.local/index.php


My question is how can I make all these 3 links into smilie happy faces?
akrabat (479) [Avatar] Offline
#7
Re: Chapter 4 - I'm confused
Can you tell me what you see in the HTML source view in your browser?

Rob...
apprentice (77) [Avatar] Offline
#8
Re: Chapter 4 - I'm confused
.


You mean like this?



exhibit A.)

  • http://ch04.local/I_Do_Not_Exist.php

  • image
    http://pastebin.com/m78dff022



    exhibit B.)

  • http://ch04.local/

  • http://pastebin.com/m1c809a2b



    exhibit C.)

  • http://ch04.local/index.php

  • image
    http://pastebin.com/m4278061c


    ______________________________________________________



    Other stuff

  • Also I finally found the default BaseUrl.php file that came with the example codes. Is it correct that is should reside under Library folder hiearchy?
    Csmilierogram FilesApache Software FoundationApache2.2htdocszfiach06placeslibraryPlacesViewHelperBaseUrl.php


  • And not in Application folder hiearchy?
    Csmilierogram FilesApache Software FoundationApache2.2htdocszfiach06placesapplicationviewshelpers


  • Which file points to the BaseUrl.php file I can't seem to find it being mentioned in the Bootstrapper. Maybe I'm looking in the wrong place?


  • The same goes for the CSS file which file points to the CSS file? I can't find it in the Bootstrapper, am I looking in the wrong place?
  • apprentice (77) [Avatar] Offline
    #9
    Re: Chapter 4 - I'm confused
    I think I know who the usual suspects are it's 4 of them. I'm using Windows Vista right now and I've changed every AllowOverride None to AllowOverride All but still no go.
    I tested on my Debian LAMP stack also but no more luck than on Vista.

    1.
    Does anybody have a minimal working httpd.conf file for Vista that they can upload to pastebin.com so that I can copy it from you?
    My default file is too cluttered with 530 lines of codes that I don't dare to remove smilie

    2.
    The same for this file httpd-vhost.conf can somebody upload a minimal working copy of it so I can study how you do it correctly?

    3.
    This Apache ERROR-log regarding /lib/Zend I don't really know how to solve, help?
    http://pastebin.com/m7b44d3e0

    4.
    .htaccess file might be a suspect also but not likely.
    akrabat (479) [Avatar] Offline
    #10
    Re: Chapter 4 - I'm confused
    The URL you should be visiting shouldn't have an index.php in it.
    apprentice (77) [Avatar] Offline
    #11
    Re: Chapter 4 - I'm confused
    Yes but my visitors doesn't know that. I'm trying to simulate how the visitors thinks and does things and they are going to break my application at this stage.

    I solved the /lib/Zend error though. By looking here and here:
    http://www.manning-sandbox.com/thread.jspa?threadID=33334&tstart=0
    http://akrabat.com/2009/04/30/zend_loaders-autoloader_deprecated-in-zend-framework-18/

    1 down 3 to go. So now Apache Error-log only reports this when doing my tourist tests. I suspect httpd.conf and httpd-vhost.conf anybody got a minimal copy of those 2 files for me to study and compare with my own?:

    ___________________________________________________________________

    [Wed Jul 22 12:23:14 2009] [error] [client 127.0.0.1] Directory index forbidden by Options directive: C:/Websites/places/public/
    ___________________________________________________________________
    apprentice (77) [Avatar] Offline
    #12
    Re: Chapter 4 - I'm confused
    I finally found the little bugger smilie
    http://www.sitepoint.com/forums/showthread.php?t=628231


    Murphy's Law: "If there are two or more ways to do something, and one of those ways can result in a catastrophe, then someone will do it."




    Bad:

    <IfModule dir_module>
    DirectoryIndex index.html
    </IfModule>



    Good:

    <IfModule dir_module>
    DirectoryIndex index.php index.html
    </IfModule>



    Now DocRoot finally works!
    http://ch04.local/

    I'm still not satisfied with this url not giving me the same result as DocRoot. This one only gives me Text without CSS and Images, me don't like.
    http://ch04.local/index.php
    akrabat (479) [Avatar] Offline
    #13
    Re: Chapter 4 - I'm confused
    You know, it never occurred to me that the DirectoryIndex wouldn't include index.php...

    To fix the other one, add this to your .htaccess. above the current RewriteCond lines:

    [pre]
    RewriteRule ^index.php/(.*)$ /$1 [r=301,L]
    [/pre]

    (or similar!)

    Regards,

    Rob...
    apprentice (77) [Avatar] Offline
    #14
    Re: Chapter 4 - I'm confused
    Thanks that line was hot! smilie

    ....or not it broke every other link that worked before except the 3 links that I've been testing.

    ...well it depends on what .htaccess you use they act differently the 3 different versions I have smilie too soon to say what's right or what's wrong.

    Time for me to study .htaccess again more in depth.