Discussion – Lesson 8 - Listing articles from the database in PHP (MVC)
BackComments
Member
8 messages from 8 displayed.
//= Settings::TRACKING_CODE_B ?> //= Settings::TRACKING_CODE ?>
Comments
Ooops, our bad. I fixed it and added 10 points to your account for pointing it out. Thanks man
An example:
if I have this address: localhost/article, the actual value of $params[0] is "article" right?
or better: if we have localhost/article/example
$params[0] is example right? Because there is the array_shift method in the controller that delete first item of the array right?
Yes, the controller's name ('article'
in this example) is
removed from the array using the array_shift()
function. So in the
case of localhost/article
, there's nothing in the
$params
. In the case of localhost/article/example
,
there's array('example')
. $params
are the
controller's parameters.
You can always add some debug logs to the problematic locations to make sure what different variables contain.
Hi.
When I am in /article/home and I will click on Articles buton (or other) then
Error Page will be loaded. It is becouse site want go to /article/article
instead of go to /article. The same problem is when I will add / to end of the
site address press enter and then I will try to go to (for expample) Contact
Form. What could I do wrong?
Hi Kamil, if you have trouble with anything, you can always the fully-functional source codes under the lesson and find your mistake. If our project doesn't work for you, you probably don't have it in the root folder of your webserver.
Yes, U're ofcourse right. I started to build with U, but I had to do it in subfolder. Server hasn't got domain name and won't ever have. So, subdomain won't be there, either. I have to have subfolders for test versions or other projects. But WOW, finally I made it, and it WORKS. I have an interface with const's and i put there APP_SUBFOLDER = "subfolder/" and use INTERFACE::APP_SUBFOLDER in layout, article links and in function reedict() in Controller.class.php It isn't very elegant, and I have to remember to add thic constant to every link, but for now it isnt so tiresome. If i change subfolder I must only change one value
8 messages from 8 displayed.