Textpattern CMS support forum

You are not logged in. Register | Login | Help

#21 2018-12-29 09:33:34

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,290
Website

Re: flat scripts in 4.7.2

colak wrote #315803:

I still have many questions re docs.textpattern.com/installation/multi-site-textpattern. ie

Thanks for the feedback. I may go back and improve on it.

So, the multi-site install can not serve different domains? Further down the tutorial says we can, but this is slightly confusing.

Each site can be a different domain. It could also be a subdomain if you want it. The subdomain requirement refers to the admin and public sides: if they share the same domain, txp’s logged-in cookie works on the public and admin side together, which is useful for maintenance mode plugins or front-page edit links when logged in. So you could have the following structure:

/htdocs
    /sites
        /neme
            /admin      ->    admin.neme.org
            /private
            /public     ->    www.neme.org
        /neme-imca
            /admin      ->    admin.neme-imca.org
            /private
            /public     ->    www.neme-imca.org
        /neme-eventspace
            /admin      ->    eventadmin.neme.org
            /private
            /public     ->    eventspace.neme.org
        /statemachines
            /admin      ->    admin.statemachines.eu
            /private
            /public     ->    www.statemachines.eu
        /hblack
            /admin      ->    admin.hblack.net
            /private
            /public     ->    www.hblack.net
    /textpattern

If running multiple subdomains, as in the example with the eventspace subdomain, each admin area requires a separate subdomain, but you can name it how you like. I called it eventadmin. but you could also call it contributors. or manage. or whatever…

If the above is correct, would the web root be the one where the www domain is served from?

In this case I meant the folder on your host which is the base of your (theoretically) web-reachable folders. Many hosts call that www or htdocs with your account id-number. For a multi-site installation, you point your www.domain.com to the respective site’s public folder and the admin.domain.com to the respective site’s admin folder as in the example above.

Does this mean that we can have different site designs, sections, categories, url schemas, articles, images, content in general, using just one install?

Yes. Each site has its own admin area and own database (or database prefix) as before, but you have just one /textpattern folder with the files within it. The articles, images, links, categories are not all mixed up together in the same admin area.

Also what about migrating multiple sites to multisite administration?

There’s not an automated method, but it needn’t be complicated. Essentially, the /images, /files, /themes and any assets folders go into the /public folder, the config.php goes into the /private folder and if you’re using a plugin folder, put that in the /admin folder and adjust the paths accordingly in your site’s prefs. Likewise, the path in config.php needs adapting. Perhaps I should write another docs for that.

If you’re not averse to setting your own symlinks, you can theoretically also share content across multiple sites. When I was using rah_flat in the previous version of Textpattern, I had a /libs folder containing subfolders for sass modules, common javascript and also forms that were used in all the sites. That’s no longer quite as straightforward with the /themes folder.


TXP Builders – finely-crafted code, design and txp

Offline

#22 2018-12-29 11:41:33

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,290
Website

Re: flat scripts in 4.7.2

colak wrote #315806:

OK, I have created a short-tags category and written an article on the tips site (currently in drafts). One of the reasons I did not publish it is because textile does not seem to be parsing the tags starting with bc..

Julian, I understand you have publisher rights there, could you take a look?

This issue with textile seems to be appearing just for me and Stef:)

I checked your article and all you were missing was a space after bc... As a result it output the actual code on the next line (adding an audio element) instead of showing the code. I added a space and brought it up to the same line and it shows fine now.

BTW: the method

bc..{space}
txp
… txp code example …

that we can use in the forum doesn’t work in Textpattern itself and seems to be something specific to the forum.


TXP Builders – finely-crafted code, design and txp

Offline

#23 2018-12-29 14:12:08

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,069
Website

Re: flat scripts in 4.7.2

!!! That was exactly what I needed to understand multi-site functionality. Thanks so much Julian… and also thanks re the tips. Of course I know about the spaces etc but it does not matter how much I was trying, the code would not render as a preformatted code.

Now… Back to the issue of the docs:)

Much of the new tag parser provides a lot of shortcuts which may not be very obvious. Up to 4.6.x, txp tags followed the xml type schema but since 4.7 and thanks to Oleg’s efforts, some of the syntax is not always fully understandable to designers. Further to example 8, I added to the docs a few weeks ago, and pointed out yesterday in this thread is based on Oleg’s forum post, makes no sense to me, but I know that it works. Like with the doc types or the new <header> functionalities, or even this very handy tip from Oleg (<txp:evaluate query='0<txp:variable name="no" />+1' />) which also works but I do not understand:)

