Ultimate Web Site Drop Down Menu Forum

Ultimate Web Site Drop Down Menu Forum (http://www.udm4.com/forum/index.php)
-   Troubleshooting (http://www.udm4.com/forum/forumdisplay.php?f=12)
-   -   Working with two config.ini (http://www.udm4.com/forum/showthread.php?t=851)

GabrielP 01-11-2008 09:02 PM

Working with two config.ini
 
Hi, I am new to this forum

I'd like to move my client-side UDM to server-side, but I have to work with two config.ini because of my site is in two languages. The default is udm-custom.ini, of course, and the new one will be, say, udm-custom2.ini (it is not the real name, but I want to be clear because I am not a php dev and the manual made me confused a little as it is specified "config.ini" and then the word "config" occurs again in the syntax calling the config.ini, i.e. I am not sure if those "config" refer to the name of the second .ini file or not).

Well, for the second config file I set:

<?php $config = $_SERVER['DOCUMENT_ROOT'] . '/path/to/udm-custom2.ini'; ?>

then, in the page itself

<link rel="stylesheet" type="text/css" media="screen,projection"
href="/udm-resources/udm-style.php?udm-custom2=<?php echo($udm-custom2); ?>" />

and

<script type="text/javascript"
src="/udm-resources/udm-dom.php?udm-custom2=<?php echo($udm-custom2); ?>"></script>

----------------------------

Finally, I add another $cmatch to udm-style.php and udm-dom.php this way:

$cmatch = 'udm-custom.ini';
$cmatch = 'udm-custom2.ini';

----------------------------

OK, my question is: Did I understand the instructions of the developer manual rightly or something is wrong? Please, shed some light on this.

01-14-2008 03:50 PM

So, to better understand what you want to do...

It looks like you want to be able to pass a variable in your <link> tag that will tell your server-side code what configuration to load? If that's the case, then I think you've got it right.

Admin

GabrielP 01-14-2008 07:45 PM

Quote:

Originally Posted by Admin (Post 1318)
So, to better understand what you want to do...

It looks like you want to be able to pass a variable in your <link> tag that will tell your server-side code what configuration to load? If that's the case, then I think you've got it right.

Admin

Oh thank you!

Yes, I want to do that. What happened is that in the Developer Manual the name used for the second config file is "config.ini". Then, in the syntax the word "config" appears and one doesn't know if it is a php command or the name of the .ini file, got my point?

Look at the example in the Developer Manual:

<link rel="stylesheet" type="text/css" media="screen,projection"
href="/udm-resources/udm-style.php?config=<?php echo($config); ?>" />

and

<script type="text/javascript"
src="/udm-resources/udm-dom.php?config=<?php echo($config); ?>"></script>

While I, as a non-php dev, can guess that the $config refers to the name of config.ini, the first "config" (in "config=<...") made me confused. Is it a command or the name of the file, I thought to myself? That's why I called it santaclaus.ini in my first post in order to remark "where" my doubt was. As that name sounded "too funny" and my post might be taken as a joke, I decided to replace it with "udm-custom2" (more formal :)).

Thanks for your help, friend.

01-23-2008 01:46 AM

That's correct. Let's say you want to load "custom.ini" on the home page, and "sub.ini" on all the other pages. You could add this to the top of every page...

PHP Code:

if($_SERVER['PHP_SELF']=="index.php") { //index.php is your homepage
    
$config "custom.ini";
}
else { 
//on a page other than home...
    
$config "sub.ini";


This will set the $config variable to be the right .ini file you want. Then the following statement will load the correct config file (.ini file).


Code:

<link rel="stylesheet" type="text/css" media="screen,projection"
href="/udm-resources/udm-style.php?config=<?php echo($config); ?>" />

and

<script type="text/javascript"
src="/udm-resources/udm-dom.php?config=<?php echo($config); ?>"></script>

Let me know if you have any further questions.

GabrielP 01-26-2008 10:17 AM

Yes, I can understand that, but my problem lies in that my website is in two languages. In the English section, I use the configuration you wrote in the dev manual (i.e. udm-custom.ini and so on), but in the Spanish section I need to define a second .ini file, say, udm-custom-sp.ini. My doubt is the way I put the code. I think that I have to set it up like this (note I added (IS THIS RIGHT OR NOT?) where I have doubts specifically):

<?php $config = $_SERVER['DOCUMENT_ROOT'] . '/path/to/udm-custom-sp.ini'; ?>

then, on each of the pages belonging to the Spanish section, I write

<link rel="stylesheet" type="text/css" media="screen,projection"
href="/udm-resources/udm-style.php?udm-custom-sp=<?php echo($udm-custom-sp); ?>" /> (IS THIS RIGHT OR NOT?)

and

<script type="text/javascript"
src="/udm-resources/udm-dom.php?udm-custom-sp=<?php echo($udm-custom-sp); ?>"></script> (IS THIS RIGHT OR NOT?)

----------------------------

Finally, I add another $cmatch to udm-style.php and udm-dom.php this way:

$cmatch = 'udm-custom.ini';
$cmatch = 'udm-custom-sp.ini'; (IS THIS RIGHT OR NOT?)


All times are GMT. The time now is 07:08 AM.

Powered by vBulletin® Version 3.0.1
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.