Unread 01-11-2008, 09:02 PM
GabrielP GabrielP is offline
Junior Member
Join Date: Jan 2008
Location: Argentina
Posts: 7
  #1  
Question 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.

Last edited by GabrielP : 01-12-2008 at 08:42 AM. Reason: I changed the name of the second .ini file as "santaclaus.ini" might sound funny and my question be considered not serious
Reply With Quote
Unread 01-14-2008, 03:50 PM
Admin
Posts: n/a
  #2  
Default

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
Reply With Quote
Unread 01-14-2008, 07:45 PM
GabrielP GabrielP is offline
Junior Member
Join Date: Jan 2008
Location: Argentina
Posts: 7
  #3  
Thumbs up

Quote:
Originally Posted by Admin View Post
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.

Last edited by GabrielP : 01-14-2008 at 07:48 PM.
Reply With Quote
Unread 01-23-2008, 01:46 AM
Admin
Posts: n/a
  #4  
Default

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.
Reply With Quote
Unread 01-26-2008, 10:17 AM
GabrielP GabrielP is offline
Junior Member
Join Date: Jan 2008
Location: Argentina
Posts: 7
  #5  
Default

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?)

Last edited by GabrielP : 01-26-2008 at 10:21 AM.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 10:17 PM.


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