Jump to content
Larry Ullman's Book Forums

Recommended Posts

OK well I am officially dumb. I seem to be the only person to get stuck on BASE_URI in Chapter 2.

 

I have tried:

define('BASE_URI', 'c:/xampp/htdocs/site1/');
define('BASE_URL', 'http://localhost/site1/');

and

define('BASE_URI', 'c:\xampp\htdocs\site1');
define('BASE_URL', 'http://localhost/site1/');

etc but can get nothing to work.

 

The page comes up but does not find the CSS file (although some styling is picked up).

 

The links in the form

<li><a href="#">link 2</a></li>

work fine but those like

<li><a href="../index.php?p=this">This</a></li>

link to the htdocs not to htdocs\site1 as it "should".

 

Grateful for any pointers.

 

EDIT: OK well all seems "fine" now. Deleted C: from URI and links were as they should be. Then edited URI to sdags and that was fine too. I have a horrible feeling this may be some sort of caching problem but test echo messages were coming up as they should be so am more than a little flummoxed.

 

What exactly is the URI used for here? Surely all the browser navigation is done via the localhost reference.

 

Mahalo 

Steve

 

PS think there is a tiny error. The link for the "logo" at the top goes to index.html and not .php

Link to post
Share on other sites

OK solutions from multiple problems. First PHPStorm's Chrome plugin was broken causing some of the problems. Not sure how I sorted the link but suspect that might be related.

 

I then made my life worse by copying over the style.css in the zip root thinking that that must be it - and it was not.

 

Downloaded css from http://www.html5webtemplates.co.uk/and things started to look a lot better.

 

Well there goes a couple of hours I will never see again but getting slightly more competent.

 

BTW XAMPP puts AllowOverride for the htdocs folder in httpd.conf by default - just so you know!

 

Aloha

Steve

 

PS Still have no idea where the URI constant gets used.

Link to post
Share on other sites

Glad you figured it out. Assuming you are using the PHP Advanced book, I double-checked, and I don't think the BASE_URI constant is used in the code, but it could/would be used to provide absolute references to things on the file system. For example, you could use it to include the MySQL connection script. 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...