Jump to content

Search the Community

Showing results for tags 'multi-instance'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • 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


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 10 results

  1. Hello, in a project I use the multi-instance feature of ProcessWire to get content from another ProcessWire instance which is kind of a "database". I do not modify the external content. For a slider I want to store references to the "database" in an InputfieldPage. To get the available pages I use the following code in my ready.php: $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'kub_highlight_artworks') { // Server path to the PW installation $path = '/var/www/vhosts/.../'; // The root URL for the PW installation $url = 'https://.../'; // Create a new ProcessWire instance $db = new ProcessWire($path, $url); $event->return = $db->pages->find("template=artwork, sort=title"); } }); Outputting and selecting the external pages works perfectly fine, but unfortunately the selected pages do not get saved when I save the page. Can someone point me into the right direction how to make this work? Are there any internal checks whether the page exists in the current instance that prevent saving the values? Best, Flo
  2. Hi! So I am trying to pull some information from another ProcessWire installation within the admin area (_main.php / page tree from the AdminThemeUikit module). $pwpath = "/path/"; $pwurl = "https://url.example"; $pw = new ProcessWire($pwpath , $pwurl); which then gives me this error I then read that if it is not already in a ProcessWire environment that I would have to include the core, require('/path/to/wire/core/ProcessWire.php'); Which I tried, and makes sense that it already says it is included. So what now? Here is my _main.php from the AdminThemeUikit module (work in progress), just for reference
  3. Having a problem with a basic multi-site instance. The multi-sites are dynamically created and run as sub-domains and all is ok with them. They are created during a sign up process by end users. During the sign up process - once the new site & db has been created, I had planned to load the new site instance and add a new user to it, using code similar to this.. $newSiteInstance = new ProcessWire($path, $newSiteUrl); $u = $newSiteInstance->users->add($sitename); $u->pass = $pass; $u->email = $email; $u->addRole('content-viewer'); $x = $newSiteInstance->users->save($u); This won't work in the registration script. It throws an error ... "SQLSTATE[42S02]: Base table or view not found". However, if I halt the script, load the new site incognito/other browser, then continue the script, all works perfectly. So $newSiteInstance = new ProcessWire($path, $newSiteUrl); doesn't seem to work for me unless a site has already been loaded in a browser or instantiated somehow. I am missing something here ? Does a site need to be bootstrapped before new instance will work on it ? Sorry, pretty new to this php/PW arena. Having fun though Any ideas folks ?
  4. Hi guys, I was wondering if there is an option to load another site in the FieldtypePage by using the custom PHP code to find selectable pages. // placed as custom PHP code to find selectable pages return $content->pages->get("/")->children(); When it needs hooking into methods as "InputfieldPage::___getSelectablePages" or "InputfieldPage::___findPagesCode", I'd like to know how. By just placing the following code somewhere in the methods it won't work, but maybe someone else knows how? $content = new ProcessWire('/mypath/to/content/site/', '/content/'); // placed in subdirectory Maybe it isn't even possible, but then also, I'd like to know .
  5. I have setup two websites, A and B. A can read pages from B using the multi-instance API. But how do I get A to save a new page to B? I have this simple test setup: $path = "C:/Users/Marc/Documents/development/www/siteB/"; $url = "/siteB/"; $siteB = new ProcessWire($path, $url); $np = new Page(); $np->template = "my-template"; $np->parent = $siteB->pages->get('/forms/'); $np->title = 'test multi-instance form'; $np->save(); The page is saved to site A instead of B, with no parent. Is this a case of saving it to the wrong instance? If so, how do I save it to the correct instance (site B)?
  6. I'm working on a process module that connects to another ProcessWire 3.0.54 installation on the same (local) server (both sites running 3.0.54). I'm trying to use multi-instance for this, so: namespace ProcessWire; $path = "C:/Users/Me/Documents/development/www/pw3/"; $url = "http://www.test.me"; $site = new ProcessWire($path, $url); Those simple three lines generate the following error: I'm probably missing something obvious here as I don't have much experience with namespaces yet. Any suggestions?
  7. What am I mixing up that this won't work, or better to say will throw "..Base table or view not found..." $meta = new ProcessWire($config->paths->root . 'site-meta/', "http://meta.$config->domain"); $backupPath = $config->paths->assets . 'backups/database/'; $backup = new WireDatabaseBackup($backupPath); $backup->setWire($wire); $backup->setDatabase($database); $backup->setDatabaseConfig($config); $backupFile = $backup->backup(['description' => 'saludos your Cron']); if ($backupFile) { wireZipFile("$backupFile.zip", $backupFile); exec("ln -sf $backupFile.zip {$backupPath}newest.sql"); $log->message("linked $backupFile"); unlink($backupFile); } $backupMeta = new WireDatabaseBackup($backupPath); $backupMeta->setWire($meta); $backupMeta->setDatabase($meta->database); $backupMeta->setDatabaseConfig($meta->config); $backupMetaFile = $backupMeta->backup(['description' => 'saludos your Cron']); if ($backupMetaFile) { wireZipFile("$backupMetaFile.zip", $backupMetaFile); exec("ln -sf $backupMetaFile.zip {$backupPath}newestMeta.sql"); $log->message("linked $backupMetaFile"); unlink($backupMetaFile); } if I comment one of them out they'll work properly if I'm trying to run both as in the snippet above the second one fails after the first tables with the above error indicating meta.field_date is missing but this field is only present in the above installation (so the "host" processwire) even tried to explicitly set the tables to backup for the second on with no difference $backupMetaFile = $backupMeta->backup(['description' => 'saludos your Cron', 'tables' => $backupMeta->getAllTables()]); var_dumping $backupMeta->getAllTables() will show the correct tables, meaning there is no reference to field_date tried to instantiate WireDatabaseBackup within meta by $backupMeta = $meta->wire(new WireDatabaseBackup($backupPath)); which works creating pages but in this case throws another error, but as both run from the same pw installation (multisite) there is only one WireDatabaseBackup anyway.. and I also tried to specify a different path the code is supposed to be part of a cron, right now it sits in my site/init for testing So to clarify, my setup looks like this root - wire - site - site-meta - index.php - index.config.php everything else works as expected with this setup, so far.
  8. Hey guys, As I'm refactoring one of our websites completely I thought it's nice to start from scratch and make use of new multi-instance support to import data from the old site. Most of it works nice so far, except I'm encountering a little (I guess) UTF-8 issue as the imported content within the new site has some black diamonds with question marks in it. I tried utf8_en/decode and combinations in any order, $sanitizer->purify / ->entities / ->unentities, htmlspecialchars and various other possible solutions with no luck Then I tried the same grabbing and inserting the body field directly from and to the db with no difference.. Both db's are utf8_general_ci and pw is at 3.0.33 As a side note, no question mark diamonds in the old (nor the new) db and old page content works as expected of course Uh I also tried to set charsets using php's header and ini_set functions.. Hopefully one got another idea
  9. I'm using the multi-instance feature of PW to create a page from the wordpress admin and after the page is created i save its id in a custom meta field in wp. The page should be created/updated when a post is first created or updated through wp's post_updated hook. Here is the code: The page is created in PW but its id is not saved in wp custom meta field. If i comment the "$p->save();" line i don't get the error, but i obviously need it. On localhost it works, but on the server i get the error; same PW, WP (same plugins) and PHP version, only the os differs, Windows on localhost and Debian on the server. Any ideas? Update: I used the site profile exporter module to move from localhost to the live server and it seems like this was the cause as everything worked after i manually set up the templates and fields on a clean install. I did uncheck the installed checkbox from the module's options. Could that be the reason?
  10. Hi guys, I would very much appreciate to get your feedback to the following idea: We've created a publishing system for our company that is based on ProcessWire. Currently we are only using it for one publishing page. But it could very well be possible that in the future we are in need of managing additional pages. I'm thinking of something like it is described in the article about Multiple-site support, but with something like a site-core that is included by any site instance. To keep server management simple all the instances could use the same database. Imagine the following folder structure: All the templates, modules and assets from the "site-core" folder are automatically loaded by each other "site-" instance. This would enable other instances to add their own templates but still let them use the "site-core" templates. Also the ProcessWire "wire" folder would remain untouched. Additionally it could be great to restrict module configuration access to only activate the "Site" tab on instances. And being able to create new instances from the "site-core" instance ;-) What do you think? Thanks for your feedback Nik
  • Create New...