Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Bodim.lk out now !
Manoj Suranga Bandara
Updated:
Yesterday at 3:05 AM
Power Lifting Lever Belt
SkullVamp
Updated:
Jun 13, 2026
Ad icon
port.lk Domain for sale
Lankan-Tech
Updated:
Jun 13, 2026
Colombo
Kaduwela - Two Storey House for Sale
dilrasan
Updated:
Jun 11, 2026
Ad icon
Wechat qr verification
Pawan2005
Updated:
Jun 11, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
How to create this type websites?
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="Fox Mulder89" data-source="post: 16520099" data-attributes="member: 454953"><p><span style="color: Blue"><span style="font-size: 15px"><?php</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">// Connect to the DB Connect Class - Singleton Design Pattern</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">include 'dbconfig.php';</span></span></p><p><span style="color: Blue"><span style="font-size: 15px"></span></span></p><p><span style="color: Blue"><span style="font-size: 15px">//Get the request URL and retrieve the Controller and Action</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">$requestUrl = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">$urlParams = explode('/', $requestUrl);</span></span></p><p><span style="color: Blue"><span style="font-size: 15px"></span></span></p><p><span style="color: Blue"><span style="font-size: 15px">// Here you should probably gather the rest as params</span></span></p><p><span style="color: Blue"><span style="font-size: 15px"></span></span></p><p><span style="color: Blue"><span style="font-size: 15px">//Call the model</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">try</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">{</span></span></p><p><span style="color: Blue"><span style="font-size: 15px"> $modelName = $urlParams[4].'Model';</span></span></p><p><span style="color: Blue"><span style="font-size: 15px"> require_once 'Model/'.$modelName.'.php'; </span></span></p><p><span style="color: Blue"><span style="font-size: 15px">}</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">catch (Exception $ex)</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">{</span></span></p><p><span style="color: Blue"><span style="font-size: 15px"> echo "Cannot access the model class!"; </span></span></p><p><span style="color: Blue"><span style="font-size: 15px">}</span></span></p><p><span style="color: Blue"><span style="font-size: 15px"></span></span></p><p><span style="color: Blue"><span style="font-size: 15px">//Call the controller and action</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">try</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">{</span></span></p><p><span style="color: Blue"><span style="font-size: 15px"> $controllerName = strtolower($urlParams[4]).'Controller';</span></span></p><p><span style="color: Blue"><span style="font-size: 15px"> $action = explode("?", $urlParams[5]);</span></span></p><p><span style="color: Blue"><span style="font-size: 15px"> $actionName = $action[0].'Action';</span></span></p><p><span style="color: Blue"><span style="font-size: 15px"> require_once 'Controller/'.$controllerName.'.php'; </span></span></p><p><span style="color: Blue"><span style="font-size: 15px"> // Call the action</span></span></p><p><span style="color: Blue"><span style="font-size: 15px"> $controller = new $controllerName;</span></span></p><p><span style="color: Blue"><span style="font-size: 15px"> $controller->$actionName();</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">}</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">catch (Exception $ex)</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">{</span></span></p><p><span style="color: Blue"><span style="font-size: 15px"> echo "Cannot access the controller class!";</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">}</span></span></p><p><span style="color: Blue"><span style="font-size: 15px"></span></span></p><p><span style="color: Blue"><span style="font-size: 15px">//Include the View</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">try</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">{</span></span></p><p><span style="color: Blue"><span style="font-size: 15px"> include 'View/'.$urlParams[4].'/'.$action[0].'.php';</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">} </span></span></p><p><span style="color: Blue"><span style="font-size: 15px">catch (Exception $ex)</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">{</span></span></p><p><span style="color: Blue"><span style="font-size: 15px"> include 'View/index.php';</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">}</span></span></p><p><span style="color: Blue"><span style="font-size: 15px">?></span></span></p><p></p><p><span style="color: Red"><span style="font-size: 15px">this is coding for what you have ask</span></span></p></blockquote><p></p>
[QUOTE="Fox Mulder89, post: 16520099, member: 454953"] [COLOR="Blue"][SIZE="4"]<?php // Connect to the DB Connect Class - Singleton Design Pattern include 'dbconfig.php'; //Get the request URL and retrieve the Controller and Action $requestUrl = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; $urlParams = explode('/', $requestUrl); // Here you should probably gather the rest as params //Call the model try { $modelName = $urlParams[4].'Model'; require_once 'Model/'.$modelName.'.php'; } catch (Exception $ex) { echo "Cannot access the model class!"; } //Call the controller and action try { $controllerName = strtolower($urlParams[4]).'Controller'; $action = explode("?", $urlParams[5]); $actionName = $action[0].'Action'; require_once 'Controller/'.$controllerName.'.php'; // Call the action $controller = new $controllerName; $controller->$actionName(); } catch (Exception $ex) { echo "Cannot access the controller class!"; } //Include the View try { include 'View/'.$urlParams[4].'/'.$action[0].'.php'; } catch (Exception $ex) { include 'View/index.php'; } ?>[/SIZE][/COLOR] [COLOR="Red"][SIZE="4"]this is coding for what you have ask[/SIZE][/COLOR] [/QUOTE]
Insert quotes…
Verification
Payakata winadi keeyak tibeda?
Post reply
Top
Bottom