Get up to 80 % extra points for free! More info:

Discussion – Lesson 8 - Listing articles from the database in PHP (MVC)

Back

 

Comments
Avatar
Simon
Member
Avatar
Simon:7/31/2018 8:46

Either you need to rename the template to "acticles.phtml" oder you need to change the view like this : $this->view = 'clanky';
Otherwise it will not work.
Greets Simon

 
Reply
7/31/2018 8:46
Avatar
Replies to Simon
David Capka Hartinger:7/31/2018 18:04

Ooops, our bad. I fixed it and added 10 points to your account for pointing it out. Thanks man :)

Reply
7/31/2018 18:04
You can walk through a storm and feel the wind but you know you are not the wind.
Avatar
Agostino I
Member
Avatar
Agostino I:7/7/2019 10:59

An example:

if I have this address: localhost/article, the actual value of $params[0] is "article" right?

Reply
7/7/2019 10:59
while(1){ workHard();} but sometimes....take a rest! :)
Avatar
Agostino I
Member
Avatar
Agostino I:7/7/2019 11:28

or better: if we have localhost/arti­cle/example

$params[0] is example right? Because there is the array_shift method in the controller that delete first item of the array right?

Reply
7/7/2019 11:28
while(1){ workHard();} but sometimes....take a rest! :)
Avatar
Replies to Agostino I
David Capka Hartinger:7/9/2019 7:34

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.

Edited 7/9/2019 7:37
Reply
7/9/2019 7:34
You can walk through a storm and feel the wind but you know you are not the wind.
Avatar
Kamil Wróblewski:2/6/2020 6:51

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?

 
Reply
2/6/2020 6:51
Avatar
Replies to Kamil Wróblewski
David Capka Hartinger:2/6/2020 8:45

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.

Edited 2/6/2020 8:45
Reply
2/6/2020 8:45
You can walk through a storm and feel the wind but you know you are not the wind.
Avatar
Replies to David Capka Hartinger
Kamil Wróblewski:2/7/2020 8:53

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::AP­P_SUBFOLDER in layout, article links and in function reedict() in Controller.clas­s.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 :)

 
Reply
2/7/2020 8:53
To maintain the quality of discussion, we only allow registered members to comment. Sign in. If you're new, Sign up, it's free.

8 messages from 8 displayed.