Welcome Guest, Not a member yet? Register   Sign In
I'm having trouble following the MVC standard.

(This post was last modified: 03-09-2023, 02:27 PM by captain-sensible.)

i do mostly everthing from routes .So suppose on dev localhost , I have a view displaying :


<a href = blogArticle/Southhall-Church-Park> Southhall-Church-Park         </a>

blogArticle is connected to a route and Southhall-Church-Park is a slug I have in a slug field of slug

in app/config/Routes.php i have :

$routes->get('blogArticle/(:segment)', 'Blog::showArticle/$1');

so in the above anything in a url with blogArticle is going to get picked up

whats on the left i.e the url section is going to get passed to a controller called Blog.php and processes in a function as follows

public function showArticle($theSlug)
                    $handle = new BlogModel();
                    $result= $handle->getArticle($theSlug);
                    $data =[
                    echo view('blogArticle',$data);

So you can design how menu or a href links in views are handled
I use Arch Linux by the way 

CMS in Action

Messages In This Thread
RE: I'm having trouble following the MVC standard. - by captain-sensible - 03-09-2023, 02:26 PM

Theme © iAndrew 2016 - Forum software by © MyBB