+   Reply to Thread

I noticed that the bootstraps code on github includes the php code for the benchmarks, the page layout, title and menus.

On my opinion that should go on the index because you won't always use the same page layout, title, bencharks, etc.

To delete the benchmarks you need to edit the php source code of the view class which is very dangerous.

In my opinion the index.php file should be the one handling that. Something like this.

<?php
$app = "app";
require_once "config/directory.php";
require_once "$app/bootstrap.php";

#--------------------------------
# Auto Load the Controller
# init_route set the controller/action/params
# to load the controller
#--------------------------------
$loader->auto_load_controller();

#--------------------------------
# Load model
# load the model and assign the result
# @params model, action, params, assign_to
#--------------------------------
$loader->load_menu();

$loader->init_page_layout('index');

#--------------------------------
# Assign Layout variables
#--------------------------------
$loader->assign( 'title', 'RainFramework' );

// - BENCHMARK ------
$loader->assign( "execution_time", timer() );
$loader->assign( "memory_used", memory_usage() );
$loader->assign( "n_query", class_exists('db') ? db::get_executed_query() : null );
// --------------

#--------------------------------
# Print the layout
#--------------------------------
$loader->draw();
Hey Faryshta,

the old Rain CMS was actually using the code you just wrote.

We chose this new solution because cleaner and easier to maintain in the case you have multiple websites, because they can all share the bootstrap, so you do one change for all of them.

Probably for the new Rain CMS I'll think about roll back to the older solution. Also I'm thinking to put the menu in a plugin instead of a default Loader method.

Thanks for your suggestions, if interested please follow the RainCMS project on http://raincms.org or on twitter http://twitter.com/RainCMS.
I think this is a better solution for a CMS. Since you can handle more sites this way. (As you just said).

And I agree that its better to have plugins working separated instead of being carried in the code.

Thanks for the response, have a good day.
thanks

+   Reply to Thread



Profiler output