Welcome Guest, Not a member yet? Register   Sign In
BackendPro 0.6.1

[eluser]ddrury[/eluser]
OK,

Here's what I came up with

Code:
//In function output_assets, change 1st & last lines of this snippet as shown
foreach (array('js','css','cond_css') as $asset) // must process conditional css files last

    {
    // Asset path
    $dir = $this->CI->config->item($type . "_assets") . $asset . "/";

    // Get all files in asset path
    $asset_files = get_filenames($dir);

    // First lets check if there is a cache
    if ($this->CI->config->item('asset_cache_length') != 0 && $asset != 'cond_css') // mustn't cache conditional CSS files

// then add the following code

        /**
        * Output Style Code
        *
        * @access private
        * @param string $file Filename of style to include
        * @return string Generated style include code
        */
        function _include_cond_css($file)
        {
            if ($this->_test_conditions(basename($file,'.css')))
            {
                $this->output .= '<link rel="stylesheet" type="text/css" href="' . base_url() . $file . '" />';
                $this->output .= "\n";
            }
        }

        /**
        * test conditions
        * @access private
        * @param string containg comparison variables as below
        * @return bool
        * Formats of string passed as param are
        *    {browser}.css eg ie.css
        *    {browser}_{major version}.css eg ie_6.css
        *    {browser}_{major version}#{minor version}.css eg ie_5#008.css
        *    {condition}_{browser}_{major version}.css eg gte_ie_6.css
        *    {condition}_{browser}_{major version}#{minor version}.css eg gte_ie_5#008.css
        */

        function _test_conditions($str)
        {
            static $feature;
            if (!isset($feature))
            {
                $this->CI->load->library('user_agent');

                switch($this->CI->agent->browser())
                {
                    case('Internet Explorer'):
                        $feature = 'ie';
                        break;
                    case('Firefox'):
                        $feature = 'ff';
                        break;
                    case('Opera'):
                        $feature = 'op';
                        break;
                    case('Safari'):
                        $feature = 'sf';
                        break;
                    default:
                        $feature = '??';
                }
            }

            $elements=explode('_',$str);

            switch (count($elements))
            {
                case(1): // only browser
                    $condition = (strtolower($elements[0]) == $feature);
                    break;
                case(2): // browser and it's version
                    $condition = (strtolower($elements[0]) == $feature);
                    if ($condition)
                    {
                        $condition = $this->_compare_versions($elements[1], '');
                    }
                    break;
                case(3): // operator, browser & version
                    $condition = (strtolower($elements[1]) == $feature);
                    if ($condition)
                    {
                        $condition = $this->_compare_versions($elements[2],$elements[0]);
                    }
                    break;
            }
            return $condition;
        }

        /**
        * Compare version
        *
        * @access private
        * @param mixed
        * @return bool
        */

        function _compare_versions($value, $operator)
        {
            static $major;
            static $minor = '0';
            if (! isset($major))
            {
        /* build an array containing the major & minor
        * browser versions. e.g array(2),(0014)
        */
                $elements = explode('.',$this->CI->agent->version());
                $num = count($elements);
                $major = $elements[0];
                if ($num>1)
                {
                    $minor ='';
                    for ($i=1; $i<$num;$i++)
                    {
                        $minor .= $elements[$i];
                    }
                }
            }
            switch ($operator)
            {
                case('lt'):
                    $op = '<';
                    break;
                case('gt'):
                    $op = '>';
                    break;
                case('lte'):
                    $op = '<=';
                    break;
                case('gte'):
                    $op = '>=';
                    break;
                case('ne'):
                    $op = '!=';
                    break;
                default:
                    $op = '==';
                }
                $parts = explode('#',$value);
                if (count($parts)>1)
                {
                    $str = "($major.$minor $op $parts[0].$parts[1])";
                }
                else
                {
                    $str = "($major $op $parts[0])";
                }
                eval("\$result = $str;");
                return $result;

        }

[eluser]PvOostrom[/eluser]
Hello,

I have a website, which hold multiple applications. The directory structure looks like this:

home/
-- framework (holds the system items)
-- projects
---- Project 1
---- Project 2
---- Project 3
-- public_html

How can I install BeP using this directory structure? I get a lot of unclear errors at the install, and blank pages.

[eluser]adamp1[/eluser]
I take it each project is an application? If so currently BeP can only be installed for 1 application/project. To have it running on multiple applications you would need multiple installs.

All you need to do follow the information on this page http://ellislab.com/codeigniter/user-gui..._apps.html

Looking at your directory structure why are the project files not in the public_html folder? Blank pages are due to missing files and or it not being setup correctly. Could you expand on any errors you get.

[eluser]PvOostrom[/eluser]
I moved the project files and the framework out of the public_html folder as it shouldn't be accessible by the public. By putting the folder one level higher, I have a organized, structured and easy to handle multi-application.

After I modified some files, and somehow let it show me a page, the errorlogs were full of matchbox not able to open library files, even when the files were where they should be.

[eluser]adamp1[/eluser]
Where is the modules folder btw? Is it on the same level as the projecs?

[eluser]PvOostrom[/eluser]
I tried different locations, in the project' folder, the framework folder, even on the same level as the framework folder is on.

[eluser]adamp1[/eluser]
OK, thing is if you move it around you need to update its location in application/config/matchbox.php, otherwise as what seems to be happening matchbox can't locate files.

[eluser]PvOostrom[/eluser]
Okay, I am getting the following errors while using the whole path which I am using in my index.php as well

Code:
A PHP Error was encountered

Severity: Warning

Message: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/home/mmo/projects/mmotest//home/mmo/modules//welcome/controllers/welcome.php) is not within the allowed path(s): (/home/mmo/:/tmp:/usr/local/lib/php/)

Filename: libraries/Router.php

Line Number: 270

Is the script looking in the application folder by default?

[eluser]adamp1[/eluser]
This is a error with CI by the looks of things. What do you mean using the whole path which your using in index.php.

And also what do you mean is the script looking for the application folder by default. If your talking about BackendPro then it does look for the application folder it should be inside an application folder.

I'm afraid I don't really understand the information your giving me.

[eluser]PvOostrom[/eluser]
Okay, never mind that. I got it working now. The long list of errors were actually warnings, because the matchbox tries to locate the modules and libraries on 4 different locations.

Thanks for the help Smile




Theme © iAndrew 2016 - Forum software by © MyBB