Again, I am not complaining, I’m just excited by the possibilities and I’m trying to see how they can be made more accessible to designers.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github

Offline

#24 2018-12-29 18:58:39

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 1,404
Website

Re: flat scripts in 4.7.2

i hope this is where i post this question. In the new year i am going to finally give TxP and editing Flat Files a go. So what do i need to download/install to get started?


…. texted postive

Offline

#25 2018-12-29 19:02:17

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,069
Website

Re: flat scripts in 4.7.2

bici wrote #315831:

i hope this is where i post this question. In the new year i am going to finally give TxP and editing Flat Files a go. So what do i need to download/install to get started?

This is easy:) As from the latest version(s), you do not need to download anything. You could do everything on TextEdit on mac, PlainText on pc, or you could use an html editor of your choice. If there is one thing not installed in most computers but you most definitely have already is an ftp client:)


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github

Offline

#26 2018-12-29 21:47:06

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,290
Website

Re: flat scripts in 4.7.2

colak wrote #315832:

This is easy:) As from the latest version(s), you do not need to download anything.

But etc_flat can be helpful if you want to develop using flat files. The difference is:

  • regular situation:
    • your pages, forms and styles are stored as usual in the database, now grouped by theme. You can export these to disk to save them as files in the /themes folder.
    • you can edit the flat files on disk as well but it has no effect until you import the files from disk to the database.
  • with etc_flat:
    • When working in testing or debugging mode, textpattern fetches the flat files directly from the disk, by-passing the database.
    • When working in live mode, the database versions are used. To make the live version match your testing version, you need to import the theme from disk to the database.

So, etc_flat is not needed but helpful in practice when developing. Please correct me if I am mistaken.


TXP Builders – finely-crafted code, design and txp

Offline

#27 2019-02-01 13:46:31

ia278
Member
From: UK
Registered: 2018-11-07
Posts: 14
Website

Re: flat scripts in 4.7.2

etc wrote #315739:

that should be format

<txp:output_form form="jquery.js" format="flat.script" />...

I’m having a problem with this too…

So what I’ve done is create a generic form called myscript.js, and then called it using;

<txp:output_form form="myscript.js" format="script" mediatype="application/javascript" />

Is this correct? Because although the source code spits out a script tag with the required src, the actual link shows an empty page…

Last edited by ia278 (2019-02-01 14:49:23)

Offline

#28 2019-02-01 14:25:45

etc
Developer
Registered: 2010-11-11
Posts: 3,069
Website

Re: flat scripts in 4.7.2

ia278 wrote #316398:

To use this, you must create a custom js form type in Advanced options:

[js]
mediatype="application/javascript"

although the source code spits out a script tag with the required src, the actual link shows an empty page…

Then assign js type to myscript.js form and save it to disk (via Export to disk checkbox or Theme export). Then

<txp:output_form form="myscript.js" format="flat.script" />

should work. Or fetch the form from db with (mind .js extension)

<txp:output_form form="myscript.js" format="script" />

Or rename it to just myscript (without .js) and use your code (mediatype attribute is not needed).

Hope that helps.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#29 2019-02-01 15:06:32

ia278
Member
From: UK
Registered: 2018-11-07
Posts: 14
Website

Re: flat scripts in 4.7.2

You’ve definitely helped – I can see the root of the problem a bit better now! Thanks!

So, I’ve added [js] mediatype="application/javascript" title="JavaScript" to the advanced options (even though it’s the same as the stuff that comes by default, minus the ;?), and managed to get the database version working – but I don’t think the flat file version is?

I remember seeing this;

  • path/to/site/index.php?f=hello.js will serve the parsed db version
  • path/to/theme/forms/js/hello.js will serve the unparsed flat file version

I’m only getting the former. And I’ve not seen the Export to disk checkbox at all (which I assume I need to do to save the form as a flat file)…

Last edited by ia278 (2019-02-01 15:31:25)

Offline

#30 2019-02-01 15:56:34

etc
Developer
Registered: 2010-11-11
Posts: 3,069
Website

Re: flat scripts in 4.7.2

Fine, getting closer. Custom form types are in ini format, ; is just a comment. Have you ever exported your theme to disk? To be sure, go to Themes tab, select the current theme and try to export it. This should enable export checkbox for forms, pages and styles. Once hello.js is exported, you should be able to use its flat copy.


etc_[ query | search | pagination | date | tree | cache ]

Offline

Board footer

Powered by FluxBB