Two backend panels using single core code

51 views
Skip to first unread message

Muhammad Shahzad

unread,
Oct 11, 2017, 2:32:51 AM10/11/17
to Fat-Free Framework
Hello everyone,


I have a question, I need better suggestion from all of you guys.

Is it possible to make two separate backend panel using f3 single core code?
As my project manager asked me to do this and now I'm worried how to do this?

I have already designed a backend panel useing f3 framework and my directory structure is something like this:

main folder
    --f3app
   -- otherapp
  --newapp

and now I want to build another backend panel in "newapp" directory but the issue is f3 code is inside "f3app".

Please give me some solution.

Thanks
Br,
Shahzad


xfra35

unread,
Oct 11, 2017, 4:25:29 AM10/11/17
to Fat-Free Framework
Sure. The base.php file can be called from any location.

E.g:

$f3 = require('../f3app/lib/base.php');

After which all F3 plugins (Web, Template, DB, etc.) will be autoloaded from ../f3app/lib/

You can still ajust the configuration variables (UI, AUTOLOAD, CACHE, etc.) for newapp.

Muhammad Shahzad

unread,
Oct 11, 2017, 5:40:04 AM10/11/17
to Fat-Free Framework

Thank you for your reply, I have used your method and now getting this error:

500 Internal Server Error

 

Fatal error: require(): Failed opening required 'tmp/1sujycyyvubql.24gewczh0sdco.php' (include_path='.:/usr/share/php:/usr/share/pear') [f3app/lib/base.php:2682]



My "newapp" index.php code is something like this:

$f3=require("../f3app/lib/base.php");

$f3
->mset(array(
"UI" => "app/view/;app/plugin/",
       
"ESCAPE" => false,
       
"LOGS" => "log/",
       
"TEMP" => "tmp/", // this is not working as sandbox function looking view in f3app tmp folder but I have created tmp and log folder inside newapp directory.

ikkez

unread,
Oct 11, 2017, 6:38:09 AM10/11/17
to Fat-Free Framework
I think F3 changes the working directory once included.. you might need to change it back with chdir

xfra35

unread,
Oct 11, 2017, 9:06:21 AM10/11/17
to Fat-Free Framework
That should not be the case, since the framework doesn't make use of the "chdir" command.

But you can easily clarify that by running:

echo getcwd(); // path 1

$f3
= require('../f3app/lib/base.php');

echo getcwd
(); // path 2

What are the values of path 1 & 2 ?



Message has been deleted

Muhammad Shahzad

unread,
Oct 11, 2017, 9:19:39 AM10/11/17
to Fat-Free Framework

Hi, this is my index.php file in "newapp" directory.

    $homedir = dirname(__FILE__) . "/";
    echo getcwd
(); // path 1, /var/www/html/main folder/newapp   
   
#Initialize core
    $f3
=require("../f3app/lib/base.php");
    echo
"<br>";
    echo getcwd
();//path 2,  /var/www/html/main folder/newapp   

  
exit;

xfra35

unread,
Oct 12, 2017, 2:21:55 AM10/12/17
to Fat-Free Framework
But then, what makes you think that F3 is looking for tmp/ inside f3app?

tmp/ is a relative path, relative to the current working directory (newapp), so F3 expects it to be located at newapp/tmp/

Muhammad Shahzad

unread,
Oct 12, 2017, 3:01:20 AM10/12/17
to Fat-Free Framework
Hi,

Thank you so much, I have already "tmp" in newapp dir but the paths was incorrect in index.php, like this


$f3
->mset(array(
       
"UI" => "app/view/;app/plugin/",
       
"ESCAPE" => false,
       
"LOGS" => "log/",
       
"TEMP" => "tmp/",



Now I have change the "LOGS" and "TEMP" path like this and it is working fine.

$f3->set('CACHE', true);

$f3
->mset(array(
       
"UI" => "app/view/;app/plugin/",
       
"ESCAPE" => false,

       
"LOGS" => "/log/",
       
"TEMP" => "/tmp/",
       
"CACHE" => true,

Now you can see I have enabled cache but noting saved into tmp or log folder, is it okay or cache save data somewhere else?

xfra35

unread,
Oct 12, 2017, 5:42:12 AM10/12/17
to Fat-Free Framework
Hmmm /tmp/ being an absolute path, your temp files are probably stored in /tmp/ rather than in newapp/tmp/

Maybe your initial issue was about permissions on newapp/tmp/?
Reply all
Reply to author
Forward
0 new messages