We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

MSM index_page question

Development and Programming

Michael Witwicki's avatar
Michael Witwicki
115 posts
15 years ago
Michael Witwicki's avatar Michael Witwicki

Hey guys,

Hoping someone can help me get to the bottom of this one. In one of our addons, we have a need to identify what the index page in EE has been renamed to. We have always used the following to get that information:

$this->EE->config->item(‘index_page’)

However, one of the users of our addon has an MSM installation, which has a single EE install, with two separate index.php files in the root directory. The user has renamed them to:

index1.php and index2.php

The issue I having, is that when I access the variable above, I always get the latter, no matter which MSM instance I am in. Is there a better way to access the site specific index.php name?

Thanks in advance for the help.

       
Steven Grant's avatar
Steven Grant
894 posts
15 years ago
Steven Grant's avatar Steven Grant

isn’t the new index file supposed to be added into a subdir?

       
Michael Witwicki's avatar
Michael Witwicki
115 posts
15 years ago
Michael Witwicki's avatar Michael Witwicki

Hey Steven,

Yes - but I don’t think that would fix the problem, because there is still only one config file which would output what the name of the index.php file has been changed to. So even if the user had done this:

/renamedindex1.php /subdirectory/renamedindex2.php

There is still only that one config variable to access. Unless maybe somehow the subdirectory fixes that? But I’m not quite sure how that would work.

I should make a note here that this is not my install - but rather an install for a user of one of our addons. I just want to make sure we have every eventuality accounted for with different kind of MSM installs. I’ve never set up an MSM in this way before.

MW

       
Michael Witwicki's avatar
Michael Witwicki
115 posts
15 years ago
Michael Witwicki's avatar Michael Witwicki

Aaaaaaaaand I’m super rude and didn’t thank you for responding! So thanks!!

       
Steven Grant's avatar
Steven Grant
894 posts
15 years ago
Steven Grant's avatar Steven Grant

curious as to why they’ve renamed them index1.php and index2.php

if those were changed to just index.php - both would work fine as that’s what’s in the config?

       
Jeremy Gimbel - Conflux Group's avatar
Jeremy Gimbel - Conflux Group
166 posts
15 years ago
Jeremy Gimbel - Conflux Group's avatar Jeremy Gimbel - Conflux Group

Couldn’t you just use

$assign_to_config[‘index_page’] = ‘indexforthissite.php’;

in each of the index files?

       
Steven Grant's avatar
Steven Grant
894 posts
15 years ago
Steven Grant's avatar Steven Grant

That’s one option Jeremy, you could also pull that into config.php as well.

I’ve got everything in there now. Makes maintenance a little easier.

       
Michael Witwicki's avatar
Michael Witwicki
115 posts
15 years ago
Michael Witwicki's avatar Michael Witwicki

Ah!

Thanks so much guys, I’ll pass that along to the user.

MW

       
Bjørn Børresen's avatar
Bjørn Børresen
629 posts
15 years ago
Bjørn Børresen's avatar Bjørn Børresen

If it doesn’t return the correct config value for the site you’re currently on sounds like an EE bug to me..?

Anyway, I’m sure you can find the value in the database - probably in the exp_sites table. It’s difficult to tell just by looking at it though since it’s serialzied and then base64 encoded. Yay.

       
Rob Sanchez's avatar
Rob Sanchez
335 posts
15 years ago
Rob Sanchez's avatar Rob Sanchez

I think this will do what you want:

$this->EE->config->item('site_index');
       
Wes Rice's avatar
Wes Rice
103 posts
15 years ago
Wes Rice's avatar Wes Rice

Have you tried just doing a var dump on $this->EE->config or even $this->EE to see what items are available?

       
Michael Witwicki's avatar
Michael Witwicki
115 posts
15 years ago
Michael Witwicki's avatar Michael Witwicki
I think this will do what you want:
$this->EE->config->item('site_index');

AAAAAAAH! Maybe I need to change the module to look for this instead for the next release.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.