Jump to content

Search the Community

Showing results for tags 'index.config.php'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. Hi Folks, We have a multi-site #1, multiple sites, multiple databases platform in development/concept at the moment. A company can sign up, register, and PW then creates a db, copies over a site folder with /wire symlink. All seems to work well, after sign up they can then enter into their subdomain site. ( Because of this dirty hack below that inserts the new subdomain into PW's hostSiteConfig array. Without this, the subdomain is not correctly registered as a PW site & instance I think). Does anyone know how to dynamically add an entry into the index.config.php file ? Knowing the little I have learnt so far about PW, Ryan has probably left us a really smart way to do it, but I haven't figured it out or found it yet. I have done a dirty hack on it, which I'm not very happy or proud off. Anybody know of a better way around the problem ? ... below is more or else the code I am using in the pilot version. // some error traps taken out for brevity on the booleans below... $hostsArray = ProcessWireHostSiteConfig(); // $sitename normally populated from the customers signup/registration // hard coded here for this example... $sitename ='somesubdomain'; $a = $sitename . '.' . 'localhost:8020'; // machine name, port & protocol normally comes from $config, hard coded for example. $b = 'site-' . $sitename . '/site'; $newSite = array($a => $b); $hostsArray = array_merge($hostsArray, $newSite); // very dirty hack starting.... // creating a string copy of the array used in // index.config.php $newString=''; foreach($hostsArray as $key => $value) { $newString .= "'" . $key . "' => '" . $value . "', "; } $newString = "return array(" . $newString . ');}'; // dirty hack getting worse :-( $newConfigIndex = file_get_contents($config->paths->root . 'index.config.php'); $startpos = strpos($newConfigIndex, 'return array('); // quality coders starting to feel sick at this point i suspect... sorry! ;-( $newConfigIndex = substr_replace($newConfigIndex, $newString, $startpos); $boolConfigIndex = file_put_contents($config->paths->root . 'index.config.php', $newConfigIndex); // crikey! did he really just do that !!!!!!
×
×
  • Create New...