viewAction use of seo and Bootstrap css

Discuss everything related to ApPHP MVC Framework. All versions. Any questions related to the Framework developing or using should be posted to this forum.

Moderators: ne_moj, alexmst, zewa, vadimako, ne_moj, alexmst, zewa, vadimako

paragate
Master
Master
Posts: 151
Joined: Nov 13th, '14, 13:04
Location: Denmark, Odense

viewAction use of seo and Bootstrap css

Postby paragate » Aug 2nd, '16, 08:50

For demonstration purpose of seo and no fancy lines packed into functions. Better solutions are welcome to this small debate.
It is an example of the use of seo written in the browser url.
And an example switch statement use of action2 picked from the menu home.

Let say you want to use your viewaction more directly towards different html bootstrap bindings
you can use a switch statement to parse variables from url to your viewaction in your controller from a menu button.
-1- First go to your admin panel/general/Frontend Menu/, and write the following Url: controllername/1/home.
Now you have a menu button directed towards home.
-2- In the controller public function viewAction($nid), you can write
$seoGet = A::app()->getRequest()->getRequestUri(); //show: /controller/action1/action2/

then explode the seo:
$r = explode('/', $seoGet);
$r = array_filter($r);
$r = array_merge($r, array());
$r = preg_replace('/\?.*/', '', $r);
$actionOne = $r[1]; //is the viewaction $nid variable..
$actionTwo = $r[2]; // is the url second param .. home
switch ($actionTwo) {
case 'home':
#.... make you code for the home button
break;
case 'contact':
# code .. for contact button ..
break;

default:
# code...
break;
}

Then you can go further and use lets say a Helper like CValidator in Apphp framework
Let your controller viewaction and seo fire to other views with different htmlcode as Bootstrap.

paragate
Master
Master
Posts: 151
Joined: Nov 13th, '14, 13:04
Location: Denmark, Odense

Re: viewAction use of seo and Bootstrap css

Postby paragate » Aug 2nd, '16, 10:06

Another solution for a different purpose is simply to write
an action in the controller.
Find your controller and copy/paste the; public function viewAllAction() and rename
it to; public function homeAction().
Hereafter you can rewrite your home function.
Remember to change $this->_view->render('controller/viewAll'); in homeAction() to
$this->_view->render('controller/home');
It is the same with the action viewall, you can change this to ex. home.php


Return to “ApPHP MVC Framework {developers/users}”