Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2006-12-17 23:11:40

Mr. Picklesworth
Xinha Community Member
Registered: 2006-10-01
Posts: 15

PHP in Xinhaconfig.js?!

I am trying to configure ExtendedFileManager without actually going into those config files within Xinha (for fear of always replacing them by accident when I update).
To do this, of course, I am adding a bunch of PHP to xinhaconfig.js, as it appears the Readme for ExtendedFileManager tells me to do:

if (xinha_config.ExtendedFileManager) {
           with (xinha_config.ExtendedFileManager)
        {
            <?php

            // define backend configuration for the plugin
            $IMConfig = array();
            $IMConfig['images_dir'] = '../../../../_files'; //Disgusting, I know. Whatever :(
            $IMConfig['images_url'] = '/_files';
            //$IMConfig['files_dir'] = '/_files';
            //$IMConfig['files_url'] = '/_files';
            $IMConfig['thumbnail_prefix'] = 't_';
            $IMConfig['thumbnail_dir'] = '.thumbs';
            $IMConfig['resized_prefix'] = 'resized_';
            $IMConfig['resized_dir'] = '';
            $IMConfig['tmp_prefix'] = '.tmp';
            $IMConfig['max_filesize_kb_image'] = 4000;
            // maximum size for uploading files in 'insert image' mode (2000 kB here)

            $IMConfig['max_filesize_kb_link'] = 15000;
            // maximum size for uploading files in 'insert link' mode (5000 kB here)

            // Maximum upload folder size in Megabytes.
            // Use 0 to disable limit
            $IMConfig['max_foldersize_mb'] = 0;

            require_once '/path/to/xinha/contrib/php-xinha.php';
            xinha_pass_to_php_backend($IMConfig);
            
            ?>
        }
    }

If I change config.inc.php with those same settings it works, so I doubt it is the settings... I'm assuming that the problem is that I am daftly inserting php within a javascript file. Clearly the PHP code is not being read by PHP, since it is still present after loading the page if I view the Javascript source.
So how, then, can I configure things in the PHP backend?
Can I have a xinhaconfig.php file like the .js file? Is there an example of such a file? What includes should it have?

Thanks in advance!

Last edited by Mr. Picklesworth (2006-12-17 23:13:10)

Offline

#2 2006-12-18 14:50:41

koto
Xinha Pro
Registered: 2006-01-09
Posts: 58

Re: PHP in Xinhaconfig.js?!

You're correct - files with .js extension will not be parsed by PHP. You simply have to rename it to e.g. configfile.php  and include it like that:

<script type="text/javascript" src="path/to/configfile.php"></script>

Offline

#3 2006-12-21 16:13:32

Mr. Picklesworth
Xinha Community Member
Registered: 2006-10-01
Posts: 15

Re: PHP in Xinhaconfig.js?!

Heh, I didn't notice require_once or /path/to/xinha bit. It works now!
Thanks smile

Offline

#4 2007-01-01 17:17:12

Snapt
New member
Registered: 2007-01-01
Posts: 1

Re: PHP in Xinhaconfig.js?!

PHP Fusion - the google bot is unable to pick up the header titles or content off our webpages other than the front page - see www.snapt.co.nz - can anyone help?

Offline

#5 2007-01-02 08:37:26

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: PHP in Xinhaconfig.js?!

How would this relate to Xinha?

Offline

Board footer

Powered by FluxBB