Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-04-18 09:43:56

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Two txp-installations share the same data

I want to install two different txp-installs on the same database that share the same content data.

(I don’t mean just share the same database using prefixes, this is what I’m working with from the beginning. What I want now is this:)

Entirely different output: page template, css, plugins
but:
Same users, same content (also sections, categories).

(It’s not just switching css-templates, I need to use a completely different and independent page template. And I want to have it completely independent for both installs so one doesn’t affect the other – e.g. for a running instance on one domain and an experimental instance which can be seen from another domain/subdomain. )

As far as I see this could possibly be achieved by modifying which tables txp uses in the database: Using the same tables for content, users (textpattern, category, file, image, section, users …) –
versus
using different tables for css, form, lang, page, plugin, prefs.

I could imagine that this requires modifying in the base, but perhaps it could also be done by using a plugin, which tweaks the use of prefixes?
Someone already worked like this?

Offline

#2 2007-04-18 12:23:43

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: Two txp-installations share the same data

Would this help?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2007-04-18 13:32:26

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Re: Two txp-installations share the same data

Thank you!
As far as I can see this would work for the page templates if I include the whole page-template and it’s different version within the if-condition.
BUT: (from my first thoughts) There seems to be no way to get a different css to match each of the templates.
Am I right or do I miss something regarding css-management?

Offline

#4 2007-04-18 14:43:14

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: Two txp-installations share the same data

Hi Michel… I’m not using the particular plugin but from its description – although not said outright – it sounds like you could have different css and templates for each domain. Maybe you should ask Yura about this as he is the only one, as far as i know, who’s worked in the area that you are looking for.

Last edited by colak (2007-04-18 14:47:06)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2007-04-18 17:43:35

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Two txp-installations share the same data

If this for development purposes, I’d modify the TXP core file called textpattern/lib/txplib_db.php in your development install of TXP (replace live_prefix with the prefix of the live TXP install):

 function safe_pfx($table) {
-       $name = PFX.$table;
+       $pfx = in_array($table, array('textpattern, 'txp_category', 'txp_file, 'txp_image', 'txp_section')) ? 'live_prefix' : PFX;
+       $name = $pfx.$table;
         if (preg_match('@[^\w._$]@', $name))
                 return '`'.$name.'`';
         return $name;
 }

 function safe_pfx_j($table)
 {
         $ts = array();
         foreach (explode(',', $table) as $t) {
-                $name = PFX.trim($t);
+                $pfx = in_array(trim($t), array('textpattern, 'txp_category', 'txp_file, 'txp_image', 'txp_section')) ? 'live_prefix' : PFX;
+                $name = $pfx.trim($t);
                 if (preg_match('@[^\w._$]@', $name))
-                        $ts[] = "`$name`".(PFX ? " as `$t`" : '');
+                        $ts[] = "`$name`".($pfx ? " as `$t`" : '');
                 else
-                        $ts[] = "$name".(PFX ? " as $t" : '');
+                        $ts[] = "$name".($pfx ? " as $t" : '');
         }
         return join(', ', $ts);
 }

Last edited by ruud (2007-04-18 17:45:33)

Offline

#6 2007-04-18 18:00:36

sthmtc
Member
From: CGN, GER
Registered: 2005-01-17
Posts: 586
Website

Re: Two txp-installations share the same data

saccade wrote:

There seems to be no way to get a different css to match each of the templates.

why not? couldn’t you just wrap the conditional tag around the link to the stylesheet? something like

<txp:ied_if_domain domain="www.url1.com">
<link rel="stylesheet" href="/css/url1.css" type="text/css" media="screen" title="no title" charset="utf-8" />
<txp:else />
<link rel="stylesheet" href="/css/whatever.css" type="text/css" media="screen" title="no title" charset="utf-8" />
</txp:ied_if_domain />

Offline

#7 2007-04-18 22:17:35

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Re: Two txp-installations share the same data

@ruud
wow, thank you! this seems to be exactly what I’m looking for. I will test it tomorrow (it’s late here in germany).
True: It’s for development. I plan a major redesign of a large content improving accessibility. The board of the society first wants to see what it will look like before releasing or rejecting the redesign. A dummy page won’t work convincing.
And I think it’s a feature I would like for other installations too: Having a second txp install for redesigning-tweaking like “open-heart surgery” without harming the running install.
(This of course means that sections/categories are well chosen before)

@sthmtc
Thank you, but this would only work if I use only a single css for all pages and all sections.
It doesn’t work (as far as I see), if I use txp’s connection of section/css because it would simply overwrite/surpass what’s defined in the sections area in admin.

Last edited by saccade (2007-04-18 22:19:04)

Offline

#8 2007-05-03 05:20:30

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Re: Two txp-installations share the same data

@ruud

It is perfectly working – thank you very much!

Some missing quotes had to be added to the code above (see below) and I added txp_links. Now I have a separate txp working with the same data – perfect for developing a new layout.

array('textpattern', 'txp_category', 'txp_file', 'txp_image', 'txp_link', 'txp_section'))
(2 × in the code above)

Last edited by saccade (2007-05-03 05:21:04)

Offline

Board footer

Powered by FluxBB